Loading siaras/Ontology.java +7 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import AST.Start; import AST.SiarasParser; import AST.ParseException; import java.io.*; import java.net.URL; import java.net.*; public class Ontology extends Parser { public static Start getAST(String ontologyURL) { Loading @@ -25,20 +25,19 @@ public class Ontology extends Parser { // } // } try { Reader r = new StringReader((String)new URL(ontologyURL).getFile()); Reader r = new FileReader(new URL(ontologyURL).getFile()); SiarasParser parser = new SiarasParser(r); ast = parser.Start(); } catch (ParseException e) { } catch (ParseException e) { System.out.println(e.getMessage()); } // catch (FileNotFoundException e) { // System.err.println("file " + ontologyURL + " not found"); // } catch (IOException e) { catch (MalformedURLException e) { System.out.println(e.getMessage()); } catch (FileNotFoundException e) { System.err.println("file " + ontologyURL + " not found"); } return ast; // try { Loading siaras/SkillserverInterface.jrag +20 −18 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ aspect SkillserverInterface { public Thing ASTNode.getIndividual(String id) { System.out.println("foo: "+this); // System.out.println("foo: "+this); for (int i=0; i<getNumChild(); i++) { Thing t = getChild(i).getIndividual(id); if (t!=null) { Loading @@ -19,20 +19,9 @@ aspect SkillserverInterface { return null; } public Thing Start.getIndividual(String id) { for (int i=0; i<getNumElement(); i++) { Thing t = getElement(i).getIndividual(id); if (t!=null) { System.out.println("Found: "+t); return t; } } return null; } public Thing Thing.getIndividual(String id) { System.out.println("Looking for: "+id+" in: "+name()); if (id.equals(name())) { System.out.println("Looking for: "+id+" in: "+id()); if (id.equals(id())) { return this; } else { return super.getIndividual(id); Loading @@ -40,9 +29,22 @@ aspect SkillserverInterface { } } aspect PrettyPrinter { public void Start.prettyPrint() { System.out.println("PrettyPrinting"); prettyPrint("",System.out); aspect Misc { public String Thing.id() { for (int i=0; i<getNumElement(); i++) { if (getElement(i).isIdentifier()) { Identifier ident = ((ClassUse) getElement(i)).decl(); return ident.getElement(0).id(); } } return null; } public String ValueElement.id() { return getElement(0).getLITERAL(); } syn boolean Element.isIdentifier() = false; eq Identifier.isIdentifier() = true; eq ClassUse.isIdentifier() = decl().isIdentifier(); } Loading
siaras/Ontology.java +7 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import AST.Start; import AST.SiarasParser; import AST.ParseException; import java.io.*; import java.net.URL; import java.net.*; public class Ontology extends Parser { public static Start getAST(String ontologyURL) { Loading @@ -25,20 +25,19 @@ public class Ontology extends Parser { // } // } try { Reader r = new StringReader((String)new URL(ontologyURL).getFile()); Reader r = new FileReader(new URL(ontologyURL).getFile()); SiarasParser parser = new SiarasParser(r); ast = parser.Start(); } catch (ParseException e) { } catch (ParseException e) { System.out.println(e.getMessage()); } // catch (FileNotFoundException e) { // System.err.println("file " + ontologyURL + " not found"); // } catch (IOException e) { catch (MalformedURLException e) { System.out.println(e.getMessage()); } catch (FileNotFoundException e) { System.err.println("file " + ontologyURL + " not found"); } return ast; // try { Loading
siaras/SkillserverInterface.jrag +20 −18 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ aspect SkillserverInterface { public Thing ASTNode.getIndividual(String id) { System.out.println("foo: "+this); // System.out.println("foo: "+this); for (int i=0; i<getNumChild(); i++) { Thing t = getChild(i).getIndividual(id); if (t!=null) { Loading @@ -19,20 +19,9 @@ aspect SkillserverInterface { return null; } public Thing Start.getIndividual(String id) { for (int i=0; i<getNumElement(); i++) { Thing t = getElement(i).getIndividual(id); if (t!=null) { System.out.println("Found: "+t); return t; } } return null; } public Thing Thing.getIndividual(String id) { System.out.println("Looking for: "+id+" in: "+name()); if (id.equals(name())) { System.out.println("Looking for: "+id+" in: "+id()); if (id.equals(id())) { return this; } else { return super.getIndividual(id); Loading @@ -40,9 +29,22 @@ aspect SkillserverInterface { } } aspect PrettyPrinter { public void Start.prettyPrint() { System.out.println("PrettyPrinting"); prettyPrint("",System.out); aspect Misc { public String Thing.id() { for (int i=0; i<getNumElement(); i++) { if (getElement(i).isIdentifier()) { Identifier ident = ((ClassUse) getElement(i)).decl(); return ident.getElement(0).id(); } } return null; } public String ValueElement.id() { return getElement(0).getLITERAL(); } syn boolean Element.isIdentifier() = false; eq Identifier.isIdentifier() = true; eq ClassUse.isIdentifier() = decl().isIdentifier(); }