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

Synching

parent 120386a7
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......@@ -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 {
......
......
......@@ -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) {
......@@ -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);
......@@ -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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment