[jboss-svn-commits] JBL Code SVN: r34875 - in labs/jbossrules/branches/DRLv6/src: test/java/org/drools/lang and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 24 19:03:04 EDT 2010


Author: dsotty
Date: 2010-08-24 19:03:04 -0400 (Tue, 24 Aug 2010)
New Revision: 34875

Modified:
   labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g
   labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g
   labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java
Log:


Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-24 20:00:44 UTC (rev 34874)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Lexer.g	2010-08-24 23:03:04 UTC (rev 34875)
@@ -1,5 +1,5 @@
 lexer grammar DRLv6Lexer;
-  
+   
 options {
   language = Java; 
 }  
@@ -9,6 +9,9 @@
 
 }
 
+
+
+
 WS      :       ( ' '
                 | '\t'
                 | '\f'
@@ -142,6 +145,39 @@
   | 'equivalence'
   ; 
   
+  
+  
+  
+MDA_FUNCTIONAL
+  :  'functional' | 'Functional'
+  ;
+  
+MDA_FUNCTIONAL_INV
+  : 'inverseFunctional' | 'InverseFunctional'
+  ;    
+  
+MDA_REFLEXIVE
+  : 'reflexive' | 'Reflexive'
+  ;
+  
+MDA_REFLEXIVE_INV
+  : 'irreflexive' | 'Irreflexive'
+  ;    
+  
+MDA_SYMMETRIC
+  : 'symmetric' | 'Symmetric'
+  ;  
+
+MDA_SYMMETRIC_INV
+  : 'asymmetric' | 'Asymmetric'
+  ;  
+  
+MDA_TRANSITIVE
+  :  'transitive' | 'Transitive'
+  ;  
+  
+  
+  
 OA_KIND
   :   'kind'
   ;
@@ -200,14 +236,14 @@
 ACTION
   : 'action'
   ;
-
-ALL
-  : 'all'
-  ;
   
 AND
   : 'and'
   ;
+  
+ANNOTATIONS
+  : 'annotations' | 'Annotations'
+  ;  
 
 AS
   : 'as'
@@ -229,6 +265,14 @@
   : 'branch'
   ; 
   
+CHARACTERISTICS
+  : 'Characteristics'
+  ;  
+  
+CLASS
+  : 'Class' | 'class'
+  ;  
+  
 CLOSURE
   : 'closure'
   ;  
@@ -248,6 +292,10 @@
 COUNT
   : 'count'
   ;
+  
+DATATYPE
+  : 'Datatype'
+  ;  
 
 DECLARE
   : 'declare'
@@ -257,11 +305,30 @@
   : 'defeats'
   ;
 
+DIFFERENTFROM
+  : 'differentFrom' | 'DifferentFrom'
+  ;
 
+DIFFERENT_INDIVIDUALS
+  : 'differentIndividuals' | 'DifferentIndividuals'
+  ;
+
 DISJOINT
-  :  'disjoint'
+  : 'disjointWith' | 'DisjointWith'
   ;
 
+DISJOINT_CLASSES
+  : 'disjointClasses' | 'DisjointClasses'
+  ;
+    
+DISJOINT_PROPERTIES
+  : 'disjointProperties' | 'DisjointProperties'
+  ;
+  
+DISJOINT_UNION
+  : 'disjointUnionOf' | 'DisjointUnionOf'
+  ;  
+
 DISTINCT
   : 'distinct'
   ;
@@ -271,13 +338,17 @@
   : 'do'
   ;
 
+DOMAIN
+  : 'domain' | 'Domain'
+  ;
+
 END
   : 'end'
   ;
 
   
 ENTITY
-  : 'entity'
+  : 'Entity' | 'entity'
   ; 
   
 ENTRYPOINT
@@ -288,10 +359,26 @@
   : 'equiv'
   ; 
 
+EQUIVALENT_CLASSES
+  : 'equivalentClasses' | 'EquivalentClasses'
+  ;
+    
+EQUIVALENT_PROPERTIES
+  : 'equivalentProperties' | 'EquivalentProperties'
+  ;
+    
+EQUIVALENTTO
+  : 'equivalentTo' | 'EquivalentTo'
+  ;  
+
 EVENT
-  : 'event'
+  : 'Event' | 'event'
   ;
 
+EXACTLY
+  : 'exactly'
+  ;
+
 EXISTS
   : 'exists'
   ;
@@ -300,6 +387,10 @@
   : 'extends'
   ;
  
+FACTS
+  : 'facts' | 'Facts'
+  ; 
+ 
 FALLING
   : 'falling'
   ; 
@@ -319,27 +410,35 @@
 FUNCTION
   :   'function'  
   ;
-  
+    
 GLOBAL
   : 'global'
   ; 
 
+HASKEY
+  : 'HasKey'
+  ;
+  
 IMPLIES
   : 'implies'
   ;
 
 IMPORT  
-  : 'import'
+  : 'import' | 'Import'
   ;
 
 IN
   : 'in'
   ;
+  
+INDIVIDUAL  
+  : 'individual' | 'Individual'
+  ;
 
 INIT
   : 'init'
   ;
-
+ 
 INSERT
   : 'insert'
   ;
@@ -351,6 +450,10 @@
 INVERSE
   : 'inverse'
   ;   
+
+INVERSEOF
+  : 'inverseOf' | 'InverseOf'
+  ;
     
 JAVA
   :  'java'
@@ -363,7 +466,15 @@
 LENGTH
   : 'length'
   ;
-
+  
+LENGTH_MIN
+  : 'minLength'
+  ;
+ 
+LENGTH_MAX
+  : 'maxLength'
+  ;
+  
 LIMIT
   : 'limit'
   ;
@@ -406,7 +517,6 @@
   : 'mol'
   ; 
 
-
 NAMESPACE
   : 'namespace'
   ;
@@ -415,6 +525,14 @@
   : 'null'
   ;
 
+ONLY
+  : 'only' | 'all'
+  ;
+
+ONTOLOGY
+  : 'ontology' | 'Ontology'
+  ;
+
 OR
   : 'or'
   ;
@@ -432,13 +550,37 @@
   ;
 
 PACKAGE 
-  :   'package'
+  : 'package'
   ;
 
+PATTERN
+  : 'pattern'
+  ;
+  
+PATTERN_LANG
+  : 'langPattern'
+  ;  
+
+PREFIX 
+  : 'Prefix'
+  ;
+
 PROPERTY
   : 'property'
+  ;
+
+PROPERTY_OBJECT
+  : 'ObjectProperty'
   ;  
 
+PROPERTY_DATA
+  : 'DataProperty'
+  ;
+
+PROPERTY_ANNOTATION
+  : 'AnnotationProperty'
+  ;
+
 ONCHANGE
   : 'onChange'
   ;
@@ -447,6 +589,10 @@
   : 'query'
   ;
   
+RANGE
+  : 'range' | 'Range'
+  ;  
+  
 RESULT
   : 'result'
   ;
@@ -475,6 +621,18 @@
   : 'rule'
   ;
   
+SAMEAS
+  : 'sameAs' | 'SameAs'
+  ;  
+  
+SAME_INDIVIDUAL
+  : 'sameIndividual' | 'SameIndividual'
+  ;  
+
+SELF
+  : 'Self'
+  ;
+  
 SEQ
   : 'seq'
   ;  
@@ -483,22 +641,34 @@
   : 'some'
   ; 
 
+SUBCLASSOF
+  : 'SubClassOf'
+  ;
+  
+SUBPROPERTYCHAIN
+  : 'SubPropertyChain'
+  ;  
+  
+SUBPROPERTYOF
+  : 'SubPropertyOf'
+  ;  
+
 START
   : 'start'
   ; 
   
 SUM
   : 'sum'
-  ;
+  ;    
   
-SYMMETRIC
-  : 'symmetric'
-  ;  
-  
 TEMPLATE
   : 'template'
   ;
 
+THAT
+  : 'that'
+  ;
+
 THEN
   : 'then'
   ;
@@ -511,14 +681,34 @@
   : 'time'
   ;   
   
-TRANSITIVE
-  :  'transitive'
-  ;  
-  
 TYPE
   : 'type'
   ;  
 
+TYPES
+  : 'types' | 'Types'
+  ;
+  
+TYPE_STRING
+  : 'string' | 'String'
+  ;
+  
+TYPE_INTEGER
+  : 'integer' | 'Integer'
+  ;
+  
+TYPE_FLOAT
+  : 'float' | 'Float'
+  ;
+  
+TYPE_DOUBLE
+  : 'double' | 'Double'
+  ;
+  
+TYPE_BOOLEAN
+  : 'boolean' | 'Boolean'
+  ;  
+
 UNIQUE
   : 'unique'
   ;
@@ -559,6 +749,10 @@
   : '->'
   ;
 
+CHAIN_SEP
+  : 'o'
+  ;
+
 COLON
   : ':'
   ;
@@ -590,6 +784,10 @@
   : '^^'
   ; 
 
+DOUBLE_COLON
+  : '::'
+  ;
+
 DOUBLE_HYPEN 
   : '--'
   ;
@@ -752,7 +950,12 @@
   { state.text = $text.substring(1, $text.length() - 1);  }
   ;
   
+PREFIXED_ID 
+  : ':' IdentifierStart IdentifierPart*  
+  { state.text = $text.substring(1, $text.length() - 1);  }
+  ;  
   
+  
 MISC  :
     //'!' | '%' | '^' | '*' | '-' | '+'  | '?' | '/' | '\'' | '\\' | '|' | '&' 
     '^' | '\'' | '\\' | '&' 

Modified: labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g
===================================================================
--- labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-24 20:00:44 UTC (rev 34874)
+++ labs/jbossrules/branches/DRLv6/src/main/resources/DRLv6Parser.g	2010-08-24 23:03:04 UTC (rev 34875)
@@ -3,7 +3,7 @@
 options {
   language = Java;
   output = AST;
-  tokenVocab = DRLv6Lexer;
+  tokenVocab = DRLv6Lexer;  
 }
       
      
@@ -11,6 +11,10 @@
   VT_COMPILATION_UNIT;
   VT_PACKAGE_ID;
   VT_PACKAGE;
+  VT_IMPORT_SECTION;
+  VT_ONTOLOGY_SECTION;
+  VT_DECLARATION_SECTION;
+  VT_RULEBASE_SECTION;
   
   VT_GLOBAL_ID;
   VT_DATA_TYPE;
@@ -37,6 +41,8 @@
   VT_DL_TYPE;
   VT_FIELD;
   
+  VT_ENTITY_TYPE;
+  
   VT_RULE_ID; 
   VT_ATTRIBUTES;
   VT_DIALECT;
@@ -80,6 +86,10 @@
   VT_EXISTS;
   VT_FORALL;
   VT_NEXISTS;
+  VT_COUNT;
+  VT_MIN;
+  VT_MAX;
+  VT_VALUE;
     
   VT_PATTERN;
   VT_NESTED_PATTERN;
@@ -126,6 +136,43 @@
   VT_ACC_ITER_RES;
   
   VT_COLLECT_LIST;
+  
+  
+  VT_ONTOLOGY;
+  VT_IRI;
+  VT_PREFIX;
+  VT_ANNOTATIONS;
+  VT_ANNOTATION;
+  VT_DL_DEFINITION;
+  VT_FIELD;
+  
+  VT_DL_TYPE;    
+  VT_DL_PROP;
+  VT_DL_RESTRICTION;
+  VT_DL_RESTRICTED_TYPE;
+  
+  VT_EQUIVALENTTO;
+  VT_SUBCLASSOF;
+  VT_DISJOINTWITH;
+  VT_DISJOINTUNIONOF;
+  VT_SUBPROPERTYOF; 
+  VT_INVERSEOF;
+  VT_SUBPROPERTYCHAIN;
+  VT_DOMAIN;
+  VT_RANGE; 
+  
+  VT_FACTS;
+  VT_FACT;
+  VT_TYPES;
+  VT_SAMEAS;
+  VT_DIFFERENTFROM;
+  
+  VT_EQV_CLASS;
+  VT_DIF_CLASS;
+  VT_EQV_PROP;
+  VT_DIF_PROP;
+  VT_EQV_INDV;
+  VT_DIF_INDV;
 }
   
 @parser::header {
@@ -135,15 +182,24 @@
   import java.util.LinkedList;
 }
 
