From 72486b041425d39f024722f2f0c55a621e265489 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <andersn@gosling> Date: Fri, 22 Sep 2006 08:34:56 +0200 Subject: [PATCH] Trying to extract restrictions instead of properties --- .bzrignore | 1 + DumpClasses.jrag | 15 ++++++++++----- Types.jrag | 24 ++++++++++++++++++++++++ owl.ast | 1 + 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.bzrignore b/.bzrignore index 55322fa..f67683a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -4,3 +4,4 @@ AST *.class semantic.cache plugins +testontologies/ontologyV06_Jambalaya.properties diff --git a/DumpClasses.jrag b/DumpClasses.jrag index bdde281..c51ba01 100644 --- a/DumpClasses.jrag +++ b/DumpClasses.jrag @@ -16,16 +16,21 @@ aspect DumpClasses { void OwlClassDecl.dumpClasses(PrintStream pStream) { pStream.print(getId()); pStream.print(" : "+getSuperClass().getId()); - pStream.print(" ::= "); - Properties props = getProperties(); - for (int i=0; i<props.getNumProperty(); i++) { + pStream.print(" ::="); + Restrictions restrs = getRestrictions(); + 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(props.getProperty(i).getId()); +// pStream.print(" "+props.getProperty(i).getId()); // pStream.print(":"); // pStream.print(props.getProperty(i).range().type()); // pStream.print(">"); // pStream.print(" "); - } +// } pStream.println(";"); } } diff --git a/Types.jrag b/Types.jrag index 8778a43..d209002 100644 --- a/Types.jrag +++ b/Types.jrag @@ -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 { void ASTNode.collectProperties(List l) { for (int i=0; i<getNumChild(); i++) { diff --git a/owl.ast b/owl.ast index 4b38bf3..b9b120e 100644 --- a/owl.ast +++ b/owl.ast @@ -69,5 +69,6 @@ OwlClassDecl : OClass ::= <Id:String> ; OwlClassUse : OClass ::= <Id:String> ; Properties ::= Property:Element*; +Restrictions ::= OwlRestriction*; OwlProperty : ComplexElement; -- GitLab