aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-12-17 17:45:07 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-12-17 17:45:07 +0000
commit77746f19f9298975470e75de8e9071e7f317bda5 (patch)
tree704960af0a94adbb32cf357e29e9fe1940dc9fbc /src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
parentf97502d173d7fac008de97b0032aba12b6c6119d (diff)
downloadRSAComb-77746f19f9298975470e75de8e9071e7f317bda5.tar.gz
RSAComb-77746f19f9298975470e75de8e9071e7f317bda5.zip
Introduce code for transactions (commented out)
At this time transaction are not working well with the program, and importing everything in one transaction causes the query answering program to take too long. Hopefully we will be able to fix the bug and enable transactional execution of the major steps in the algorithm.
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.scala21
1 files changed, 17 insertions, 4 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 0f1cd5e..4ac5a77 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
@@ -24,7 +24,11 @@ import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory
24import org.semanticweb.owlapi.model.{IRI => OWLIRI} 24import org.semanticweb.owlapi.model.{IRI => OWLIRI}
25import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl 25import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl
26 26
27import tech.oxfordsemantic.jrdfox.client.{UpdateType, DataStoreConnection} 27import tech.oxfordsemantic.jrdfox.client.{
28 DataStoreConnection,
29 TransactionType,
30 UpdateType
31}
28import tech.oxfordsemantic.jrdfox.Prefixes 32import tech.oxfordsemantic.jrdfox.Prefixes
29import tech.oxfordsemantic.jrdfox.logic.datalog.{ 33import tech.oxfordsemantic.jrdfox.logic.datalog.{
30 Rule, 34 Rule,
@@ -352,22 +356,31 @@ class RSAOntology(val ontology: OWLOntology) {
352 val canon = this.canonicalModel 356 val canon = this.canonicalModel
353 val filter = this.filteringProgram(query) 357 val filter = this.filteringProgram(query)
354 358
359 //data.beginTransaction(TransactionType.READ_WRITE)
360
355 Logger print s"Canonical model: ${canon.rules.length} rules" 361 Logger print s"Canonical model: ${canon.rules.length} rules"
356 RDFoxUtil.addRules(data, this.canonicalModel.rules) 362 RDFoxUtil.addRules(data, this.canonicalModel.rules)
357 363
358 Logger print s"Canonical model: ${canon.facts.length} facts" 364 Logger print s"Canonical model: ${canon.facts.length} facts"
359 RDFoxUtil.addFacts(data, this.canonicalModel.facts) 365 RDFoxUtil.addFacts(data, this.canonicalModel.facts)
360 366
361 RDFoxUtil printStatisticsFor data 367 Logger print s"Filtering program: ${filter.facts.length} facts"
368 RDFoxUtil.addFacts(data, filter.facts)
362 369
363 Logger print s"Filtering program: ${filter.rules.length} rules" 370 Logger print s"Filtering program: ${filter.rules.length} rules"
364 RDFoxUtil.addRules(data, filter.rules) 371 RDFoxUtil.addRules(data, filter.rules)
365 372
366 Logger print s"Filtering program: ${filter.facts.length} facts" 373 //data.commitTransaction()
367 RDFoxUtil.addFacts(data, filter.facts)
368 374
369 RDFoxUtil printStatisticsFor data 375 RDFoxUtil printStatisticsFor data
370 376
377 //{
378 // import java.io.{FileOutputStream, File}
379 // val rules = new FileOutputStream(new File("rules2.dlog"))
380 // val facts = new FileOutputStream(new File("facts2.ttl"))
381 // RDFoxUtil.export(data, rules, facts)
382 //}
383
371 val answers = { 384 val answers = {
372 val ans = RDFoxUtil.buildDescriptionQuery("Ans", query.answer.size) 385 val ans = RDFoxUtil.buildDescriptionQuery("Ans", query.answer.size)
373 RDFoxUtil 386 RDFoxUtil