- 
+  
 
 /**************************** SCOPE *******************************************/
 
 compilation_unit
   : package_statement?
-    statement*
+    general_import_statement*
+    declaration_statement*
+    ontology_section?
+    rulebase_statement*
     EOF
-    -> ^(VT_COMPILATION_UNIT package_statement? statement*) 
+    -> ^(VT_COMPILATION_UNIT 
+        package_statement?
+        ^(VT_IMPORT_SECTION general_import_statement*) 
+        ^(VT_DECLARATION_SECTION declaration_statement*)
+        ^(VT_ONTOLOGY_SECTION ontology_section?)
+        ^(VT_RULEBASE_SECTION rulebase_statement*)
+        ) 
   ;
   
   
@@ -166,16 +222,25 @@
 
 /**************************** STATEMENTS *******************************************/
 
-statement
+
+general_import_statement
   : function_import_statement   
-  | import_statement  
-  | global  
+  | import_statement 
+  ;
+ 
+declaration_statement
+  : global  
   | function
-  // | template
-  | type_declaration
-  | rule
+  ;
+
+ontology_section
+  : manDL_ontology 
+//  | type_declaration*
+  ;
+
+rulebase_statement
+  : rule
   | query
-  //| rule_attribute    // why???
   ;
 
 
@@ -189,13 +254,24 @@
   : id=ID 
     -> VT_GLOBAL_ID[$id]
   ;
+
+
   
-data_type
+  
+primitive_type 
+  : TYPE_STRING
+  | TYPE_INTEGER
+  | TYPE_FLOAT
+  | TYPE_DOUBLE
+  | TYPE_BOOLEAN
+  ;
+  
+data_type returns [int dim]
 @init{
- int dim=0;
+ $dim=0;
 }
-  : fully_qualified_name (dimension_definition {dim++;})*
-    -> ^(VT_DATA_TYPE VT_DIM_SIZE[$start,""+dim] fully_qualified_name )
+  : fully_qualified_name (dimension_definition {$dim++;})*
+    -> ^(VT_DATA_TYPE VT_DIM_SIZE[$start,""+$dim] fully_qualified_name )
   ;
 dimension_definition
   : LEFT_SQUARE RIGHT_SQUARE 
@@ -249,7 +325,8 @@
 
 
 
-/**************************** TYPE DECLARATION *******************************************/
+/****************************************** 
+*     TYPE DECLARATION 
 
 
 
@@ -300,17 +377,17 @@
 tda_disjoint
   :     DISJOINT^ LEFT_PAREN! ID RIGHT_PAREN!
   ;
-
+ 
 tda_inverse
-  :     INVERSE^ LEFT_PAREN! ID RIGHT_PAREN!
+  :     INVERSEOF^ LEFT_PAREN! ID RIGHT_PAREN!
   ;  
   
 tda_symmetric
-  :     SYMMETRIC^
+  :     MDA_SYMMETRIC^
   ;
   
  tda_transitive
-  :     TRANSITIVE^
+  :     MDA_TRANSITIVE^
   ;  
   
   
@@ -319,36 +396,10 @@
     -> ^(VT_EXTENDS fully_qualified_name)
   ;
 
-decl_field
-  : ID  
-    decl_field_initialization? 
-    COLON 
-    data_type
-    decl_field_attributes?
-    -> ^(VT_FIELD decl_field_attributes? ID data_type decl_field_initialization? )
-  ;
 
-decl_field_initialization
-  : EQUALS paren_chunk
-  -> ^(EQUALS paren_chunk)
-  ;
 
- 
-decl_field_attributes
-  :
-      AT LEFT_SQUARE
-          decl_field_attribute (COMMA decl_field_attribute)*         
-      RIGHT_SQUARE
-      -> ^(VT_ATTRIBUTES decl_field_attribute+)      
-  ;
 
-decl_field_attribute
-  :
-    KEY 
-  ;
 
-
-
 dl_class_descr 
   :   AS dl_implies
       -> ^(VT_DL_DEFINITION dl_implies) 
@@ -391,11 +442,583 @@
   ;  
   
 dl_prop
-  :   ID (ALL | SOME)^ dl_type      
+  :   ID (ONLY | SOME)^ dl_type      
   ;  
   
+*/
+
+decl_fields
+  : decl_field more=decl_field*
+  -> ^(VT_EQUIVALENTTO ^(VT_DL_DEFINITION ^(VT_AND decl_field+)))
+  //-> {more==null?} ^(VT_EQUIVALENTTO ^(VT_DL_DEFINITION decl_field ))
+  //-> ^(VT_EQUIVALENTTO ^(VT_DL_DEFINITION ^(VT_AND decl_field* )))
+  ;
+
+                          //^("min" "1" decl_field)
+                          //^("max" "1" decl_field)
+decl_field
+  : ID      
+    COLON 
+    data_type
+    decl_field_attributes?
+    //-> ^(VT_FIELD decl_field_attributes? ID data_type )
+    -> {$data_type.dim==0}? 
+        ^(VT_AND 
+          decl_field_attributes?
+          ^(VT_COUNT ID ^(VT_MIN INT["1"]) data_type)
+          ^(VT_COUNT ID ^(VT_MAX INT["1"]) data_type)
+          ^(VT_FORALL ID data_type)
+        )
+    ->  ^(VT_AND 
+          decl_field_attributes?
+          ^(VT_EXISTS ID data_type)
+          ^(VT_FORALL ID data_type)
+        ) 
+  ;
+
+ 
+decl_field_attributes
+  :
+      AT LEFT_SQUARE
+          decl_field_attribute (COMMA decl_field_attribute)*         
+      RIGHT_SQUARE
+      -> ^(VT_ATTRIBUTES decl_field_attribute+)      
+  ;
+
+decl_field_attribute
+  :
+    KEY 
+  ;
+ 
+ 
+/*******************************************************************
+*                         MANCHESTER SYNTAX
+*******************************************************************/  
   
+manDL_ontology
+  : manDL_prefix*
+    ONTOLOGY COLON iri+
+    manDL_inport*
+    manDL_annotations?
+    manDL_type_declaration*
+    -> ^(VT_ONTOLOGY ^(VT_NAME iri+) manDL_prefix* manDL_inport* manDL_annotations? manDL_type_declaration*)    
+  ;   
+  
+manDL_prefix
+  : PREFIX COLON ID COLON full_iri
+  -> ^(VT_PREFIX ID full_iri)
+  ;  
+  
+  
+manDL_inport  // :)
+  : IMPORT COLON iri   
+  -> ^(VT_IMPORT iri)
+  ;  
+  
+  
+manDL_type_declaration
+  :   manDL_datatype_def
+      | manDL_class
+      | manDL_event
+      | manDL_objectProperty
+      | manDL_dataProperty
+      | manDL_annotationProperty
+      | manDL_namedIndividual  
+      | manDL_misc
+  ;  
+  
+  
+  
+manDL_datatype_def
+  : (AT type=DATATYPE DECLARE
+    | type=DATATYPE COLON )
+      iri
+      manDL_datatype_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) manDL_datatype_frame*)
+  ;
 
+manDL_class
+  : ( (AT type=CLASS)? DECLARE
+    | type=CLASS COLON )
+      
+      iri
+      manDL_class_frame*
+      decl_fields?         
+    END?
+  -> {type!=null}? ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) manDL_class_frame* decl_fields?)
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE["Class"]) ^(VT_TYPE_DECLARE_ID iri) manDL_class_frame* decl_fields?)
+  ;
+
+
+manDL_event
+  : ( AT type=EVENT DECLARE
+    | type=EVENT COLON ) 
+    
+      iri
+      manDL_class_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) manDL_class_frame*)
+  ;
+ 
+manDL_objectProperty
+  : ( AT type=PROPERTY_OBJECT DECLARE
+    | type=PROPERTY_OBJECT COLON)
+      iri
+      (AT manDL_attribute)* 
+      manDL_objProp_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) ^(VT_ATTRIBUTES manDL_attribute*)? manDL_objProp_frame*)
+  ;
+    
+manDL_dataProperty
+  : (AT type=PROPERTY_DATA DECLARE
+    | type=PROPERTY_DATA COLON) 
+      iri
+      (AT manDL_attribute)* 
+      manDL_dataProp_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) manDL_dataProp_frame*)
+  ;
+  
+manDL_annotationProperty
+  : ( AT type=PROPERTY_ANNOTATION DECLARE
+    | type=PROPERTY_ANNOTATION COLON)
+     iri
+      manDL_annProp_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_TYPE_DECLARE_ID iri) manDL_annProp_frame*)
+  ;
+  
+manDL_namedIndividual
+  : (AT type=INDIVIDUAL DECLARE
+    | type=INDIVIDUAL COLON)  
+      iri
+      manDL_indiv_frame*
+    END?
+  -> ^(VT_TYPE_DECLARE ^(VT_ENTITY_TYPE[$type]) ^(VT_NAME iri) manDL_indiv_frame*)
+  ;  
+  
+
+  
+ 
+manDL_datatype_frame
+  : manDL_annotations
+  | manDL_equivalentTo  
+  ;  
+  
+manDL_class_frame
+  : manDL_annotations
+  | manDL_disjointUnionOf
+  | manDL_disjointWith
+  | manDL_equivalentTo
+  | manDL_subClassOf
+  | manDL_hasKey
+  ;
+  
+manDL_dataProp_frame
+  : manDL_annotations
+  | manDL_domain  
+  | manDL_range  
+  | manDL_attributes    
+  | manDL_disjointWith
+  | manDL_equivalentTo
+  | manDL_subPropertyOf  
+  ;    
+  
+manDL_objProp_frame
+  : manDL_annotations
+  | manDL_attributes
+  | manDL_disjointWith
+  | manDL_equivalentTo
+  | manDL_inverseOf
+  | manDL_domain  
+  | manDL_range
+  | manDL_subPropertyOf
+  | manDL_subPropChain
+  ;
+  
+  
+manDL_annProp_frame
+  : manDL_annotations
+  | manDL_domain  
+  | manDL_range
+  | manDL_subPropertyOf
+  ;  
+  
+manDL_indiv_frame 
+  : manDL_annotations
+  | manDL_types
+  | manDL_facts
+  | manDL_sameAs
+  | manDL_differentFrom
+  ;
+
+
+manDL_misc
+  : (eq=EQUIVALENT_CLASSES | df=DISJOINT_CLASSES) COLON
+      manDL_annotations? manDL_description (COMMA manDL_description)+
+      -> {eq!=null}? ^(VT_EQV_CLASS manDL_annotations? manDL_description+)
+      -> ^(VT_DIF_CLASS manDL_annotations? manDL_description+)
+      
+  | (eq=EQUIVALENT_PROPERTIES | df=DISJOINT_PROPERTIES) COLON
+      manDL_annotations? manDL_property_expression (COMMA manDL_property_expression)+
+      -> {eq!=null}? ^(VT_EQV_PROP manDL_annotations? manDL_property_expression+)
+      -> ^(VT_DIF_PROP manDL_annotations? manDL_property_expression+)
+      
+  | (eq=SAME_INDIVIDUAL | df=DIFFERENT_INDIVIDUALS) COLON
+      manDL_annotations? manDL_individual (COMMA manDL_individual)+
+      -> {eq!=null}? ^(VT_EQV_INDV manDL_annotations? manDL_individual+)
+      -> ^(VT_DIF_INDV manDL_annotations? manDL_individual+)
+  ;
+   
+manDL_annotations
+  : AT ANNOTATIONS LEFT_PAREN manDL_annotation_list RIGHT_PAREN
+  -> ^(VT_ANNOTATIONS manDL_annotation_list)
+  | ANNOTATIONS COLON manDL_annotation_list
+  ->  ^(VT_ANNOTATIONS manDL_annotation_list)  
+  ;  
+
+manDL_disjointUnionOf
+  : DISJOINT_UNION COLON manDL_disjointUnionOf_list
+    -> ^(VT_DISJOINTUNIONOF manDL_disjointUnionOf_list)
+  ;
+
+manDL_disjointUnionOf_list
+  : manDL_annotated_description (COMMA! manDL_annotated_description)+ 
+  ;
+
+
+manDL_disjointWith
+  : DISJOINT COLON manDL_annotated_description_list
+  -> ^(VT_DISJOINTWITH manDL_annotated_description_list)
+  ;
+
+manDL_equivalentTo
+  : ( AS | EQUIVALENTTO COLON)  manDL_annotated_description_list
+  -> ^(VT_EQUIVALENTTO manDL_annotated_description_list)  
+  ;
+  
+manDL_subClassOf
+  : SUBCLASSOF COLON manDL_annotated_description_list
+  -> ^(VT_SUBCLASSOF manDL_annotated_description_list)
+  ;
+  
+manDL_subPropertyOf
+  : SUBPROPERTYOF COLON manDL_property_list
+  -> ^(VT_SUBPROPERTYOF manDL_property_list)
+  ;  
+  
+manDL_hasKey
+  : HASKEY^ COLON! manDL_annotations manDL_property_expression+
+  ;
+
+manDL_domain
+  : DOMAIN COLON manDL_annotated_description_list
+  -> ^(VT_DOMAIN manDL_annotated_description_list)
+  ;
+  
+manDL_range
+  : RANGE COLON manDL_annotated_description_list  
+  -> ^(VT_RANGE manDL_annotated_description_list)
+  ;
+  
+manDL_inverseOf
+  : INVERSEOF COLON manDL_property_list
+  -> ^(VT_INVERSEOF manDL_property_list)
+  ;  
+
+manDL_subPropChain
+  : SUBPROPERTYCHAIN COLON manDL_annotations? manDL_property_expression ( CHAIN_SEP manDL_property_expression )*
+  -> ^(VT_SUBPROPERTYCHAIN manDL_annotations? manDL_property_expression+)
+  ;
+  
+manDL_attributes
+  : CHARACTERISTICS COLON (manDL_annotations? manDL_attribute) (COMMA  manDL_annotations? manDL_attribute)*
+  -> ^(VT_ATTRIBUTES ^(manDL_attribute manDL_annotations?)+)   
+  ;
+
+manDL_types
+  : TYPES COLON manDL_annotated_description_list
+  -> ^(VT_TYPES manDL_annotated_description_list)
+  ;
+  
+manDL_facts
+  : FACTS COLON manDL_fact_annotated_list
+  -> ^(VT_FACTS manDL_fact_annotated_list)
+  ;
+  
+manDL_sameAs
+  : SAMEAS COLON manDL_individual_list
+  -> ^(VT_SAMEAS manDL_individual_list)
+  ;
+  
+manDL_differentFrom
+  : DIFFERENTFROM COLON manDL_individual_list
+  -> ^(VT_DIFFERENTFROM manDL_individual_list)
+  ; 
+
+manDL_individual_list
+  : manDL_annotated_individual (COMMA! manDL_annotated_individual)*
+  ;
+  
+manDL_annotated_individual
+  : ^(manDL_individual manDL_annotations?) 
+  ; 
+
+manDL_fact_annotated_list
+  : manDL_annotated_fact (COMMA! manDL_annotated_fact)*
+  ;
+
+manDL_annotated_fact
+  : ^(manDL_fact manDL_annotations?)   
+  ; 
+  
+manDL_fact
+  : neg=NOT? manDL_property_expression (manDL_individual | literal)
+  -> {neg==null}? ^(VT_FACT manDL_property_expression manDL_individual? literal?)
+  -> ^(VT_NEG ^(VT_FACT manDL_property_expression manDL_individual? literal?))
+  ;  
+
+manDL_attribute
+  : manDL_att_functional
+  | manDL_att_inverseFunctional
+  | manDL_att_reflexive
+  | manDL_att_irreflexive
+  | manDL_att_symmetric
+  | manDL_att_asymmetric
+  | manDL_att_transitive
+  ;
+  
+  
+
+manDL_att_functional
+  : MDA_FUNCTIONAL
+  ;
+  
+manDL_att_inverseFunctional
+  : MDA_FUNCTIONAL_INV
+  ;
+  
+manDL_att_reflexive
+  : MDA_REFLEXIVE
+  ;
+  
+manDL_att_irreflexive
+  : MDA_REFLEXIVE_INV
+  ;
+  
+manDL_att_symmetric
+  : MDA_SYMMETRIC
+  ;
+  
+manDL_att_asymmetric
+  : MDA_SYMMETRIC_INV
+  ;
+
+manDL_att_transitive
+  : MDA_TRANSITIVE
+  ;
+  
+  
+
+manDL_annotated_description_list
+  : manDL_annotated_description (COMMA! manDL_annotated_description)*
+  ;
+
+
+manDL_annotated_description
+  : manDL_annotations? manDL_description
+  -> ^(VT_DL_DEFINITION manDL_annotations? manDL_description)
+  ;
+  
+
+
+manDL_description 
+  : manDL_conjunction (or=OR manDL_conjunction)*
+  -> {or==null}? manDL_conjunction
+  -> ^(VT_OR manDL_conjunction+)
+  ;
+  
+manDL_conjunction
+  : manDL_primary (and=AND manDL_primary)*
+  -> {and==null}? manDL_primary
+  -> ^(VT_AND manDL_primary+)
+  | manDL_classIRI THAT manDL_restriction (AND manDL_restriction)*
+  -> ^(VT_AND ^(VT_DL_TYPE manDL_classIRI) manDL_restriction+)
+  ;  
+
+
+manDL_primary
+  : manDL_restriction | manDL_atomic  
+  ;
+  
+manDL_atomic
+  : not=NOT? manDL_atomic_core
+  -> {not!=null}? ^(VT_NEG manDL_atomic_core)
+  -> manDL_atomic_core
+  ;
+
+manDL_atomic_core
+  : manDL_classIRI
+  -> ^(VT_DL_TYPE manDL_classIRI)
+  | manDL_datatype
+  -> ^(VT_DL_TYPE manDL_datatype)
+  | LEFT_CURLY! literal_list RIGHT_CURLY!
+  | manDL_data_type_restriction
+  -> manDL_data_type_restriction
+  | LEFT_PAREN! manDL_description RIGHT_PAREN!
+  ;  
+
+manDL_restriction
+  : not=NOT? manDL_quantified_restriction_core
+  -> {not!=null}? ^(VT_NEG manDL_quantified_restriction_core)
+  -> manDL_quantified_restriction_core
+  ;
+ 
+
+manDL_quantified_restriction_core
+  : manDL_property_expression SOME manDL_primary
+  -> ^(VT_EXISTS manDL_property_expression manDL_primary)
+  | manDL_property_expression ONLY manDL_primary
+  -> ^(VT_FORALL manDL_property_expression manDL_primary) 
+  | manDL_property_expression manDL_primary
+  -> ^(VT_AND ^(VT_EXISTS manDL_property_expression manDL_primary) ^(VT_FORALL manDL_property_expression manDL_primary)) 
+  | manDL_property_expression VALUE (manDL_individual | literal)
+  -> ^(VT_VALUE manDL_property_expression manDL_individual? literal?)
+  | manDL_property_expression SELF
+  -> ^(SELF manDL_property_expression)
+  | manDL_property_expression MIN INT manDL_primary?
+  -> ^(VT_COUNT manDL_property_expression ^(VT_MIN INT) manDL_primary?)
+  | manDL_property_expression MAX INT (manDL_primary)?
+  -> ^(VT_COUNT manDL_property_expression ^(VT_MAX INT) manDL_primary?)
+  | manDL_property_expression EXACTLY INT (manDL_primary)?
+  -> ^(VT_AND 
+        ^(VT_COUNT manDL_property_expression ^(VT_MIN INT) manDL_primary?)
+        ^(VT_COUNT manDL_property_expression ^(VT_MAX INT) manDL_primary?)
+      )  
+  ;
+
+  
+manDL_property_expression  
+  : inv=INVERSE? manDL_propertyIRI
+  -> ^(VT_DL_PROP manDL_propertyIRI $inv?)     
+  ;
+  
+
+manDL_data_type_restriction
+  : manDL_datatype LEFT_SQUARE manDL_facets RIGHT_SQUARE
+  -> ^(VT_DL_RESTRICTED_TYPE manDL_datatype manDL_facets)
+  ;
+  
+manDL_facets
+  : manDL_facet manDL_restriction_value more=(COMMA manDL_facet manDL_restriction_value)*
+  -> {more==null}? ^(VT_DL_RESTRICTION manDL_facet manDL_restriction_value)
+  -> ^(VT_AND ^(VT_DL_RESTRICTION manDL_facet manDL_restriction_value)+)
+  ;  
+
+manDL_restriction_value
+  : literal
+  ; 
+
+manDL_facet
+  : LENGTH
+  | LENGTH_MIN
+  | LENGTH_MAX
+  | PATTERN
+  | PATTERN_LANG
+  | GREATER_EQUAL
+  | GREATER
+  | LESS_EQUAL
+  | LESS
+  ;  
+  
+  
+  
+manDL_annotation_list
+  : manDL_annotation (COMMA! manDL_annotation)* 
+  ;  
+
+manDL_annotation
+  : manDL_annotations? manDL_annotationPropertyIRI manDL_annotation_target
+  -> ^(VT_ANNOTATION manDL_annotations? manDL_annotationPropertyIRI manDL_annotation_target )
+  ;
+  
+manDL_annotation_target  
+  : manDL_individual | literal 
+  ;  
+  
+  
+  
+  
+manDL_property_list
+  : manDL_annotatedProperty (COMMA! manDL_annotatedProperty)?
+  ; 
+  
+manDL_annotatedProperty
+  : manDL_annotations? manDL_property_expression
+  ;
+  
+    
+  
+  
+manDL_classIRI 
+  : iri
+  ;
+
+manDL_datatype
+  : manDL_datatypeIRI   
+  ;
+  
+manDL_datatypeIRI 
+  : primitive_type
+  ;
+  
+manDL_objectPropertyIRI 
+  : iri
+  ;
+  
+manDL_dataPropertyIRI 
+  : iri
+  ;
+  
+manDL_annotationPropertyIRI 
+  : iri
+  ;
+  
+manDL_propertyIRI
+  : iri
+  ;  
+  
+manDL_individual 
+  : manDL_individualIRI 
+  | nodeID
+  ;
+  
+manDL_individualIRI 
+  : iri  
+  ;
+
+ 
+iri 
+  : full_iri
+  -> ^(VT_IRI full_iri? )  
+  | ID (PREFIXED_ID)?  
+  -> ^(VT_IRI ID PREFIXED_ID? ) 
+  ;
+
+  
+nodeID
+  : DOUBLE_HYPEN ID
+  ;  
+  
+full_iri
+  : LESS ID GREATER
+  ;
+  
+ 
+  
+
 /******************************************************* RULES *******************************************/
 
 
