Commit 69aaf486 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Can now parse all-in-one OWL-S ontology. Not tested if generated compiler can do anything useful.

parent e124d4da
......@@ -20,3 +20,4 @@ siaras/ontology.pprj
RoSta/GeneratedAspects.jrag
RoSta/Parser.java
RoSta/RoSta.ast
owl-s
......@@ -27,7 +27,7 @@
<!-- compile sources -->
<target name="build" depends="gen">
<javac compiler="jikes" debug="true" nowarn="true" srcdir="." includes="AST/*.java *.java" excludes="tools/** " classpath=".:${tools}/beaver-rt.jar:${tools}/junit.jar"/>
<javac debug="true" nowarn="true" srcdir="." includes="AST/*.java *.java" excludes="tools/** " classpath=".:${tools}/beaver-rt.jar:${tools}/junit.jar"/>
</target>
<!-- generate compiler source files -->
......
......@@ -18,6 +18,10 @@ ListFirst : ComplexElement;
ListRest : ComplexElement;
ExprKIFCondition : ComplexElement;
ExprExpressionData : ComplexElement;
ExpressionCondition : ComplexElement;
ExpressionLogicLanguage : ComplexElement;
ExpressionRefURI : ComplexElement;
ObjectListList : ComplexElement;
RdfDeclaration : ComplexElement;
RdfDescription : ComplexElement;
RdfFirst : ComplexElement;
......@@ -26,7 +30,9 @@ RdfRest : ComplexElement;
RdfType : ComplexElement;
RdfsComment : ComplexElement;
RdfsDomain : ComplexElement;
RdfsLabel : ComplexElement;
RdfsRange : ComplexElement;
RdfsSeeAlso : ComplexElement;
RdfsSubClassOf : ComplexElement;
RdfsSubPropertyOf : ComplexElement;
OwlOntology : ComplexElement;
......@@ -39,7 +45,9 @@ OwlDatatypeProperty : OwlProperty;
OwlDisjointWith : ComplexElement;
OwlDistinctMembers: ComplexElement;
OwlEquivalentClass : ComplexElement;
OwlEquivalentProperty : ComplexElement;
OwlFunctionalProperty : OwlProperty;
OwlHasValue : ComplexElement;
OwlImports : ComplexElement;
OwlIntersectionOf : ComplexElement;
OwlInverseOf : ComplexElement;
......@@ -52,6 +60,7 @@ OwlRestriction : ComplexElement;
OwlSomeValuesFrom : OwlValuesFrom;
OwlTransitiveProperty : ComplexElement;
OwlUnionOf : ComplexElement;
OwlVersionInfo : ComplexElement;
P1AnyOrder : ComplexElement;
P1Components : ComplexElement;
P1ComposedOf : ComplexElement;
......@@ -72,6 +81,8 @@ P1Sequence : ComplexElement;
P1Then : ComplexElement;
P1UntilProcess : ComplexElement;
P1UntilCondition : ComplexElement;
ProcessParticipant : ComplexElement;
ProcessPerform : ComplexElement;
abstract SimpleElement : Element;
StringElement : SimpleElement ::= <LITERAL>;
......@@ -87,19 +98,21 @@ RdfParseType : Attribute;
RdfResource : Attribute;
XmlBase : Attribute;
Xmlns : Attribute;
XmlnsDaml : Attribute;
XmlnsDc : Attribute;
XmlnsExpr : Attribute;
XmlnsList : Attribute;
XmlnsOwl : Attribute;
XmlnsP1 : Attribute;
XmlnsProtege : Attribute;
XmlnsRdf : Attribute;
XmlnsRdfs : Attribute;
XmlnsSwrl : Attribute;
XmlnsSwrlb : Attribute;
XmlnsXsd : Attribute;
XmlnsXsp : Attribute;
XmlnsXX : Attribute ::= <IDENTIFIER>;
// XmlnsDaml : Attribute;
// XmlnsDc : Attribute;
// XmlnsExpr : Attribute;
// XmlnsList : Attribute;
// XmlnsOwl : Attribute;
// XmlnsOwls : Attribute;
// XmlnsP1 : Attribute;
// XmlnsProtege : Attribute;
// XmlnsRdf : Attribute;
// XmlnsRdfs : Attribute;
// XmlnsSwrl : Attribute;
// XmlnsSwrlb : Attribute;
// XmlnsXsd : Attribute;
// XmlnsXsp : Attribute;
DiscardedElement : Element ::= Identifier Attribute* Element*;
......
......@@ -55,6 +55,7 @@ SPECIAL_TOKEN : /* COMMENTS */
// <SLASH_STAR_COMMENT : "/*" (~["*"])* "*" ("*" | (~["*","/"] (~["*"])* "*"))* "/" >
< "<!--" ( ~["-"] | ( "-" ~["-"] ) )* "-->">
| < "<rdfs:comment" ( ~["<"] | ( "<" ~["/"] ) )* "</rdfs:comment>" >
| < "<!DOCTYPE rdf:RDF [" ( ~["]"] )* "]>" >
// <XML_COMMENT : "<!--" (~["-","-",">"])* "-->" >
}// COMMENTS
......@@ -70,6 +71,10 @@ SPECIAL_TOKEN : /* COMMENTS */
| < LIST_REST : "list:rest" >
| < EXPR_KIFCONDITION : "expr:KIF-Condition" >
| < EXPR_EXPRESSIONDATA : "expr:expressionData" >
| < EXPRESSION_CONDITION : "Expression:Condition" >
| < EXPRESSION_LOGICLANGUAGE : "Expression:LogicLanguage" >
| < EXPRESSION_REFURI : "Expression:refURI" >
| < OBJECTLIST_LIST : "ObjectList:List" >
| < OWL_ALLVALUESFROM : "owl:allValuesFrom" >
| < OWL_ALLDIFFERENT : "owl:AllDifferent" >
| < OWL_CARDINALITY : "owl:cardinality" >
......@@ -79,7 +84,9 @@ SPECIAL_TOKEN : /* COMMENTS */
| < OWL_DISJOINTWITH : "owl:disjointWith" >
| < OWL_DISTINCTMEMBERS : "owl:distinctMembers" >
| < OWL_EQUIVALENTCLASS : "owl:equivalentClass" >
| < OWL_EQUIVALENTPROPERTY : "owl:equivalentProperty" >
| < OWL_FUNCTIONALPROPERTY : "owl:FunctionalProperty" >
| < OWL_HASVALUE : "owl:hasValue" >
| < OWL_IMPORTS : "owl:imports" >
| < OWL_INTERSECTIONOF : "owl:intersectionOf" >
| < OWL_INVERSEOF : "owl:inverseOf" >
......@@ -93,6 +100,7 @@ SPECIAL_TOKEN : /* COMMENTS */
| < OWL_SOMEVALUESFROM : "owl:someValuesFrom" >
| < OWL_TRANSITIVEPROPERTY : "owl:TransitiveProperty" >
| < OWL_UNIONOF : "owl:unionOf" >
| < OWL_VERSIONINFO : "owl:versionInfo" >
| < P1_ANYORDER : "p1:Any-Order" >
| < P1_COMPONENTS : "p1:components" >
| < P1_COMPOSEDOF : "p1:composedOf" >
......@@ -113,6 +121,8 @@ SPECIAL_TOKEN : /* COMMENTS */
| < P1_THEN : "p1:then" >
| < P1_UNTILCONDITION : "p1:untilCondition" >
| < P1_UNTILPROCESS : "p1:untilProcess" >
| < PROCESS_PARTICIPANT : "Process:Participant" >
| < PROCESS_PERFORM : "Process:Perform" >
| < RDF_RDF : "rdf:RDF" >
| < RDF_ABOUT : "rdf:about" >
| < RDF_DATATYPE : "rdf:datatype" >
......@@ -126,26 +136,30 @@ SPECIAL_TOKEN : /* COMMENTS */
| < RDF_TYPE : "rdf:type" >
| < RDFS_COMMENT : "rdfs:comment" >
| < RDFS_DOMAIN : "rdfs:domain" >
| < RDFS_LABEL : "rdfs:label" >
| < RDFS_RANGE : "rdfs:range" >
| < RDFS_SEEALSO : "rdfs:seeAlso" >
| < RDFS_SUBCLASSOF : "rdfs:subClassOf" >
| < RDFS_SUBPROPERTYOF : "rdfs:subPropertyOf" >
| < RDFS_SUBPROPERTYOF : "rdfs:subPropertyOf" >
| < VERSION : "version" >
| < XML : "xml" >
| < XML_BASE : "xml:base" >
| < XMLNS : "xmlns" >
| < XMLNS_DAML : "xmlns:daml" >
| < XMLNS_DC : "xmlns:dc" >
| < XMLNS_EXPR : "xmlns:expr" >
| < XMLNS_LIST : "xmlns:list" >
| < XMLNS_P1 : "xmlns:p1" >
| < XMLNS_OWL : "xmlns:owl" >
| < XMLNS_PROTEGE : "xmlns:protege" >
| < XMLNS_RDF : "xmlns:rdf" >
| < XMLNS_RDFS : "xmlns:rdfs" >
| < XMLNS_SWRL : "xmlns:swrl" >
| < XMLNS_SWRLB : "xmlns:swrlb" >
| < XMLNS_XSD : "xmlns:xsd" >
| < XMLNS_XSP : "xmlns:xsp" >
| < XMLNS_XX : "xmlns:" >
// | < XMLNS_DAML : "xmlns:daml" >
// | < XMLNS_DC : "xmlns:dc" >
// | < XMLNS_EXPR : "xmlns:expr" >
// | < XMLNS_LIST : "xmlns:list" >
// | < XMLNS_P1 : "xmlns:p1" >
// | < XMLNS_OWL : "xmlns:owl" >
// | < XMLNS_OWLS : "xmlns:owl-s" >
// | < XMLNS_PROTEGE : "xmlns:protege" >
// | < XMLNS_RDF : "xmlns:rdf" >
// | < XMLNS_RDFS : "xmlns:rdfs" >
// | < XMLNS_SWRL : "xmlns:swrl" >
// | < XMLNS_SWRLB : "xmlns:swrlb" >
// | < XMLNS_XSD : "xmlns:xsd" >
// | < XMLNS_XSP : "xmlns:xsp" >
}// RESERVED WORDS AND LITERALS
<DEFAULT, BOUNDS> TOKEN : /* LITERALS */
......@@ -359,10 +373,11 @@ void ElementList() #List : {}
void Element() : {}
{
( "<" ( JElement()
| OwlElement()
| OwlElement()
| RdfElement()
| P1Element()
| DiscardedElement()
| ProcessElement()
| DiscardedElement()
))
| SimpleElement()
}
......@@ -444,6 +459,10 @@ void JElement(): {}
| ListRest()
| ExprKIFCondition()
| ExprExpressionData()
| ExpressionCondition()
| ExpressionLogicLanguage()
| ExpressionRefURI()
| ObjectListList()
}
void ListFirst() #ListFirst : {}
......@@ -472,6 +491,30 @@ void ExprExpressionData() #ExprExpressionData : {}
(">" ElementList() "</" <EXPR_EXPRESSIONDATA> ">" | ElementList() "/>")
}
void ExpressionCondition() #ExpressionCondition : {}
{
<EXPRESSION_CONDITION> AttributeList()
(">" ElementList() "</" <EXPRESSION_CONDITION> ">" | ElementList() "/>")
}
void ExpressionLogicLanguage() #ExpressionLogicLanguage : {}
{
<EXPRESSION_LOGICLANGUAGE> AttributeList()
(">" ElementList() "</" <EXPRESSION_LOGICLANGUAGE> ">" | ElementList() "/>")
}
void ExpressionRefURI() #ExpressionRefURI : {}
{
<EXPRESSION_REFURI> AttributeList()
(">" ElementList() "</" <EXPRESSION_REFURI> ">" | ElementList() "/>")
}
void ObjectListList() #ObjectListList : {}
{
<OBJECTLIST_LIST> AttributeList()
(">" ElementList() "</" <OBJECTLIST_LIST> ">" | ElementList() "/>")
}
void OwlElement() : {}
{
OwlOntology()
......@@ -484,7 +527,9 @@ void OwlElement() : {}
| OwlDisjointWith()
| OwlDistinctMembers()
| OwlEquivalentClass()
| OwlEquivalentProperty()
| OwlFunctionalProperty()
| OwlHasValue()
| OwlImports()
| OwlIntersectionOf()
| OwlInverseOf()
......@@ -497,6 +542,7 @@ void OwlElement() : {}
| OwlSomeValuesFrom()
| OwlTransitiveProperty()
| OwlUnionOf()
| OwlVersionInfo()
}
void OwlOntology() #OwlOntology : {}
......@@ -559,12 +605,24 @@ void OwlEquivalentClass() #OwlEquivalentClass : {}
(">" ElementList() "</" <OWL_EQUIVALENTCLASS> ">" | ElementList() "/>")
}
void OwlEquivalentProperty() #OwlEquivalentProperty : {}
{
<OWL_EQUIVALENTPROPERTY> AttributeList()
(">" ElementList() "</" <OWL_EQUIVALENTPROPERTY> ">" | ElementList() "/>")
}
void OwlFunctionalProperty() #OwlFunctionalProperty : {}
{
<OWL_FUNCTIONALPROPERTY> AttributeList()
(">" ElementList() "</" <OWL_FUNCTIONALPROPERTY> ">" | ElementList() "/>")
}
void OwlHasValue () #OwlHasValue : {}
{
<OWL_HASVALUE> AttributeList()
(">" ElementList() "</" <OWL_HASVALUE> ">" | ElementList() "/>")
}
void OwlImports () #OwlImports : {}
{
<OWL_IMPORTS> AttributeList()
......@@ -637,6 +695,12 @@ void OwlUnionOf () #OwlUnionOf : {}
(">" ElementList() "</" <OWL_UNIONOF> ">" | ElementList() "/>")
}
void OwlVersionInfo () #OwlVersionInfo : {}
{
<OWL_VERSIONINFO> AttributeList()
(">" ElementList() "</" <OWL_VERSIONINFO> ">" | ElementList() "/>")
}
void P1Element() : {}
{
P1AnyOrder()
......@@ -781,6 +845,24 @@ void P1UntilProcess() #P1UntilProcess : {}
(">" ElementList() "</" <P1_UNTILPROCESS> ">" | ElementList() "/>")
}
void ProcessElement(): {}
{
ProcessParticipant()
| ProcessPerform()
}
void ProcessParticipant() #ProcessParticipant : {}
{
<PROCESS_PARTICIPANT> AttributeList()
(">" ElementList() "</" <PROCESS_PARTICIPANT> ">" | ElementList() "/>")
}
void ProcessPerform() #ProcessPerform : {}
{
<PROCESS_PERFORM> AttributeList()
(">" ElementList() "</" <PROCESS_PERFORM> ">" | ElementList() "/>")
}
void RdfElement() : {}
{
......@@ -791,7 +873,9 @@ void RdfElement() : {}
| RdfRest()
| RdfsComment()
| RdfsDomain()
| RdfsLabel()
| RdfsRange()
| RdfsSeeAlso()
| RdfsSubClassOf()
| RdfsSubPropertyOf()
}
......@@ -838,12 +922,24 @@ void RdfsDomain() #RdfsDomain : {}
(">" ElementList() "</" <RDFS_DOMAIN> ">" | ElementList() "/>")
}
void RdfsLabel() #RdfsLabel : {}
{
<RDFS_LABEL> AttributeList()
(">" ElementList() "</" <RDFS_LABEL> ">" | ElementList() "/>")
}
void RdfsRange() #RdfsRange : {}
{
<RDFS_RANGE> AttributeList()
(">" ElementList() "</" <RDFS_RANGE> ">" | ElementList() "/>")
}
void RdfsSeeAlso() #RdfsSeeAlso : {}
{
<RDFS_SEEALSO> AttributeList()
(">" ElementList() "</" <RDFS_SEEALSO> ">" | ElementList() "/>")
}
void RdfsSubClassOf() #RdfsSubClassOf : {}
{
<RDFS_SUBCLASSOF> AttributeList()
......@@ -921,19 +1017,21 @@ void XmlBase() #XmlBase : {}
void XmlnsAttribute() : {}
{
Xmlns()
| XmlnsDaml()
| XmlnsDc()
| XmlnsExpr()
| XmlnsList()
| XmlnsOwl()
| XmlnsP1()
| XmlnsProtege()
| XmlnsRdf()
| XmlnsRdfs()
| XmlnsSwrl()
| XmlnsSwrlb()
| XmlnsXsd()
| XmlnsXsp()
| XmlnsXX()
// | XmlnsDaml()
// | XmlnsDc()
// | XmlnsExpr()
// | XmlnsList()
// | XmlnsOwl()
// | XmlnsOwls()
// | XmlnsP1()
// | XmlnsProtege()
// | XmlnsRdf()
// | XmlnsRdfs()
// | XmlnsSwrl()
// | XmlnsSwrlb()
// | XmlnsXsd()
// | XmlnsXsp()
}
void Xmlns() #Xmlns : {}
......@@ -941,70 +1039,81 @@ void Xmlns() #Xmlns : {}
<XMLNS> <ASSIGN> Value()
}
void XmlnsDaml() #XmlnsDaml : {}
void XmlnsXX() #XmlnsXX : {Token t;}
{
<XMLNS_DAML> <ASSIGN> Value()
<XMLNS_XX> t = <IDENTIFIER> <ASSIGN> Value()
{jjtThis.setIDENTIFIER(t.image);}
}
void XmlnsDc() #XmlnsDc : {}
{
<XMLNS_DC> <ASSIGN> Value()
}
// void XmlnsDaml() #XmlnsDaml : {}
// {
// <XMLNS_DAML> <ASSIGN> Value()
// }
void XmlnsExpr() #XmlnsExpr : {}
{
<XMLNS_EXPR> <ASSIGN> Value()
}
// void XmlnsDc() #XmlnsDc : {}
// {
// <XMLNS_DC> <ASSIGN> Value()
// }
void XmlnsList() #XmlnsList : {}
{
<XMLNS_LIST> <ASSIGN> Value()
}
// void XmlnsExpr() #XmlnsExpr : {}
// {
// <XMLNS_EXPR> <ASSIGN> Value()
// }
void XmlnsP1() #XmlnsP1 : {}
{
<XMLNS_P1> <ASSIGN> Value()
}
// void XmlnsList() #XmlnsList : {}
// {
// <XMLNS_LIST> <ASSIGN> Value()
// }
void XmlnsProtege() #XmlnsProtege : {}
{
<XMLNS_PROTEGE> <ASSIGN> Value()
}
// void XmlnsP1() #XmlnsP1 : {}
// {
// <XMLNS_P1> <ASSIGN> Value()
// }
void XmlnsRdf() #XmlnsRdf : {}
{
<XMLNS_RDF> <ASSIGN> Value()
}
// void XmlnsProtege() #XmlnsProtege : {}
// {
// <XMLNS_PROTEGE> <ASSIGN> Value()
// }
void XmlnsSwrl() #XmlnsSwrl : {}
{
<XMLNS_SWRL> <ASSIGN> Value()
}
// void XmlnsRdf() #XmlnsRdf : {}
// {
// <XMLNS_RDF> <ASSIGN> Value()
// }
void XmlnsSwrlb() #XmlnsSwrlb : {}
{
<XMLNS_SWRLB> <ASSIGN> Value()
}
// void XmlnsSwrl() #XmlnsSwrl : {}
// {
// <XMLNS_SWRL> <ASSIGN> Value()
// }
void XmlnsXsd() #XmlnsXsd : {}
{
<XMLNS_XSD> <ASSIGN> Value()
}
// void XmlnsSwrlb() #XmlnsSwrlb : {}
// {
// <XMLNS_SWRLB> <ASSIGN> Value()
// }
void XmlnsXsp() #XmlnsXsp : {}
{
<XMLNS_XSP> <ASSIGN> Value()
}
// void XmlnsXsd() #XmlnsXsd : {}
// {
// <XMLNS_XSD> <ASSIGN> Value()
// }
void XmlnsRdfs() #XmlnsRdfs : {}
{
<XMLNS_RDFS> <ASSIGN> Value()
}
// void XmlnsXsp() #XmlnsXsp : {}
// {
// <XMLNS_XSP> <ASSIGN> Value()
// }
void XmlnsOwl() #XmlnsOwl : {}
{
<XMLNS_OWL> <ASSIGN> Value()
}
// void XmlnsRdfs() #XmlnsRdfs : {}
// {
// <XMLNS_RDFS> <ASSIGN> Value()
// }
// void XmlnsOwl() #XmlnsOwl : {}
// {
// <XMLNS_OWL> <ASSIGN> Value()
// }
// void XmlnsOwls() #XmlnsOwls : {}
// {
// <XMLNS_OWLS> <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