diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index 9ef6ae2b121e7019bb66dcfbc9205db67fe06e82..c39a7505def07f071a9e7a7caf9430309430b646 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -12,10 +12,11 @@ aspect AbsGrammarGeneration { public void Start.genAbsGrammar(PrintStream pStream) { pStream.println("// Predefined types"); - pStream.println("Start ::= Element*;"); + pStream.println("Start ::= Element;"); pStream.println("abstract Thing ::=;"); pStream.println("abstract Element;"); - pStream.println("ComplexElement ::= <IDENTIFIER> Attribute* Element*;"); +// pStream.println("ComplexElement ::= Attribute* Element*;"); + pStream.println("ComplexElement ::= id1:OwlIdentifier id2:OwlIdentifier;"); pStream.println("abstract SimpleElement : Element;"); pStream.println("StringElement : SimpleElement ::= <IDENTIFIER>;"); pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;"); @@ -38,6 +39,7 @@ aspect AbsGrammarGeneration { pStream.println("RdfParseType : Attribute ::= ;"); pStream.println("Version : Attribute ::= ;"); pStream.println("Value ::= <STRING_LITERAL>;"); + pStream.println("OwlIdentifier ::= <IDENTIFIER>;"); pStream.println("AttrValue ::= <STRING_LITERAL>;"); pStream.println(); pStream.println("// Generated types"); diff --git a/Rewrites.jrag b/Rewrites.jrag index 74f4486f28d246efd88d8314be1d5b20770d8b58..9e91535f411b77ebdb629248376766230ca7a364 100644 --- a/Rewrites.jrag +++ b/Rewrites.jrag @@ -240,4 +240,12 @@ aspect RewriteClasses { new List().add(oc)); } } + + rewrite OwlClassDecl { + when (getId().contains("-")) + to OwlClassDecl { + setId(getId().replaceAll("-","_")); + return this; + } + } } diff --git a/siaras/Siaras.jjt b/siaras/Siaras.jjt index 793d474ada090f9d87e7f31fdc1f63c4da400b46..3ba07eccbfb4021871fe3b2677c9b5ba2e34313b 100644 --- a/siaras/Siaras.jjt +++ b/siaras/Siaras.jjt @@ -6,6 +6,9 @@ options { NODE_PREFIX = ""; JAVA_UNICODE_ESCAPE = true; STATIC = false; + DEBUG_PARSER = true; + DEBUG_LOOKAHEAD = true; + DEBUG_TOKEN_MANAGER = true; } // options @@ -102,6 +105,8 @@ SPECIAL_TOKEN : /* COMMENTS */ | < XMLNS_RDFS : "xmlns:rdfs" > | < XMLNS_OWL : "xmlns:owl" > +// | < VacuumGripper : "VacuumGripper" > + }// RESERVED WORDS AND LITERALS <DEFAULT, BOUNDS> TOKEN : /* LITERALS */ { @@ -171,7 +176,7 @@ SPECIAL_TOKEN : /* COMMENTS */ <DEFAULT, BOUNDS> TOKEN : /* IDENTIFIERS */ { - < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>|"-")* > + < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* > | < #LETTER: [ @@ -280,8 +285,9 @@ SPECIAL_TOKEN : /* COMMENTS */ Start Start() #Start : {} { - ("<?xml version=\"1.0\"?>")? - ElementList() +// ("<?xml version=\"1.0\"?>")? +// ComplexElement() + "<" Identifier() ">" "</" Identifier() ">" { return jjtThis; } } @@ -305,7 +311,7 @@ Start Start() #Start : {} void ElementList() #List : {} { - (Element())* + (Element())* } void AttributeList() #List : {} @@ -313,18 +319,23 @@ void AttributeList() #List : {} (Attribute())* } -void ComplexElement() #ComplexElement : {Token t;} +void ComplexElement() #ComplexElement : {} //{Token t;} { - "<" t=<IDENTIFIER> AttributeList() - (">" ElementList() "</" <IDENTIFIER> ">" | ElementList() "/>") - {jjtThis.setIDENTIFIER(t.image);} + "<" Identifier() ">" "</" Identifier() ">" +// (">" ElementList() "</" <IDENTIFIER> ">" | ElementList() "/>") +// {jjtThis.setIDENTIFIER(t.image);} } +void Identifier() #OwlIdentifier : {Token t;} +{ + t=<IDENTIFIER> + {jjtThis.setIDENTIFIER(t.image);} +} void Element() : {} { ComplexElement() - | SimpleElement() + | SimpleElement() } void SimpleElement() : {} @@ -576,10 +587,10 @@ void Version() #Version : {} void RdfAttribute() : {} { -// RdfAbout() -// | RdfDatatype() - RdfId() -// | RdfResource() + RdfAbout() + | RdfDatatype() + | RdfId() + | RdfResource() // | RdfParseType() } diff --git a/testontologies/ontologyV07_instances.owl b/testontologies/ontologyV07_instances.owl index b5532078e1413b15c5bd4f6dc1267327ad9c24a3..eeb2314c515d01af99afb231d23d8572eef8f565 100644 --- a/testontologies/ontologyV07_instances.owl +++ b/testontologies/ontologyV07_instances.owl @@ -1,89 +1,91 @@ -<VacuumGripper rdf:ID="Schmalz_FSGA_20_SI-55_M5-AG"> - <hasSkill> - <AdjustVacuumToGrip rdf:ID="AdjustVacuumToGrip_16"> - <isSkillOf> - <VacuumGripper rdf:ID="Schmalz_FSGPL_200_NBR-55_G1-2-IG"> - <hasProperty> - <DiameterOfGripper rdf:ID="DiameterOfGripper_200"> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" - >0.0</value> - <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - </DiameterOfGripper> - </hasProperty> - <hasSkill rdf:resource="#AdjustVacuumToGrip_16"/> - <hasProperty> - <Material rdf:ID="Material_Perbunan"> - <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >Perbunan NBR 55+-5</value> - </Material> - </hasProperty> - <hasProperty> - <MaximumForce rdf:ID="MaximumForce_850"> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" - >0.0</value> - <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - </MaximumForce> - </hasProperty> - <hasProperty> - <Worm rdf:ID="Worm_22"> - <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >Inside</value> - </Worm> - </hasProperty> - <hasProperty> - <WormDiameter rdf:ID="WormDiameter_G1-2"> - <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >G1/2</value> - </WormDiameter> - </hasProperty> - <hasSkill> - <AdjustVacuumToRelease rdf:ID="AdjustVacuumToRelease_1"> - <isSkillOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - <isSkillOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> - </AdjustVacuumToRelease> - </hasSkill> - </VacuumGripper> - </isSkillOf> - <isSkillOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - </AdjustVacuumToGrip> - </hasSkill> - <hasProperty> - <WormDiameter rdf:ID="WormDiameter_M5"> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >M5</value> - <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - </WormDiameter> - </hasProperty> - <hasProperty> - <DiameterOfGripper rdf:ID="DiameterOfGripper_20"> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" - >0.0</value> - <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - </DiameterOfGripper> - </hasProperty> - <hasProperty> - <Material rdf:ID="Material_Silikon"> - <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >Silikon SI 55+-5</value> - </Material> - </hasProperty> - <hasProperty> - <Worm rdf:ID="Worm_13"> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" - >Outside</value> - <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - </Worm> - </hasProperty> - <hasSkill rdf:resource="#AdjustVacuumToRelease_1"/> - <hasProperty> - <MaximumForce rdf:ID="MaximumForce_4.7"> - <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> - <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" - >0.0</value> - </MaximumForce> - </hasProperty> - </VacuumGripper> +<VacuumGripper> +</VacuumGripper> +<!-- <VacuumGripper rdf:ID="Schmalz_FSGA_20_SI-55_M5-AG"> --> +<!-- <hasSkill> --> +<!-- <AdjustVacuumToGrip rdf:ID="AdjustVacuumToGrip_16"> --> +<!-- <isSkillOf> --> +<!-- <VacuumGripper rdf:ID="Schmalz_FSGPL_200_NBR-55_G1-2-IG"> --> +<!-- <hasProperty> --> +<!-- <DiameterOfGripper rdf:ID="DiameterOfGripper_200"> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" --> +<!-- >0.0</value> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- </DiameterOfGripper> --> +<!-- </hasProperty> --> +<!-- <hasSkill rdf:resource="#AdjustVacuumToGrip_16"/> --> +<!-- <hasProperty> --> +<!-- <Material rdf:ID="Material_Perbunan"> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >Perbunan NBR 55+-5</value> --> +<!-- </Material> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <MaximumForce rdf:ID="MaximumForce_850"> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" --> +<!-- >0.0</value> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- </MaximumForce> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <Worm rdf:ID="Worm_22"> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >Inside</value> --> +<!-- </Worm> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <WormDiameter rdf:ID="WormDiameter_G1-2"> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >G1/2</value> --> +<!-- </WormDiameter> --> +<!-- </hasProperty> --> +<!-- <hasSkill> --> +<!-- <AdjustVacuumToRelease rdf:ID="AdjustVacuumToRelease_1"> --> +<!-- <isSkillOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- <isSkillOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/> --> +<!-- </AdjustVacuumToRelease> --> +<!-- </hasSkill> --> +<!-- </VacuumGripper> --> +<!-- </isSkillOf> --> +<!-- <isSkillOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- </AdjustVacuumToGrip> --> +<!-- </hasSkill> --> +<!-- <hasProperty> --> +<!-- <WormDiameter rdf:ID="WormDiameter_M5"> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >M5</value> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- </WormDiameter> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <DiameterOfGripper rdf:ID="DiameterOfGripper_20"> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" --> +<!-- >0.0</value> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- </DiameterOfGripper> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <Material rdf:ID="Material_Silikon"> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >Silikon SI 55+-5</value> --> +<!-- </Material> --> +<!-- </hasProperty> --> +<!-- <hasProperty> --> +<!-- <Worm rdf:ID="Worm_13"> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string" --> +<!-- >Outside</value> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- </Worm> --> +<!-- </hasProperty> --> +<!-- <hasSkill rdf:resource="#AdjustVacuumToRelease_1"/> --> +<!-- <hasProperty> --> +<!-- <MaximumForce rdf:ID="MaximumForce_4.7"> --> +<!-- <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/> --> +<!-- <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float" --> +<!-- >0.0</value> --> +<!-- </MaximumForce> --> +<!-- </hasProperty> --> +<!-- </VacuumGripper> --> diff --git a/testontologies/phony_instances.owl b/testontologies/phony_instances.owl new file mode 100644 index 0000000000000000000000000000000000000000..5fd046f0956cedee1ff9f44c1e99cd851843b0a1 --- /dev/null +++ b/testontologies/phony_instances.owl @@ -0,0 +1,2 @@ +<VacuumGripper> +</VacuumGripper>