Loading DumpClasses.jrag +4 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ aspect DumpClasses { pStream.print(getId()); pStream.print(" : "+getSuperClass().getId()); pStream.print(" ::= "); Properties props = getFunctionalProperties(); for (int i=0; i<props.getNumProperty(); i++) { pStream.print(props.getProperty(i).getId()+" "); } pStream.println(";"); } } No newline at end of file Rewrites.jrag +19 −4 Original line number Diff line number Diff line Loading @@ -38,7 +38,11 @@ aspect MiscUtilities { return false; } String ComplexElement.getId() { syn lazy String Element.getId() { return new String("Element has no ID"); } eq ComplexElement.getId() { if (hasRdfId()) { for (int i=0; i<getNumAttribute(); i++) { if (getAttribute(i) instanceof RdfId) { Loading @@ -58,11 +62,11 @@ aspect MiscUtilities { } ComplexElement ComplexElement.getTopElement() { ComplexElement e = this; ASTNode e = this; while (e != null && !(e instanceof RdfDeclaration)) { e = (ComplexElement) e.getParent().getParent(); e = e.getParent(); } return e; return (ComplexElement) e; } } Loading @@ -88,4 +92,15 @@ aspect RewriteClasses { new List().add(oc)); } } rewrite RdfsDomain { when (getNumAttribute()>0 && getAttribute(0) instanceof RdfResource) to RdfsDomain { Value value = getAttribute(0).getValue(); OwlClass oc = new OwlClass(new List().add(new RdfAbout(value)), new List()); return new RdfsDomain(new List(), new List().add(oc)); } } } No newline at end of file Types.jrag +24 −7 Original line number Diff line number Diff line /* -*-Java-*- */ aspect Types { syn lazy Class Class.getSuperClass(); syn lazy OClass OClass.getSuperClass(); eq OwlClassDecl.getSuperClass() { for (int i=0; i<getNumElement(); i++) { if (getElement(i) instanceof RdfsSubClassOf) { RdfsSubClassOf e = (RdfsSubClassOf) getElement(i); if (e.getElement(0) instanceof Class) { return ((Class) e.getElement(0)).decl(); if (e.getElement(0) instanceof OClass) { return ((OClass) e.getElement(0)).decl(); } } } Loading @@ -18,7 +18,7 @@ aspect Types { return null; } syn lazy OwlClassDecl Class.decl(); syn lazy OwlClassDecl OClass.decl(); eq OwlClassDecl.decl() = this; eq OwlClassUse.decl() { ComplexElement top = getTopElement(); Loading @@ -44,7 +44,7 @@ aspect Types { for (int i=0; i<l.getNumChild(); i++) { OwlFunctionalProperty op = (OwlFunctionalProperty) l.getChild(i); if (op.domainIncludes(this)) { p.addElement(op); p.addProperty(op); } } return p; Loading @@ -62,12 +62,29 @@ aspect Properties { l.add(this); } boolean OwlFunctionalProperty.domainIncludes(Class clazz) { boolean ASTNode.domainIncludes(OClass clazz) { return false; } boolean OwlFunctionalProperty.domainIncludes(OClass clazz) { for (int i=0; i<getNumElement(); i++) { if (getElement(i) instanceof RdfsDomain) { // ((RdfsDomain) getElement(i)). return ((RdfsDomain) getElement(i)).domainIncludes(clazz); } } return false; } boolean RdfsDomain.domainIncludes(OClass clazz) { for (int i=0; i<getNumElement(); i++) { if (getElement(i).domainIncludes(clazz)) { return true; } } return false; } boolean OClass.domainIncludes(OClass clazz) { return getId().equals(clazz.getId()); } } No newline at end of file owl.ast +4 −4 Original line number Diff line number Diff line Loading @@ -52,8 +52,8 @@ Value ::= <STRING_LITERAL>; // Types generated by rewrite rules abstract Class : ComplexElement; OwlClassDecl : Class ::= <Id:String> ; OwlClassUse : Class ::= <Id:String> ; abstract OClass : ComplexElement; OwlClassDecl : OClass ::= <Id:String> ; OwlClassUse : OClass ::= <Id:String> ; Properties ::= Element*; No newline at end of file Properties ::= Property:Element*; Loading
DumpClasses.jrag +4 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ aspect DumpClasses { pStream.print(getId()); pStream.print(" : "+getSuperClass().getId()); pStream.print(" ::= "); Properties props = getFunctionalProperties(); for (int i=0; i<props.getNumProperty(); i++) { pStream.print(props.getProperty(i).getId()+" "); } pStream.println(";"); } } No newline at end of file
Rewrites.jrag +19 −4 Original line number Diff line number Diff line Loading @@ -38,7 +38,11 @@ aspect MiscUtilities { return false; } String ComplexElement.getId() { syn lazy String Element.getId() { return new String("Element has no ID"); } eq ComplexElement.getId() { if (hasRdfId()) { for (int i=0; i<getNumAttribute(); i++) { if (getAttribute(i) instanceof RdfId) { Loading @@ -58,11 +62,11 @@ aspect MiscUtilities { } ComplexElement ComplexElement.getTopElement() { ComplexElement e = this; ASTNode e = this; while (e != null && !(e instanceof RdfDeclaration)) { e = (ComplexElement) e.getParent().getParent(); e = e.getParent(); } return e; return (ComplexElement) e; } } Loading @@ -88,4 +92,15 @@ aspect RewriteClasses { new List().add(oc)); } } rewrite RdfsDomain { when (getNumAttribute()>0 && getAttribute(0) instanceof RdfResource) to RdfsDomain { Value value = getAttribute(0).getValue(); OwlClass oc = new OwlClass(new List().add(new RdfAbout(value)), new List()); return new RdfsDomain(new List(), new List().add(oc)); } } } No newline at end of file
Types.jrag +24 −7 Original line number Diff line number Diff line /* -*-Java-*- */ aspect Types { syn lazy Class Class.getSuperClass(); syn lazy OClass OClass.getSuperClass(); eq OwlClassDecl.getSuperClass() { for (int i=0; i<getNumElement(); i++) { if (getElement(i) instanceof RdfsSubClassOf) { RdfsSubClassOf e = (RdfsSubClassOf) getElement(i); if (e.getElement(0) instanceof Class) { return ((Class) e.getElement(0)).decl(); if (e.getElement(0) instanceof OClass) { return ((OClass) e.getElement(0)).decl(); } } } Loading @@ -18,7 +18,7 @@ aspect Types { return null; } syn lazy OwlClassDecl Class.decl(); syn lazy OwlClassDecl OClass.decl(); eq OwlClassDecl.decl() = this; eq OwlClassUse.decl() { ComplexElement top = getTopElement(); Loading @@ -44,7 +44,7 @@ aspect Types { for (int i=0; i<l.getNumChild(); i++) { OwlFunctionalProperty op = (OwlFunctionalProperty) l.getChild(i); if (op.domainIncludes(this)) { p.addElement(op); p.addProperty(op); } } return p; Loading @@ -62,12 +62,29 @@ aspect Properties { l.add(this); } boolean OwlFunctionalProperty.domainIncludes(Class clazz) { boolean ASTNode.domainIncludes(OClass clazz) { return false; } boolean OwlFunctionalProperty.domainIncludes(OClass clazz) { for (int i=0; i<getNumElement(); i++) { if (getElement(i) instanceof RdfsDomain) { // ((RdfsDomain) getElement(i)). return ((RdfsDomain) getElement(i)).domainIncludes(clazz); } } return false; } boolean RdfsDomain.domainIncludes(OClass clazz) { for (int i=0; i<getNumElement(); i++) { if (getElement(i).domainIncludes(clazz)) { return true; } } return false; } boolean OClass.domainIncludes(OClass clazz) { return getId().equals(clazz.getId()); } } No newline at end of file
owl.ast +4 −4 Original line number Diff line number Diff line Loading @@ -52,8 +52,8 @@ Value ::= <STRING_LITERAL>; // Types generated by rewrite rules abstract Class : ComplexElement; OwlClassDecl : Class ::= <Id:String> ; OwlClassUse : Class ::= <Id:String> ; abstract OClass : ComplexElement; OwlClassDecl : OClass ::= <Id:String> ; OwlClassUse : OClass ::= <Id:String> ; Properties ::= Element*; No newline at end of file Properties ::= Property:Element*;