Skip to content
Snippets Groups Projects
Commit 72486b04 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Trying to extract restrictions instead of properties

parent 2337a8e9
No related branches found
No related tags found
No related merge requests found
...@@ -4,3 +4,4 @@ AST ...@@ -4,3 +4,4 @@ AST
*.class *.class
semantic.cache semantic.cache
plugins plugins
testontologies/ontologyV06_Jambalaya.properties
...@@ -17,15 +17,20 @@ aspect DumpClasses { ...@@ -17,15 +17,20 @@ aspect DumpClasses {
pStream.print(getId()); pStream.print(getId());
pStream.print(" : "+getSuperClass().getId()); pStream.print(" : "+getSuperClass().getId());
pStream.print(" ::="); pStream.print(" ::=");
Properties props = getProperties(); Restrictions restrs = getRestrictions();
for (int i=0; i<props.getNumProperty(); i++) { for (int i=0; i<restrs.getNumOwlRestriction(); i++) {
pStream.print(" "+"restr");
}
// Properties props = getProperties();
// for (int i=0; i<props.getNumProperty(); i++) {
// pStream.print("<"); // pStream.print("<");
pStream.print(props.getProperty(i).getId()); // pStream.print(" "+props.getProperty(i).getId());
// pStream.print(":"); // pStream.print(":");
// pStream.print(props.getProperty(i).range().type()); // pStream.print(props.getProperty(i).range().type());
// pStream.print(">"); // pStream.print(">");
// pStream.print(" "); // pStream.print(" ");
} // }
pStream.println(";"); pStream.println(";");
} }
} }
...@@ -53,6 +53,30 @@ aspect Types { ...@@ -53,6 +53,30 @@ aspect Types {
} }
} }
aspect Restrictions {
Restrictions OwlClassDecl.restrictions;
syn lazy Restrictions OwlClassDecl.getRestrictions() {
if (restrictions == null) {
List l = new List();
collectRestrictions(l);
restrictions = new Restrictions(l);
}
return restrictions;
}
void ASTNode.collectRestrictions(List l) {
for (int i=0; i<getNumChild(); i++) {
getChild(i).collectRestrictions(l);
}
}
void OwlRestriction.collectRestrictions(List l) {
l.add(this);
}
}
aspect Properties { aspect Properties {
void ASTNode.collectProperties(List l) { void ASTNode.collectProperties(List l) {
for (int i=0; i<getNumChild(); i++) { for (int i=0; i<getNumChild(); i++) {
......
...@@ -69,5 +69,6 @@ OwlClassDecl : OClass ::= <Id:String> ; ...@@ -69,5 +69,6 @@ OwlClassDecl : OClass ::= <Id:String> ;
OwlClassUse : OClass ::= <Id:String> ; OwlClassUse : OClass ::= <Id:String> ;
Properties ::= Property:Element*; Properties ::= Property:Element*;
Restrictions ::= OwlRestriction*;
OwlProperty : ComplexElement; OwlProperty : ComplexElement;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment