diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index 53a4709f40e0a41afd707265b9b019a38d9f3f86..2a9c80321f00a52279c10f8d3b5c201f42636fbf 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -46,6 +46,12 @@ aspect AbsGrammarGeneration { pStream.println("FloatElement : SimpleElement ::=;"); pStream.println("ClassUse : Thing ::= /decl:Thing/;"); pStream.println("Attribute ::= Value;"); + pStream.println("AbbreviatedIRI : Attribute ::= ;"); + pStream.println("Cardinality : Attribute ::= ;"); + pStream.println("DatatypeIRI : Attribute ::= ;"); + pStream.println("IRI : Attribute ::= ;"); + pStream.println("Name : Attribute ::= ;"); + pStream.println("OntologyIRI : Attribute ::= ;"); pStream.println("RdfDatatype : Attribute ::= ;"); pStream.println("RdfId : Attribute ::= ;"); pStream.println("Xmlns : Attribute ::= ;"); @@ -92,6 +98,10 @@ aspect AbsGrammarGeneration { } void ClassDeclaration.genAbsGrammar(PrintStream pStream) { + if (name().equals("Thing")) { + // Thing is handled explicitly + return; + } pStream.print(name()); pStream.print(" : "+getSuperClass().name()); pStream.print(" ::="); @@ -121,6 +131,11 @@ aspect AbsGrammarGeneration { pStream.print(":Thing*"); } + void DataPropertyDomain.genAbsGrammarEntry(PrintStream pStream) { + pStream.print("<"+dataProperty().name()+">"); + // pStream.print(":String*"); + } + void Restrictions.genAbsGrammar(PrintStream pStream) { for (int i=0; i<getNumOwlRestriction(); i++) { pStream.print(" "); diff --git a/Names.jrag b/Names.jrag index 5c54c22f91693da1be33f4dcb0b601b46291d846..c698d4d4994b94a73943e98b9b63ea13fe7fa371 100644 --- a/Names.jrag +++ b/Names.jrag @@ -28,6 +28,7 @@ aspect Names { eq Clazz.name() = iri().trim(); eq NamedIndividual.name() = iri().trim(); eq ObjectProperty.name() = iri().trim(); + eq DataProperty.name() = iri().trim(); static String ASTNode.gName = "owl"; diff --git a/Types.jrag b/Types.jrag index 6207a3a7d588e89f7bffa6568a0914edffa7bfd5..9084961f07102a348b41cbac813caa8e272cf70c 100644 --- a/Types.jrag +++ b/Types.jrag @@ -158,7 +158,7 @@ aspect Types { // return new Properties(l); Properties p = new Properties(); for (int i=0; i<l.getNumChild(); i++) { - ObjectPropertyDomain op = (ObjectPropertyDomain) l.getChild(i); + OwlProperty op = (OwlProperty) l.getChild(i); if (op.domainIncludes(this)) { p.addProperty(op); } else { @@ -330,6 +330,16 @@ aspect Properties { return false; } + boolean DataPropertyDomain.domainIncludes(Declaration clazz) { + while (!clazz.name().equals("Thing")) { + if (clazz().name().equals(clazz.name())) { + return true; + } + clazz = clazz.getSuperClass(); + } + return false; + } + syn lazy RdfsRange Element.range() = null; eq OwlObjectProperty.range() { @@ -367,7 +377,19 @@ aspect Properties { return null; } + syn DataProperty DataPropertyDomain.dataProperty() { + for (Element e : getElements()) { + if (e.isDataProperty()) { + return (DataProperty) e; + } + } + System.err.println("DataPropertyDomain.dataProperty(): not found"); + return null; + } + syn boolean Element.isObjectProperty() = false; eq ObjectProperty.isObjectProperty() = true; + syn boolean Element.isDataProperty() = false; + eq DataProperty.isDataProperty() = true; } diff --git a/owl.ast b/owl.ast index eba2627282182a554ed444ed1922ba20dcc0f00c..f40fb1b2389bc20a695cb88c92687c97785cddba 100644 --- a/owl.ast +++ b/owl.ast @@ -35,7 +35,7 @@ AnnotationProperty : ComplexElement; Clazz : ComplexElement; ClassAssertion : ComplexElement; DataProperty : ComplexElement; -DataPropertyDomain : ComplexElement; +DataPropertyDomain : OwlProperty; DataPropertyRange : ComplexElement; Datatype : ComplexElement; Declaration : ComplexElement; diff --git a/owl.jjt b/owl.jjt index 67ef6261315176ca7a4d3a473a850ab7aa07879b..72b90deca8e0aefadf98dab96d92d8d07a2f9824 100644 --- a/owl.jjt +++ b/owl.jjt @@ -292,7 +292,8 @@ SPECIAL_TOKEN : /* COMMENTS */ "]", ".", "&", - "@" + "@", + ";" ] > | @@ -325,7 +326,7 @@ SPECIAL_TOKEN : /* COMMENTS */ | < RBRACE : "}" > // | < LBRACKET : "[" > // | < RBRACKET : "]" > - | < SEMICOLON : ";" > + // | < SEMICOLON : ";" > | < QUOTE : "\"" > // | < COMMA : "," > // | < DOT : "." >