Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
61c4200e
Commit
61c4200e
authored
Sep 18, 2007
by
Anders Nilsson
Browse files
Working on connecting x3d compiler to ontology instances.
parent
8b15ff69
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
CompilerGeneration.jrag
View file @
61c4200e
...
...
@@ -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 ::=;");
...
...
Rewrites.jrag
View file @
61c4200e
...
...
@@ -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());
...
...
Types.jrag
View file @
61c4200e
...
...
@@ -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_");
}
...
...
siaras/GeometryDemo.java
0 → 100644
View file @
61c4200e
/*
* 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
);
}
}
siaras/SkillserverInterface.jrag
View file @
61c4200e
...
...
@@ -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())) {
...
...
testontologies/ontology.owl
View file @
61c4200e
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment