Commit ccc12a05 authored by Anders Nilsson's avatar Anders Nilsson

Fixed qualified typing of generated class attributes

parent 5997cc6f
......@@ -102,8 +102,8 @@ aspect AbsGrammarGeneration {
// Thing is handled explicitly
return;
}
System.out.println(name());
dumpTree(" ",System.out);
// System.out.println(name());
// dumpTree(" ",System.out);
pStream.print(name());
pStream.print(" : "+getSuperClass().name());
pStream.print(" ::=");
......@@ -120,17 +120,25 @@ aspect AbsGrammarGeneration {
void OwlProperty.genAbsGrammarEntry(PrintStream pStream) {
pStream.print(name());
pStream.print(":Thing");
// if (allValuesFrom()) {
pStream.print("*");
pStream.print(":"+range().type()+"*");
// pStream.print(":Thing");
// // 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 ObjectPropertyDomain.genAbsGrammarEntry(PrintStream pStream) {
pStream.print(objectProperty().name());
pStream.print(":Thing*");
pStream.print(domain().name()+"*");
// pStream.print(":Thing*");
}
void DataPropertyDomain.genAbsGrammarEntry(PrintStream pStream) {
......
......@@ -23,6 +23,7 @@ aspect Names {
syn String Element.name() = "";
eq OClass.name() = getId();
eq OwlProperty.name() = getId();
eq RdfsDomain.name() = getId();
eq OwlRestriction.name() = getRestrictionClassId();
eq Declaration.name() = getElement(0).name();
eq Clazz.name() = iri().trim();
......
......@@ -51,6 +51,9 @@ aspect MiscUtilities {
if (s.indexOf('#') > -1) {
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")) {
s = "String";
}
......@@ -172,6 +175,11 @@ aspect MiscUtilities {
return "_Unknown_";
}
// eq RdfsDomain.getId() {
// System.out.println(((OwlClassUse) getElement(0)).getId());
// return ((OwlClassUse)getElement(0)).getId();
// }
syn lazy String Element.type() = null;
eq RdfsRange.type() {
......@@ -190,7 +198,7 @@ aspect MiscUtilities {
}
// Fall through. Could not find Id, so let's return something
// well known
return "_Unknown_";
return "Thing";
}
eq OwlDataRange.type() {
......@@ -231,7 +239,6 @@ aspect MiscUtilities {
}
syn boolean Declaration.isClassDecl() {
dumpTree(" ",System.out);
return getElement(0).isClass();
}
eq OwlClassDecl.isClassDecl() = true;
......
......@@ -340,15 +340,56 @@ aspect Properties {
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;
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() {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsRange) {
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() {
for (int i=0; i<getNumElement(); i++) {
......@@ -356,7 +397,8 @@ aspect Properties {
return (RdfsRange) getElement(i);
}
}
return null;
// return null;
return new RdfsRange(new List().add(new RdfResource(new Value("Thing"))),new List());
}
eq OwlDatatypeProperty.range() {
for (int i=0; i<getNumElement(); i++) {
......@@ -364,7 +406,8 @@ aspect Properties {
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() {
......
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