From 77746f19f9298975470e75de8e9071e7f317bda5 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Thu, 17 Dec 2020 17:45:07 +0000 Subject: 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. --- .../scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') 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 import org.semanticweb.owlapi.model.{IRI => OWLIRI} import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl -import tech.oxfordsemantic.jrdfox.client.{UpdateType, DataStoreConnection} +import tech.oxfordsemantic.jrdfox.client.{ + DataStoreConnection, + TransactionType, + UpdateType +} import tech.oxfordsemantic.jrdfox.Prefixes import tech.oxfordsemantic.jrdfox.logic.datalog.{ Rule, @@ -352,22 +356,31 @@ class RSAOntology(val ontology: OWLOntology) { val canon = this.canonicalModel val filter = this.filteringProgram(query) + //data.beginTransaction(TransactionType.READ_WRITE) + Logger print s"Canonical model: ${canon.rules.length} rules" RDFoxUtil.addRules(data, this.canonicalModel.rules) Logger print s"Canonical model: ${canon.facts.length} facts" RDFoxUtil.addFacts(data, this.canonicalModel.facts) - RDFoxUtil printStatisticsFor data + Logger print s"Filtering program: ${filter.facts.length} facts" + RDFoxUtil.addFacts(data, filter.facts) Logger print s"Filtering program: ${filter.rules.length} rules" RDFoxUtil.addRules(data, filter.rules) - Logger print s"Filtering program: ${filter.facts.length} facts" - RDFoxUtil.addFacts(data, filter.facts) + //data.commitTransaction() RDFoxUtil printStatisticsFor data + //{ + // import java.io.{FileOutputStream, File} + // val rules = new FileOutputStream(new File("rules2.dlog")) + // val facts = new FileOutputStream(new File("facts2.ttl")) + // RDFoxUtil.export(data, rules, facts) + //} + val answers = { val ans = RDFoxUtil.buildDescriptionQuery("Ans", query.answer.size) RDFoxUtil -- cgit v1.2.3