diff options
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala')
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala index d41ca8c..5246d2f 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | |||
@@ -10,7 +10,7 @@ import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery | |||
10 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI, Term} | 10 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI, Term} |
11 | 11 | ||
12 | /* Local imports */ | 12 | /* Local imports */ |
13 | import util.{RDFoxUtil, RSA} | 13 | import util.{Logger, RDFoxUtil, RSA} |
14 | import sparql.ConjunctiveQuery | 14 | import sparql.ConjunctiveQuery |
15 | 15 | ||
16 | object RSAComb extends App { | 16 | object RSAComb extends App { |
@@ -53,15 +53,17 @@ object RSAComb extends App { | |||
53 | 53 | ||
54 | val ontology = RSAOntology(ontoPaths: _*) | 54 | val ontology = RSAOntology(ontoPaths: _*) |
55 | if (ontology.isRSA) { | 55 | if (ontology.isRSA) { |
56 | //println("ONTOLOGY IS RSA") | 56 | |
57 | Logger print "Ontology is RSA!" | ||
57 | 58 | ||
58 | /** Read SPARQL query from file */ | 59 | /** Read SPARQL query from file */ |
59 | val source = io.Source.fromFile(queryPath.getAbsoluteFile) | 60 | val query = RDFoxUtil.loadQueryFromFile(queryPath.getAbsoluteFile) |
60 | val query = source.getLines mkString "\n" | ||
61 | source.close() | ||
62 | 61 | ||
63 | /* Compute answers to query */ | 62 | /* Compute answers to query */ |
64 | val answers = ConjunctiveQuery(query).map(ontology ask _) | 63 | ConjunctiveQuery(query).map(ontology ask _) match { |
65 | answers map (_.toString) foreach println | 64 | case Some(answers) => Logger print answers |
65 | case None => | ||
66 | throw new RuntimeException("Submitted query is not conjunctive") | ||
67 | } | ||
66 | } | 68 | } |
67 | } | 69 | } |