Loading siaras/Geometry.jrag 0 → 100644 +37 −0 Original line number Diff line number Diff line /* -*-Java-*- */ /* * Copyright (C) 2007 Anders Nilsson <anders.nilsson@cs.lth.se> * * This file is part of OntologyCompiler. */ aspect Geometry { syn lazy String Thing.getGeometryRef() = "NotApplicable"; eq Product.getGeometryRef(){ // // if (getNumAttribute() > 0) { // // return getAttribute(0).name(); // // } else { // // return "unknown_id"; // // } for (int i=0; i<getNumElement(); i++) { // System.out.println(" Checking "+getElement(i)); if (getElement(i).isGeometryRef()) { System.out.println("Found Geometry ref"); // System.out.println(" Found identifier: "+((ComplexElement) getElement(i)).getAttribute(0).name()); Geometry g = (Geometry) ((ClassUse) getElement(i)).decl(); // System.out.println(" "+((ComplexElement) ident.getElement(0)).name()); // return ident.value(); return g.getValue(); } } return "_No_GeometryRef_"; } syn boolean Element.isGeometryRef() = false; eq ComplexElement.isGeometryRef() = name().equals("hasGeometry"); // Ugly hack! eq Geometry.isGeometryRef() = true; } No newline at end of file siaras/GeometryDemo.java +44 −46 Original line number Diff line number Diff line Loading @@ -5,9 +5,7 @@ * This file is part of OntologyCompiler. */ import AST.Start; import AST.SiarasParser; import AST.ParseException; import AST.*; import java.io.*; import java.net.*; Loading Loading @@ -41,26 +39,26 @@ public class GeometryDemo extends Parser { } return ast; // try { // // Generate OWL ontology, possibly transformed from Owl // // Full to OWL DL // if (outfile == null) { // outfile = "ontology"; // } // PrintStream pStream = new PrintStream(new File(outfile+".owl")); // ast.genOntology("",pStream); // // have to create a matching repository file, otherwise // // Protege will complain severely. // pStream = new PrintStream(new File(outfile+".repository")); // pStream.println("[Dublin Core DL Redirect]"); // } catch (java.io.FileNotFoundException e) { // System.out.println("Could not create file: "+outfile); // e.printStackTrace(); // } } public static void main(String[] args) { Console con = System.console(); con.readLine("\n\nParse ontology from file: %s",(Object) args[0]); Start ast = getAST(args[0]); ast.getIndividual("Teapot_1").dumpTree("",System.out); con.readLine("\n\nFind the Teapot instance"); Product p = (Product) ast.getIndividual("Teapot_1"); p.dumpTree("",System.out); // p.prettyPrint("",System.out); con.readLine("\n\nFind the geometry reference"); String s = p.getGeometryRef(); System.out.println("Geometry model: "+s); } } siaras/Rewrites.jrag +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ aspect Qualification { getElementList()); } when ((name().equals("hasProperty") || name().equals("hasGeometry") || name().equals("hasIdentifier") || name().equals("hasSubskill") || name().equals("hasSkill") || Loading @@ -31,6 +32,7 @@ aspect Qualification { setElementList(new List()); } when ((name().equals("hasProperty") || name().equals("hasGeometry") || name().equals("hasIdentifier") || name().equals("hasSubskill") || name().equals("hasSkill") || Loading siaras/SkillserverInterface.jrag +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ aspect SkillserverInterface { public Thing Thing.getIndividual(String id) { // System.out.println(" "+name()); // System.out.println("Looking for: "+id+" in: "+id()+" ("+name()+")"); System.out.println("Looking in: "+id()+" "+" ("+name()+")"); // System.out.println("Looking in: "+id()+" "+" ("+name()+")"); // if (id().contains(id) && // (this instanceof Device)) { if (id.equals(id())) { Loading testontologies/ontology.owl +5849 −5865 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
siaras/Geometry.jrag 0 → 100644 +37 −0 Original line number Diff line number Diff line /* -*-Java-*- */ /* * Copyright (C) 2007 Anders Nilsson <anders.nilsson@cs.lth.se> * * This file is part of OntologyCompiler. */ aspect Geometry { syn lazy String Thing.getGeometryRef() = "NotApplicable"; eq Product.getGeometryRef(){ // // if (getNumAttribute() > 0) { // // return getAttribute(0).name(); // // } else { // // return "unknown_id"; // // } for (int i=0; i<getNumElement(); i++) { // System.out.println(" Checking "+getElement(i)); if (getElement(i).isGeometryRef()) { System.out.println("Found Geometry ref"); // System.out.println(" Found identifier: "+((ComplexElement) getElement(i)).getAttribute(0).name()); Geometry g = (Geometry) ((ClassUse) getElement(i)).decl(); // System.out.println(" "+((ComplexElement) ident.getElement(0)).name()); // return ident.value(); return g.getValue(); } } return "_No_GeometryRef_"; } syn boolean Element.isGeometryRef() = false; eq ComplexElement.isGeometryRef() = name().equals("hasGeometry"); // Ugly hack! eq Geometry.isGeometryRef() = true; } No newline at end of file
siaras/GeometryDemo.java +44 −46 Original line number Diff line number Diff line Loading @@ -5,9 +5,7 @@ * This file is part of OntologyCompiler. */ import AST.Start; import AST.SiarasParser; import AST.ParseException; import AST.*; import java.io.*; import java.net.*; Loading Loading @@ -41,26 +39,26 @@ public class GeometryDemo extends Parser { } return ast; // try { // // Generate OWL ontology, possibly transformed from Owl // // Full to OWL DL // if (outfile == null) { // outfile = "ontology"; // } // PrintStream pStream = new PrintStream(new File(outfile+".owl")); // ast.genOntology("",pStream); // // have to create a matching repository file, otherwise // // Protege will complain severely. // pStream = new PrintStream(new File(outfile+".repository")); // pStream.println("[Dublin Core DL Redirect]"); // } catch (java.io.FileNotFoundException e) { // System.out.println("Could not create file: "+outfile); // e.printStackTrace(); // } } public static void main(String[] args) { Console con = System.console(); con.readLine("\n\nParse ontology from file: %s",(Object) args[0]); Start ast = getAST(args[0]); ast.getIndividual("Teapot_1").dumpTree("",System.out); con.readLine("\n\nFind the Teapot instance"); Product p = (Product) ast.getIndividual("Teapot_1"); p.dumpTree("",System.out); // p.prettyPrint("",System.out); con.readLine("\n\nFind the geometry reference"); String s = p.getGeometryRef(); System.out.println("Geometry model: "+s); } }
siaras/Rewrites.jrag +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ aspect Qualification { getElementList()); } when ((name().equals("hasProperty") || name().equals("hasGeometry") || name().equals("hasIdentifier") || name().equals("hasSubskill") || name().equals("hasSkill") || Loading @@ -31,6 +32,7 @@ aspect Qualification { setElementList(new List()); } when ((name().equals("hasProperty") || name().equals("hasGeometry") || name().equals("hasIdentifier") || name().equals("hasSubskill") || name().equals("hasSkill") || Loading
siaras/SkillserverInterface.jrag +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ aspect SkillserverInterface { public Thing Thing.getIndividual(String id) { // System.out.println(" "+name()); // System.out.println("Looking for: "+id+" in: "+id()+" ("+name()+")"); System.out.println("Looking in: "+id()+" "+" ("+name()+")"); // System.out.println("Looking in: "+id()+" "+" ("+name()+")"); // if (id().contains(id) && // (this instanceof Device)) { if (id.equals(id())) { Loading
testontologies/ontology.owl +5849 −5865 File changed.Preview size limit exceeded, changes collapsed. Show changes