diff options
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala')
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala index 24045de..19a6280 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | |||
@@ -52,7 +52,7 @@ import uk.ac.ox.cs.rsacomb.converter.{RDFoxAxiomConverter, SkolemStrategy} | |||
52 | import uk.ac.ox.cs.rsacomb.implicits.RSAAxiom | 52 | import uk.ac.ox.cs.rsacomb.implicits.RSAAxiom |
53 | import uk.ac.ox.cs.rsacomb.suffix._ | 53 | import uk.ac.ox.cs.rsacomb.suffix._ |
54 | import uk.ac.ox.cs.rsacomb.sparql._ | 54 | import uk.ac.ox.cs.rsacomb.sparql._ |
55 | import uk.ac.ox.cs.rsacomb.util.{RDFoxHelpers, RSA} | 55 | import uk.ac.ox.cs.rsacomb.util.{RDFoxUtil, RSA} |
56 | 56 | ||
57 | object RSAOntology { | 57 | object RSAOntology { |
58 | 58 | ||
@@ -166,7 +166,7 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom { | |||
166 | //datalog.foreach(println) | 166 | //datalog.foreach(println) |
167 | 167 | ||
168 | // Open connection with RDFox | 168 | // Open connection with RDFox |
169 | val (server, data) = RDFoxHelpers.openConnection("RSACheck") | 169 | val (server, data) = RDFoxUtil.openConnection("RSACheck") |
170 | // Add Data (hardcoded for now) | 170 | // Add Data (hardcoded for now) |
171 | //data.importData(UpdateType.ADDITION, RSA.Prefixes, ":a a :A .") | 171 | //data.importData(UpdateType.ADDITION, RSA.Prefixes, ":a a :A .") |
172 | 172 | ||
@@ -196,7 +196,7 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom { | |||
196 | //println(graph) | 196 | //println(graph) |
197 | 197 | ||
198 | // Close connection to RDFox | 198 | // Close connection to RDFox |
199 | RDFoxHelpers.closeConnection(server, data) | 199 | RDFoxUtil.closeConnection(server, data) |
200 | 200 | ||
201 | /* To check if the graph is tree-like we check for acyclicity in a | 201 | /* To check if the graph is tree-like we check for acyclicity in a |
202 | * undirected graph. | 202 | * undirected graph. |
@@ -263,7 +263,7 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom { | |||
263 | data: DataStoreConnection | 263 | data: DataStoreConnection |
264 | ): Graph[Resource, UnDiEdge] = { | 264 | ): Graph[Resource, UnDiEdge] = { |
265 | val query = "SELECT ?X ?Y WHERE { ?X rsa:E ?Y }" | 265 | val query = "SELECT ?X ?Y WHERE { ?X rsa:E ?Y }" |
266 | val answers = RDFoxHelpers.submitQuery(data, query, RSA.Prefixes).get | 266 | val answers = RDFoxUtil.submitQuery(data, query, RSA.Prefixes).get |
267 | var edges: Seq[UnDiEdge[Resource]] = answers.map { | 267 | var edges: Seq[UnDiEdge[Resource]] = answers.map { |
268 | case Seq(n1, n2) => UnDiEdge(n1, n2) | 268 | case Seq(n1, n2) => UnDiEdge(n1, n2) |
269 | } | 269 | } |
@@ -306,20 +306,20 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom { | |||
306 | */ | 306 | */ |
307 | def ask(query: ConjunctiveQuery): ConjunctiveQueryAnswers = { | 307 | def ask(query: ConjunctiveQuery): ConjunctiveQueryAnswers = { |
308 | import implicits.JavaCollections._ | 308 | import implicits.JavaCollections._ |
309 | val (server, data) = RDFoxHelpers.openConnection(RSAOntology.DataStore) | 309 | val (server, data) = RDFoxUtil.openConnection(RSAOntology.DataStore) |
310 | data.addRules(this.canonicalModel.rules) | 310 | data.addRules(this.canonicalModel.rules) |
311 | data.addRules(this.filteringProgram(query).rules) | 311 | data.addRules(this.filteringProgram(query).rules) |
312 | val answers = RDFoxHelpers | 312 | val answers = RDFoxUtil |
313 | .submitQuery( | 313 | .submitQuery( |
314 | data, | 314 | data, |
315 | RDFoxHelpers.buildDescriptionQuery("Ans", query.answer.size), | 315 | RDFoxUtil.buildDescriptionQuery("Ans", query.answer.size), |
316 | RSA.Prefixes | 316 | RSA.Prefixes |
317 | ) | 317 | ) |
318 | .map( | 318 | .map( |
319 | new ConjunctiveQueryAnswers(query.bcq, _) | 319 | new ConjunctiveQueryAnswers(query.bcq, _) |
320 | ) | 320 | ) |
321 | .get | 321 | .get |
322 | RDFoxHelpers.closeConnection(server, data) | 322 | RDFoxUtil.closeConnection(server, data) |
323 | answers | 323 | answers |
324 | } | 324 | } |
325 | 325 | ||
@@ -343,9 +343,9 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom { | |||
343 | prefixes: Prefixes = new Prefixes(), | 343 | prefixes: Prefixes = new Prefixes(), |
344 | opts: ju.Map[String, String] = new ju.HashMap[String, String]() | 344 | opts: ju.Map[String, String] = new ju.HashMap[String, String]() |
345 | ): Option[Seq[Seq[Resource]]] = { | 345 | ): Option[Seq[Seq[Resource]]] = { |
346 | val (server, data) = RDFoxHelpers.openConnection(RSAOntology.DataStore) | 346 | val (server, data) = RDFoxUtil.openConnection(RSAOntology.DataStore) |
347 | val answers = RDFoxHelpers.submitQuery(data, query, prefixes, opts) | 347 | val answers = RDFoxUtil.submitQuery(data, query, prefixes, opts) |
348 | RDFoxHelpers.closeConnection(server, data) | 348 | RDFoxUtil.closeConnection(server, data) |
349 | answers | 349 | answers |
350 | } | 350 | } |
351 | 351 | ||