@@ -822,7 +1445,7 @@
 
 /* over_clause obsolete, replaced by filters (see far below in lhs_unary)*/
 lhs_atom_pattern
-  : ID LEFT_PAREN constraints? RIGHT_PAREN pattern_attributes?  from?  
+  : fully_qualified_name LEFT_PAREN constraints? RIGHT_PAREN pattern_attributes?  from?  
   -> ^(VT_PATTERN
           ^(VT_AND pattern_attributes? VT_ENABLED ^(VT_TYPE ID) constraints? )
           from?
@@ -965,8 +1588,10 @@
 
 
 fully_qualified_name
-  : ID ( DOT ID )*  
+  : ID ( DOT ID )* 
     -> ^(VT_NAME ID+)
+    | (ID DOT)* primitive_type
+    -> ^(VT_NAME ID* primitive_type)
   ;
 
 
@@ -1052,7 +1677,7 @@
   ;   
   
 new_object
-  : NEW ID LEFT_PAREN literal_object_args? RIGHT_PAREN
+  : NEW data_type LEFT_PAREN literal_object_args? RIGHT_PAREN
     -> ^(VT_NEW_OBJ ^(VT_TYPE ID) ^(VT_ARGS literal_object_args)?)
   ;  
   
@@ -1419,7 +2044,7 @@
 /************************************************** FILTERS ******************************/
 
 over_filter
-  : id1=WINDOW COLON 
+  : id1=WINDOW DOUBLE_COLON 
     (  id2=TIME paren_chunk
       -> ^(VT_BEHAVIOR $id1 $id2 paren_chunk)
     |  id2=LENGTH LEFT_PAREN INT RIGHT_PAREN
@@ -1648,23 +2273,27 @@
 /*************************************** QUANTIFIERS AND EVALUATORS ***********************************/
 
 inner_quantifier
-  : ALL^
-  | SOME^
-  | VALUE^
-  | COUNT^ (AT! LEFT_SQUARE! 
+  : ONLY -> VT_FORALL
+  | SOME -> VT_EXISTS
+  | VALUE -> VT_VALUE
+  | COUNT (AT LEFT_SQUARE
         (
-          INT
+          val=INT
           | inner_attrs
         )
-       RIGHT_SQUARE!)?
+       RIGHT_SQUARE)
+    -> {val!=null}? ^(VT_COUNT ^(VT_MIN $val) ^(VT_MAX $val))
+    -> ^(VT_COUNT inner_attrs )   
   ;
   
 attr_min
-  : (MIN^ EQUALS! INT)
+  : (MIN EQUALS INT)
+  -> ^(VT_MIN INT)
   ;
 
 attr_max
-  : (MAX^ EQUALS! INT)
+  : (MAX EQUALS INT)
+  -> ^(VT_MAX INT)
   ;
   
 inner_attrs

Modified: labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java
===================================================================
--- labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java	2010-08-24 20:00:44 UTC (rev 34874)
+++ labs/jbossrules/branches/DRLv6/src/test/java/org/drools/lang/Rule_Test.java	2010-08-24 23:03:04 UTC (rev 34875)
@@ -130,11 +130,13 @@
 		String rule = "compilation_unit";
 		String[] testDRL = new String[] {
 				"package org.pack.subpack;\n" +
-				"import org.klass;\n" +
-				"\n" +
-				"declare Klass\n" +
-				"end\n" +
-				"\n" +
+				"import org.klass;" + "\n" +
+				" " + "\n" +	
+				"global int N; \n" +				
+				" " + "\n" +
+				"Ontology : test" + "\n" +
+				" @Class declare Test end " + "\n" +
+				" " + "\n" +
 				"rule \"ruel\"\n" +
 				"when\n" +
 				"then\n" +
@@ -236,72 +238,13 @@
 		};
 		check(rule,testDRL);
 	}
-	
-	@Test	
-	public void test_type_declaration() {
-		String rule = "type_declaration";
-		String[] testDRL = new String[] {
-				"declare org.Student extends com.Person" + "\n" +
-				" @role(entity) " + "\n" +
-				" @namespace(myNS=\"http:\\\\www.stix.com\\domain\\subd#\") " + "\n" +				
-				" age  : int " + "\n" +
-				" name : String " + "\n" +
-				" end \n",
-				
-				"declare HasFriend extends Knows" + "\n" +
-				"@role(property) " + "\n" +
-				"@namespace(myNS=\"http:\\\\www.somens.com\\arg\\test#\") " + "\n" +					
-				"@disjoint(HasEnemy) " + "\n" +
-				"@symmetric " + "\n" +
-				"subject	: Person " + "\n" +
-				"object  : Person " + "\n" +
-				"end " + "\n", 
 			
-				"declare HasSpouse " + "\n" +
-				"@role(property) " + "\n" +
-				"@namespace(myNS=\"http:\\\\www.somens.com\\arg\\test#\") " + "\n" +		
-				"@symmetric " + "\n" +
-				"@transitive " + "\n" +
-				"@inverse(HasSpouse) " + "\n" +
-				"subject	= (\"john\") : Person 	@[key] " + "\n" +
-				"object  : Person	@[key] " + "\n" +
-				"end \n",
-				
-				"declare AnotherWayForAttributes" + "\n" +
-				" @[ symmetric, inverse(SomeOther), transitive ] " + "\n" +
-				" name : String " + "\n" +
-				" end \n",
-		};
-		check(rule,testDRL);										
-	}		
 	
-	
-	
 	@Test	
-	public void test_type_declare_attribute() {		
-		String rule = "type_declare_attributes";
-		String[] testDRL = new String[] {
-				"@role(event)",
-				"@role(type)",
-				"@role(entity)",
-				"@role(property)",
-				"@namespace( alias = \"http:\\\\www.org.dom\\arg# \")",				
-				"@disjoint(AnotherType)",
-				"@symmetric",
-				"@transitive",
-				"@inverse(ReverseProperty)"
-				
-		};	
-		check(rule,testDRL);									
-	}		
-	
-	
-	
-	@Test	
 	public void test_decl_field() {
 		String rule = "decl_field";
 		String[] testDRL = new String[] {
-				"field = (...) : datatype[][] @[key]"
+				"field : datatype[][] @[key]"
 		};
 		check(rule,testDRL);	
 	}
@@ -571,6 +514,10 @@
 				"rule \"r\" when " +
 				"Person() @[crisp]" +
 				"then end",
+				
+				"rule \"r\" when " +
+				"org.lang.String() @[crisp]" +
+				"then end",
 		};
 		check(rule,testDRL);											
 	}
@@ -661,10 +608,10 @@
 	
 	@Test	
 	public void test_decl_dl() {
-		String rule = "type_declaration";
+		String rule = "manDL_type_declaration";
 		String[] testDRL = new String[] {
 				"declare Student " + "\n" +
-				" as Male() and Human() and (Slave() or worksAt some (School() or Prison()))" + "\n" +				
+				" as Male and Human and (Slave or worksAt some (School or Prison))" + "\n" +				
 				" age  : int " + "\n" +
 				" name : String " + "\n" +
 				" end \n"
@@ -1203,14 +1150,14 @@
 		String rule = "rule";
 		String[] testDRL = new String[] {
 				" rule test when " + "\n" +
-				" Person( age > 18) | window:length( 10 ) | window:time(2h)" + "\n" +
+				" Person( age > 18) | window::length( 10 ) | window::time(2h)" + "\n" +
 				" then end ",
 				
 				" rule test when " + "\n" +
 				" 	( " + "\n" +
 				"		Person( age > 18)" + "\n" +
 				"		Person( ) " + "\n" +
-				"	) | window:length( 10 ) | window:time(2h)" + "\n" +
+				"	) | window::length( 10 ) | window::time(2h)" + "\n" +
 				" then end ",							
 				
 				" rule test when " + "\n" +
@@ -1298,7 +1245,7 @@
 	public void test_dle_nested_objects_cast() {
 		String rule = "lhs_atom_pattern";
 		String[] testDRL = {
-				"Person( name==  \"mark\", address.#org.domain.LongAddress( city == \"london\", country ==  \"uk\").subfield )"
+				"Person( name==  \"mark\", address.#org.dom.LongAddress( city == \"london\", country ==  \"uk\").subfield )"
 		};
 				
 		check(rule,testDRL);										
@@ -1590,19 +1537,283 @@
 	}
 	
 	
+	
+	
+		
+	
+	@Test	
+	public void test_manDL_declaration_root() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"@Class " + "\n" +
+				"declare foo " + "\n" +
+				"end",
+				
+				"Class : foo ",
+				
+				"@Event declare SomeEvent end",
+		};
+				
+		check(rule,testDRL);										
+	}
+	
+	
+	
+	@Test	
+	public void test_manDL_annotations() {
+		String rule = "manDL_annotations";
+		String[] testDRL = {
+				"@annotations( creator sotty, author davide )",
+				
+				"Annotations : creator sotty",
+				
+				"Annotations : creator sotty, " +
+				"	Annotations: rdfsComment year creationYear 2008, " +
+				"mainClass Person," +
+				"	@annotations(meta target) annotationProp annotationTgt",
+		};
+				
+		check(rule,testDRL);										
+	}
+	
+	@Test	
+	public void test_manDL_class() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"@Class " + "\n" +
+				"declare org.com.Foo " + "\n" +
+				" Annotations: creatory sotty " + "\n" +
+				" DisjointUnionOf: @annotations(guess what) Child, Adult" + "\n" +
+				" SubClassOf: Person and Worker" + "\n" +
+				" EquivalentTo: @annotations(guess again) Person" + "\n" +
+				" DisjointWith: Person" + "\n" +
+				" HasKey: Annotations: annkey targt hasSSN" + "\n" + 
+				"end",
+				
+				
+				"@Class " + "\n" +
+				"declare org.com.Foo2 " + "\n" +				
+				" as Person or Worker and hasAge Integer[ < 33 ]" + "\n" +								
+				"end",
+				
+		};
+				
+		check(rule,testDRL);										
+	}
+	
+	
+	@Test	
+	public void test_manDL_datatype_declaration() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"Datatype: NegInt " + "\n" +				
+				" EquivalentTo: Annotations: creator sotty Integer[ < 0 ], NegativeInteger" + "\n",
+				
+				"@Datatype declare NegInt " + "\n" +				
+				" as Integer[ < 0 ]" + "\n",
+				
+		};
+				
+		check(rule,testDRL);										
+	}
 
 	
 	
+	@Test	
+	public void test_manDL_annotated_description() {
+		String rule = "manDL_annotated_description";
+		String[] testDRL = {
+				"@annotations(tell me) Human or Animal or Robot and not Alien",
+				
+				"Person and (" +
+				"	hasChildren exactly 3 Male or hasChildren min 2 Female ) ",
+				
+				"hasChildren Male",
+				
+				"Person and hasChildren some Male ",
+				
+				"Person and hasChildren only Male ",
+				
+				//TODO individual "Person and hasChildren value john ",
+				
+				"Person and hasChildren min 3 ",
+				
+				"Person and hasChildren max 5 ",
+				
+				"Person and hasChildren exactly 10 (Male or Female and hasFriend only Cat)",
+				
+				"Thing that hasFirstName exactly 1 and hasFirstName only String[minLength 1]",
+				
+				"hasAge exactly 1 and hasAge only not NegInt",
+				
+				"hasGender exactly 1 and hasGender only {\"female\", \"male\"}",
+				
+				"hasFirstName value \"John\" or hasFirstName value \"Joe\" ",
+				
+				
+		};
+				
+		check(rule,testDRL);										
+	}
 	
 	
+	@Test	
+	public void test_manDL_objectprop() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"ObjectProperty: hasWife" + "\n" +				
+				" Annotations: creator sotty " + "\n" +
+				" Characteristics: Functional, InverseFunctional, Reflexive, Irreflexive, Asymmetric, Transitive " + "\n" +
+				" Domain: Annotations: rdfsComment \"General dom\", creator sotty Person," + "\n" +
+				"         Annotations: rdfsCcomment \"More specific dom\" Man" + "\n" +
+				" Range: Person, Woman " + "\n" +
+				" SubPropertyOf: hasSpouse, loves" + "\n" +
+				" EquivalentTo: isMarriedTo " + "\n" +
+				" DisjointWith: hates " + "\n" +
+				" InverseOf: hasSpouse, inverse hasSpouse" + "\n" +
+				" SubPropertyChain: hasChild o hasParent " + "\n",		
+				
+				
+				"@ObjectProperty declare hasWife" + "\n" +				
+				" @Functional" +
+				" @InverseFunctional" +
+				" @Reflexive " +
+				" @Irreflexive " +
+				" @Asymmetric " +
+				" @Transitive " + "\n" +
+				" domain : Person" + "\n" +         
+				" range : Woman " + "\n" +
+				"end ",
+			
+		};
+				
+		check(rule,testDRL);										
+	}
 	
 	
 	
