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
77e30aa3
Commit
77e30aa3
authored
Mar 30, 2007
by
Anders Nilsson
Browse files
Started added interface methods used from the SIARAS skillserver
parent
e29eaa71
Changes
2
Hide whitespace changes
Inline
Side-by-side
siaras/Ontology.java
0 → 100644
View file @
77e30aa3
/*
* 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();
// }
}
}
siaras/SkillserverInterface.jrag
0 → 100644
View file @
77e30aa3
/* -*-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);
}
}
}
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