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

Trying to handle functional properties of owl classes.

parent bb7e74ca
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
+34 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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