Commit 4aff2be0 authored by Anders Nilsson's avatar Anders Nilsson

Sync

parent edda20d3
......@@ -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(" ");
......
......@@ -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";
......
......@@ -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;
}
......@@ -35,7 +35,7 @@ AnnotationProperty : ComplexElement;
Clazz : ComplexElement;
ClassAssertion : ComplexElement;
DataProperty : ComplexElement;
DataPropertyDomain : ComplexElement;
DataPropertyDomain : OwlProperty;
DataPropertyRange : ComplexElement;
Datatype : ComplexElement;
Declaration : ComplexElement;
......
......@@ -292,7 +292,8 @@ SPECIAL_TOKEN : /* COMMENTS */
"]",
".",
"&",
"@"
"@",
";"
]
>
|
......@@ -325,7 +326,7 @@ SPECIAL_TOKEN : /* COMMENTS */
| < RBRACE : "}" >
// | < LBRACKET : "[" >
// | < RBRACKET : "]" >
| < SEMICOLON : ";" >
// | < SEMICOLON : ";" >
| < QUOTE : "\"" >
// | < COMMA : "," >
// | < DOT : "." >
......
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