From 5016cb0f889aa81fff358da15cf3f540445e31b4 Mon Sep 17 00:00:00 2001
From: Anders Nilsson <anders.nilsson@cs.lth.se>
Date: Tue, 14 Feb 2006 16:21:45 +0100
Subject: [PATCH] Trying to handle functional properties of owl classes.

---
 DumpClasses.jrag |  5 ++++-
 Types.jrag       | 34 ++++++++++++++++++++++++++++++++++
 owl.ast          |  2 ++
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/DumpClasses.jrag b/DumpClasses.jrag
index 9c7fdf7..efb26c0 100644
--- a/DumpClasses.jrag
+++ b/DumpClasses.jrag
@@ -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
diff --git a/Types.jrag b/Types.jrag
index 9902091..618608f 100644
--- a/Types.jrag
+++ b/Types.jrag
@@ -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
diff --git a/owl.ast b/owl.ast
index 5f58266..0c1696b 100644
--- a/owl.ast
+++ b/owl.ast
@@ -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
-- 
GitLab