Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
ccc12a05
Commit
ccc12a05
authored
Jul 11, 2014
by
Administrator
Browse files
Fixed qualified typing of generated class attributes
parent
5997cc6f
Changes
4
Hide whitespace changes
Inline
Side-by-side
CompilerGeneration.jrag
View file @
ccc12a05
...
...
@@ -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) {
...
...
Names.jrag
View file @
ccc12a05
...
...
@@ -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();
...
...
Rewrites.jrag
View file @
ccc12a05
...
...
@@ -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;
...
...
Types.jrag
View file @
ccc12a05
...
...
@@ -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() {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment