Commit 999d9323 authored by Anders Nilsson's avatar Anders Nilsson

Can now parse and build AST for GripperOntology.owl.

parent b21c0cab
This diff is collapsed.
// -*-Java-*-
Start ::= Specification;
Specification ::= Attribute*;
Specification ::= XmlHeader RdfDeclaration;
Attribute ::= Id Value;
XmlHeader ::= Attribute*;
abstract Element ::= Attribute* Element*;
RdfDeclaration : Element;
RdfsSubClassOf : Element;
RdfsDomain : Element;
OwlOntology : Element;
OwlAllValuesFrom : Element;
OwlClass : Element;
OwlDisjointWith : Element;
OwlEquivalentClass : Element;
OwlObjectProperty : Element;
OwlOnProperty : Element;
OwlSomeValuesFrom : Element;
OwlRestriction : Element;
abstract Attribute ::= Value;
Version : Attribute;
RdfAbout : Attribute;
RdfId : Attribute;
RdfResource : Attribute;
XmlBase : Attribute;
Xmlns : Attribute;
XmlnsRdf : Attribute;
XmlnsXsd : Attribute;
XmlnsRdfs : Attribute;
XmlnsOwl : Attribute;
Id ::= <IDENTIFIER>;
Value ::= <STRING_LITERAL>;
\ No newline at end of file
......@@ -42,14 +42,15 @@ PARSER_END(OwlParser)
SPECIAL_TOKEN : /* COMMENTS */
{
// <SLASH_STAR_COMMENT : "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/" >
<XML_COMMENT : "<!--" (~["-","-",">"])* "-->" >
< "<!--" ( ~["-"] | ( "-" ~["-"] ) )* "-->">
// <XML_COMMENT : "<!--" (~["-","-",">"])* "-->" >
}// COMMENTS
<BOUNDS> TOKEN: {
< BEGINCOMMENT : "<!--" >
| < ENDCOMMENT : "-->" >
}
// <BOUNDS> TOKEN: {
// < BEGINCOMMENT : "<!--" >
// | < ENDCOMMENT : "-->" >
// }
<DEFAULT, BOUNDS> TOKEN : /* RESERVED WORDS AND LITERALS */
{
......@@ -64,14 +65,18 @@ SPECIAL_TOKEN : /* COMMENTS */
| < RDF_ABOUT : "rdf:about" >
| < RDF_ID : "rdf:ID" >
| < RDF_RESOURCE : "rdf:resource" >
| < RDFS_DOMAIN : "rdfs:domain" >
| < RDFS_SUBCLASSOF : "rdfs:subClassOf" >
| < OWL_ONTOLOGY : "owl:Ontology" >
| < OWL_ALLVALUESFROM : "owl:allValuesFrom" >
| < OWL_CLASS : "owl:Class" >
| < OWL_DISJOINTWITH : "owl:DisjointWith" >
| < OWL_ONTOLOGY : "owl:Ontology" >
| < OWL_DISJOINTWITH : "owl:disjointWith" >
| < OWL_EQUIVALENTCLASS: "owl:equivalentClass" >
| < OWL_RESTRICTION : "owl:Restriction" >
| < OWL_ONPROPERTY : "owl:onProperty" >
| < OWL_OBJECTPROPERTY : "owl:ObjectProperty" >
| < OWL_SOMEVALUESFROM : "owl:someValuesFrom" >
| < VERSION : "version" >
}// RESERVED WORDS AND LITERALS
......@@ -247,7 +252,116 @@ Start Start() #Start : {}
void Specification() #Specification : {}
{
"<?" <XML> AttributeList() "?>"
XmlHeader()
RdfDeclaration()
}
void XmlHeader() #XmlHeader : {}
{
"<?" <XML> AttributeList() "?>"
}
void RdfDeclaration() #RdfDeclaration : {}
{
"<" <RDF_RDF> AttributeList() ">"
ElementList()
"</" <RDF_RDF> ">"
}
void ElementList() #List : {}
{
(Element())*
}
void Element() : {}
{
"<" ( OwlElement()
| RdfElement()
)
}
void OwlElement() : {}
{
OwlOntology()
| OwlAllValuesFrom()
| OwlClass()
| OwlDisjointWith()
| OwlEquivalentClass()
| OwlObjectProperty()
| OwlOnProperty()
| OwlSomeValuesFrom()
| OwlRestriction()
}
void OwlOntology() #OwlOntology : {}
{
<OWL_ONTOLOGY> AttributeList() ElementList() "/>"
}
void OwlAllValuesFrom() #OwlAllValuesFrom : {}
{
<OWL_ALLVALUESFROM> AttributeList()
(">" ElementList() "</" <OWL_ALLVALUESFROM> ">" | ElementList() "/>")
}
void OwlClass() #OwlClass : {}
{
<OWL_CLASS> AttributeList()
(">" ElementList() "</" <OWL_CLASS> ">" | ElementList() "/>")
}
void OwlDisjointWith() #OwlDisjointWith : {}
{
<OWL_DISJOINTWITH> AttributeList()
(">" ElementList() "</" <OWL_DISJOINTWITH> ">" | ElementList() "/>")
}
void OwlEquivalentClass() #OwlEquivalentClass : {}
{
<OWL_EQUIVALENTCLASS> AttributeList()
(">" ElementList() "</" <OWL_EQUIVALENTCLASS> ">" | ElementList() "/>")
}
void OwlObjectProperty () #OwlObjectProperty : {}
{
<OWL_OBJECTPROPERTY> AttributeList()
(">" ElementList() "</" <OWL_OBJECTPROPERTY> ">" | ElementList() "/>")
}
void OwlOnProperty () #OwlOnProperty : {}
{
<OWL_ONPROPERTY> AttributeList()
(">" ElementList() "</" <OWL_ONPROPERTY> ">" | ElementList() "/>")
}
void OwlSomeValuesFrom () #OwlSomeValuesFrom : {}
{
<OWL_SOMEVALUESFROM> AttributeList()
(">" ElementList() "</" <OWL_SOMEVALUESFROM> ">" | ElementList() "/>")
}
void OwlRestriction () #OwlRestriction : {}
{
<OWL_RESTRICTION> AttributeList()
(">" ElementList() "</" <OWL_RESTRICTION> ">" | ElementList() "/>")
}
void RdfElement() : {}
{
RdfsSubClassOf()
| RdfsDomain()
}
void RdfsSubClassOf() #RdfsSubClassOf : {}
{
<RDFS_SUBCLASSOF> AttributeList()
(">" ElementList() "</" <RDFS_SUBCLASSOF> ">" | ElementList() "/>")
}
void RdfsDomain() #RdfsDomain : {}
{
<RDFS_DOMAIN> AttributeList()
(">" ElementList() "</" <RDFS_DOMAIN> ">" | ElementList() "/>")
}
void AttributeList() #List : {}
......@@ -255,15 +369,83 @@ void AttributeList() #List : {}
(Attribute())*
}
void Attribute() #Attribute : { Token t; }
void Attribute() : {}
{
Version()
| RdfAttribute()
| XmlAttribute()
| XmlnsAttribute()
}
void Version() #Version : {}
{
<VERSION> <ASSIGN> Value()
}
void RdfAttribute() : {}
{
RdfAbout()
| RdfId()
| RdfResource()
}
void RdfAbout() #RdfAbout : {}
{
<RDF_ABOUT> <ASSIGN> Value()
}
void RdfId() #RdfId : {}
{
<RDF_ID> <ASSIGN> Value()
}
void RdfResource() #RdfId : {}
{
<RDF_RESOURCE> <ASSIGN> Value()
}
void XmlAttribute() : {}
{
XmlBase()
}
void XmlBase() #XmlBase : {}
{
<XML_BASE> <ASSIGN> Value()
}
void XmlnsAttribute() : {}
{
Xmlns()
| XmlnsRdf()
| XmlnsXsd()
| XmlnsRdfs()
| XmlnsOwl()
}
void Xmlns() #Xmlns : {}
{
<XMLNS> <ASSIGN> Value()
}
void XmlnsRdf() #XmlnsRdf : {}
{
<XMLNS_RDF> <ASSIGN> Value()
}
void XmlnsXsd() #XmlnsXsd : {}
{
<XMLNS_XSD> <ASSIGN> Value()
}
void XmlnsRdfs() #XmlnsRdfs : {}
{
Id() <ASSIGN> Value()
<XMLNS_RDFS> <ASSIGN> Value()
}
void Id() #Id : { Token t; }
void XmlnsOwl() #XmlnsOwl : {}
{
t = <IDENTIFIER>
{jjtThis.setIDENTIFIER(t.image);}
<XMLNS_OWL> <ASSIGN> Value()
}
void Value() #Value : { Token t; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment