Skip to content
Snippets Groups Projects
Commit ccc12a05 authored by Administrator's avatar Administrator
Browse files

Fixed qualified typing of generated class attributes

parent 5997cc6f
No related branches found
No related tags found
No related merge requests found
...@@ -102,8 +102,8 @@ aspect AbsGrammarGeneration { ...@@ -102,8 +102,8 @@ aspect AbsGrammarGeneration {
// Thing is handled explicitly // Thing is handled explicitly
return; return;
} }
System.out.println(name()); // System.out.println(name());
dumpTree(" ",System.out); // dumpTree(" ",System.out);
pStream.print(name()); pStream.print(name());
pStream.print(" : "+getSuperClass().name()); pStream.print(" : "+getSuperClass().name());
pStream.print(" ::="); pStream.print(" ::=");
...@@ -120,17 +120,25 @@ aspect AbsGrammarGeneration { ...@@ -120,17 +120,25 @@ aspect AbsGrammarGeneration {
void OwlProperty.genAbsGrammarEntry(PrintStream pStream) { void OwlProperty.genAbsGrammarEntry(PrintStream pStream) {
pStream.print(name()); pStream.print(name());
pStream.print(":Thing"); pStream.print(":"+range().type()+"*");
// if (allValuesFrom()) { // pStream.print(":Thing");
pStream.print("*"); // // if (allValuesFrom()) {
// pStream.print("*");
// } // }
} }
void OwlDatatypeProperty.genAbsGrammarEntry(PrintStream pStream) {
pStream.print("<"+name());
pStream.print(":String>");
// pStream.print(":"+range().type()+"*");
}
void Element.genAbsGrammarEntry(PrintStream pStream) {} void Element.genAbsGrammarEntry(PrintStream pStream) {}
void ObjectPropertyDomain.genAbsGrammarEntry(PrintStream pStream) { void ObjectPropertyDomain.genAbsGrammarEntry(PrintStream pStream) {
pStream.print(objectProperty().name()); pStream.print(objectProperty().name());
pStream.print(":Thing*"); pStream.print(domain().name()+"*");
// pStream.print(":Thing*");
} }
void DataPropertyDomain.genAbsGrammarEntry(PrintStream pStream) { void DataPropertyDomain.genAbsGrammarEntry(PrintStream pStream) {
... ...
......
...@@ -23,6 +23,7 @@ aspect Names { ...@@ -23,6 +23,7 @@ aspect Names {
syn String Element.name() = ""; syn String Element.name() = "";
eq OClass.name() = getId(); eq OClass.name() = getId();
eq OwlProperty.name() = getId(); eq OwlProperty.name() = getId();
eq RdfsDomain.name() = getId();
eq OwlRestriction.name() = getRestrictionClassId(); eq OwlRestriction.name() = getRestrictionClassId();
eq Declaration.name() = getElement(0).name(); eq Declaration.name() = getElement(0).name();
eq Clazz.name() = iri().trim(); eq Clazz.name() = iri().trim();
... ...
......
...@@ -51,6 +51,9 @@ aspect MiscUtilities { ...@@ -51,6 +51,9 @@ aspect MiscUtilities {
if (s.indexOf('#') > -1) { if (s.indexOf('#') > -1) {
s = s.substring(s.indexOf('#')+1,s.length()).trim(); s = s.substring(s.indexOf('#')+1,s.length()).trim();
} }
if (s.indexOf(';') > -1) {
s = s.substring(s.indexOf(';')+1,s.length()).trim();
}
if (s.equals("string")) { if (s.equals("string")) {
s = "String"; s = "String";
} }
...@@ -172,6 +175,11 @@ aspect MiscUtilities { ...@@ -172,6 +175,11 @@ aspect MiscUtilities {
return "_Unknown_"; return "_Unknown_";
} }
// eq RdfsDomain.getId() {
// System.out.println(((OwlClassUse) getElement(0)).getId());
// return ((OwlClassUse)getElement(0)).getId();
// }
syn lazy String Element.type() = null; syn lazy String Element.type() = null;
eq RdfsRange.type() { eq RdfsRange.type() {
...@@ -190,7 +198,7 @@ aspect MiscUtilities { ...@@ -190,7 +198,7 @@ aspect MiscUtilities {
} }
// Fall through. Could not find Id, so let's return something // Fall through. Could not find Id, so let's return something
// well known // well known
return "_Unknown_"; return "Thing";
} }
eq OwlDataRange.type() { eq OwlDataRange.type() {
...@@ -231,7 +239,6 @@ aspect MiscUtilities { ...@@ -231,7 +239,6 @@ aspect MiscUtilities {
} }
syn boolean Declaration.isClassDecl() { syn boolean Declaration.isClassDecl() {
dumpTree(" ",System.out);
return getElement(0).isClass(); return getElement(0).isClass();
} }
eq OwlClassDecl.isClassDecl() = true; eq OwlClassDecl.isClassDecl() = true;
... ...
......
...@@ -340,15 +340,56 @@ aspect Properties { ...@@ -340,15 +340,56 @@ aspect Properties {
return false; return false;
} }
syn lazy RdfsDomain Element.domain() = null;
eq OwlObjectProperty.domain() {
for (int i=0; i<getNumElement(); i++) {
// getElement(i).dumpTree("",System.out);
// System.out.println("Checking "+getElement(i));
if (getElement(i) instanceof RdfsDomain) {
// System.out.println("Yes");
return (RdfsDomain) getElement(i);
}
}
return null;
}
eq OwlFunctionalProperty.domain() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsDomain) {
return (RdfsDomain) getElement(i);
}
}
return null;
}
eq OwlDatatypeProperty.domain() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsDomain) {
return (RdfsDomain) getElement(i);
}
}
return null;
}
syn lazy RdfsRange Element.range() = null; syn lazy RdfsRange Element.range() = null;
eq OwlProperty.range() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsRange) {
return (RdfsRange) getElement(i);
}
}
// Default to Thing
System.out.println("* Default range to Thing");
return new RdfsRange(new List().add(new RdfResource(new Value("Thing"))),new List());
}
eq OwlObjectProperty.range() { eq OwlObjectProperty.range() {
for (int i=0; i<getNumElement(); i++) { for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsRange) { if (getElement(i) instanceof RdfsRange) {
return (RdfsRange) getElement(i); return (RdfsRange) getElement(i);
} }
} }
return null; // Default to Thing
return new RdfsRange(new List().add(new RdfResource(new Value("Thing"))),new List());
} }
eq OwlFunctionalProperty.range() { eq OwlFunctionalProperty.range() {
for (int i=0; i<getNumElement(); i++) { for (int i=0; i<getNumElement(); i++) {
...@@ -356,7 +397,8 @@ aspect Properties { ...@@ -356,7 +397,8 @@ aspect Properties {
return (RdfsRange) getElement(i); return (RdfsRange) getElement(i);
} }
} }
return null; // return null;
return new RdfsRange(new List().add(new RdfResource(new Value("Thing"))),new List());
} }
eq OwlDatatypeProperty.range() { eq OwlDatatypeProperty.range() {
for (int i=0; i<getNumElement(); i++) { for (int i=0; i<getNumElement(); i++) {
...@@ -364,7 +406,8 @@ aspect Properties { ...@@ -364,7 +406,8 @@ aspect Properties {
return (RdfsRange) getElement(i); return (RdfsRange) getElement(i);
} }
} }
return null; return new RdfsRange(new List().add(new RdfResource(new Value("Thing"))),new List());
// return null;
} }
syn ObjectProperty ObjectPropertyDomain.objectProperty() { syn ObjectProperty ObjectPropertyDomain.objectProperty() {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment