diff --git a/siaras/Ontology.java b/siaras/Ontology.java new file mode 100644 index 0000000000000000000000000000000000000000..f476435d0031ab46a44db1b99e5badf17f4ba9c4 --- /dev/null +++ b/siaras/Ontology.java @@ -0,0 +1,63 @@ + +/* + * Copyright (C) 2006 Anders Nilsson <anders.nilsson@cs.lth.se> + * + * This file is part of OntologyCompiler. + */ + +import AST.Start; +import AST.SiarasParser; +import AST.ParseException; +import java.io.*; +import java.net.URL; + +public class Ontology extends Parser { + public static Start getAST(String ontologyURL) { + Start ast = null; +// String outfile = null; +// int i=0; +// for (i=0; i<args.length; i++) { +// if (args[i].equals("-o")) { +// outfile = args[++i]; +// if (outfile.endsWith(".owl")) { +// outfile = outfile.substring(0,outfile.indexOf('.')); +// } +// } +// } + try { + Reader r = new StringReader((String)new URL(ontologyURL).getFile()); + SiarasParser parser = new SiarasParser(r); + + ast = parser.Start(); + } + catch (ParseException e) { + System.out.println(e.getMessage()); + } +// catch (FileNotFoundException e) { +// System.err.println("file " + ontologyURL + " not found"); +// } + catch (IOException e) { + System.out.println(e.getMessage()); + } + 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(); +// } + + + } +} diff --git a/siaras/SkillserverInterface.jrag b/siaras/SkillserverInterface.jrag new file mode 100644 index 0000000000000000000000000000000000000000..ca23da79e7dd16a72051c276aa1e8fec1e6fadb1 --- /dev/null +++ b/siaras/SkillserverInterface.jrag @@ -0,0 +1,29 @@ +/* -*-Java-*- */ + +/* + * Copyright (C) 2007 Anders Nilsson <anders.nilsson@cs.lth.se> + * + * This file is part of OntologyCompiler. + */ + +aspect SkillserverInterface { + public Thing ASTNode.getIndividual(String id) { + System.out.println("foo"); + for (int i=0; i<getNumChild(); i++) { + Thing t = getChild(i).getIndividual(id); + if (t!=null) { + return t; + } + } + return null; + } + + public Thing Thing.getIndividual(String id) { + System.out.println("Looking for: "+id+" in: "+name()); + if (id.equals(name())) { + return this; + } else { + return super.getIndividual(id); + } + } +}