+	@Test
+	public void test_manDL_dataprop() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"DataProperty: hasAge" + "\n" +				
+				" Annotations: creator sotty " + "\n" +
+				" Characteristics: Functional " + "\n" +
+				" Domain: Person " + "\n" +
+				" Range: integer " + "\n" +
+				" SubPropertyOf: hasVerifiedAge" + "\n" +
+				" EquivalentTo: hasAgeInYears " + "\n" +
+				" DisjointWith: hasSSN " + "\n",
+
+
+
+				"@DataProperty declare hasAge" + "\n" +				
+				" @Functional" +				
+				" domain : Person" + "\n" +         
+				" range : Integer " + "\n" +
+				"end ",
+
+		};
+		check(rule,testDRL);										
+	}
+
+	@Test
+	public void test_manDL_annotation_prop() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"AnnotationProperty: creator" + "\n" +				
+				" Annotations: price 100 " + "\n" +					
+				" Domain: Person " + "\n" +
+				" Range: String " + "\n" +
+				" SubPropertyOf: initialCreator" + "\n",
+
+				"@AnnotationProperty declare creator" + "\n" +				
+				" domain : Person" + "\n" +         
+				" range : Integer " + "\n" +
+				"end ",
+
+		};	
+		check(rule,testDRL);										
+	}
 	
+	@Test
+	public void test_manDL_individuals() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"Individual: John" + "\n" +				
+				" Annotations: creator sotty " + "\n" +					
+				" Types: Person, hasFirstName value \"John\" or hasFirstName value \"Joe\" " + "\n" +
+				" Facts: hasWife Mary, not hasChild Susan, hasAge 33 " + "\n" +
+				" SameAs: Joe" + "\n" +
+				" DifferentFrom: Susan" + "\n",
+			
+		};	
+		check(rule,testDRL);										
+	}
 	
 	
+	@Test
+	public void test_manDL_misc() {
+		String rule = "manDL_type_declaration";
+		String[] testDRL = {
+				"EquivalentClasses: Annotations: creator sotty q:Rock, q:Scissors, q:Paper ",
+				"DisjointClasses: Annotations: creator sotty Rock, Scissors, Paper ",
+				"EquivalentProperties: Annotations: creator sotty h:loves, h:hates ",
+				"DisjointProperties: Annotations: creator sotty loves, hates ",
+				"SameIndividual: Annotations: creator sotty John, Joe, Jack ",
+				"DifferentIndividuals: Annotations: creator sotty John, Joe, Jack ",
+			
+		};	
+		check(rule,testDRL);										
+	}
 	
 	
+	@Test
+	public void test_manDL_ontology() {
+		String rule = "manDL_ontology";
+		String[] testDRL = {
+				" Prefix: g: <someIRI> " +"\n" +								
+				" Ontology : myOnto v1 " +"\n" +
+				" Import: anotherOnto " + "\n" +
+				" Annotations: creator sotty" + "\n" +
+				"  " +"\n" +
+				" declare g:Test end " +"\n",
+											
+		};	
+		check(rule,testDRL);										
+	}
+	
+	
+	/*
+	public void test_() {
+		String rule = "";
+		String[] testDRL = {
+				"  " +"\n" +
+				"  " +"\n" +
+				"  " +"\n" +
+				"  " +"\n",
+											
+		};	
+		check(rule,testDRL);										
+	}
+	*/
+	
+    
+    
+    
+               
+            
+    
+    
+    
+    
+    
+    
+
+	
+	
+	
+	
 	private void check(String key) {
 		try {
 			Method method = Rule_Test.class.getMethod(key);



More information about the jboss-svn-commits mailing list