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

Working on connecting x3d compiler to ontology instances.

parent 8b15ff69
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,9 @@ aspect AbsGrammarGeneration {
}
public void Start.genAbsGrammar(PrintStream pStream) {
pStream.println("// -*-Java-*- ");
pStream.println();
pStream.println("// Automatically generated JastAdd abstract grammar file ");
pStream.println("// Predefined types");
pStream.println("Start ::= Element*;");
pStream.println("abstract Thing : ComplexElement ::=;");
......
......@@ -219,6 +219,10 @@ aspect RewriteClasses {
to OwlClassDecl {
return new OwlClassDecl(new List(), getElementList(), getId());
}
// when (hasRdfId())
// to OwlClassDecl {
// return new OwlClassDecl(new List(), getElementList(), getId());
// }
when (!isTopLevel())
to OwlClassUse {
return new OwlClassUse(new List(), getElementList(), getId());
......
......@@ -43,6 +43,7 @@ aspect Types {
}
// No decl found, so let's return null. Not sure if that's
// that the right thing to do though.
System.out.println("* Couldn't find decl for: "+getId());
return new OwlClassDecl(new List(), new List(), "_Unknown_");
}
......
/*
* Copyright (C) 2007 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.*;
public class GeometryDemo 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 FileReader(new URL(ontologyURL).getFile());
SiarasParser parser = new SiarasParser(r);
ast = parser.Start();
ast.traverseAST();
} catch (ParseException e) {
System.out.println(e.getMessage());
}
catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
catch (FileNotFoundException e) {
System.err.println("file " + ontologyURL + " not found");
}
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) {
Start ast = getAST(args[0]);
ast.getIndividual("Teapot_1").dumpTree("",System.out);
}
}
......@@ -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());
System.out.println("Looking in: "+id()+" "+" ("+name()+")");
// if (id().contains(id) &&
// (this instanceof Device)) {
if (id.equals(id())) {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment