Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit 5016cb0f authored by Anders Nilsson's avatar Anders Nilsson

Trying to handle functional properties of owl classes.

parent bb7e74ca
......@@ -15,6 +15,9 @@ aspect DumpClasses {
void OwlClassDecl.dumpClasses(PrintStream pStream) {
pStream.print(getId());
pStream.println(" : "+getSuperClass().getId());
pStream.print(" : "+getSuperClass().getId());
pStream.print(" ::= ");
pStream.println(";");
}
}
\ No newline at end of file
......@@ -36,4 +36,38 @@ aspect Types {
// that the right thing to do though.
return null;
}
syn lazy Properties OwlClassDecl.getFunctionalProperties() {
List l = new List();
getTopElement().collectFunctionalProperties(l);
Properties p = new Properties();
for (int i=0; i<l.getNumChild(); i++) {
OwlFunctionalProperty op = (OwlFunctionalProperty) l.getChild(i);
if (op.domainIncludes(this)) {
p.addElement(op);
}
}
return p;
}
}
aspect Properties {
void ASTNode.collectFunctionalProperties(List l) {
for (int i=0; i<getNumChild(); i++) {
getChild(i).collectFunctionalProperties(l);
}
}
void OwlFunctionalProperty.collectFunctionalProperties(List l) {
l.add(this);
}
boolean OwlFunctionalProperty.domainIncludes(Class clazz) {
for (int i=0; i<getNumElement(); i++) {
if (getElement(i) instanceof RdfsDomain) {
// ((RdfsDomain) getElement(i)).
}
}
return false;
}
}
\ No newline at end of file
......@@ -55,3 +55,5 @@ Value ::= <STRING_LITERAL>;
abstract Class : ComplexElement;
OwlClassDecl : Class ::= <Id:String> ;
OwlClassUse : Class ::= <Id:String> ;
Properties ::= Element*;
\ No newline at end of file
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