diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-24 11:48:54 +0000 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-24 11:48:54 +0000 |
| commit | 0eca2d66ecf1aaca6f508bc14738d9ef3cc2de20 (patch) | |
| tree | 4306ab8e48be85a546807609da9c73e11e36099c /src/main/scala/uk/ac | |
| parent | b7d9a8ffc8cc4a8949229b5bd3ada301878633d9 (diff) | |
| download | RSAComb-0eca2d66ecf1aaca6f508bc14738d9ef3cc2de20.tar.gz RSAComb-0eca2d66ecf1aaca6f508bc14738d9ef3cc2de20.zip | |
Rename `RDFoxHelpers` to `RDFoxUtil`
For a more consistent naming.
Diffstat (limited to 'src/main/scala/uk/ac')
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | 2 | ||||
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 22 | ||||
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala (renamed from src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxHelpers.scala) | 8 |
5 files changed, 20 insertions, 20 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala index b70de66..b07ba92 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala | |||
| @@ -12,7 +12,7 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{Term, Variable} | |||
| 12 | import uk.ac.ox.cs.rsacomb.implicits.RSAAtom | 12 | import uk.ac.ox.cs.rsacomb.implicits.RSAAtom |
| 13 | import uk.ac.ox.cs.rsacomb.sparql.ConjunctiveQuery | 13 | import uk.ac.ox.cs.rsacomb.sparql.ConjunctiveQuery |
| 14 | import uk.ac.ox.cs.rsacomb.suffix.{Forward, Backward} | 14 | import uk.ac.ox.cs.rsacomb.suffix.{Forward, Backward} |
| 15 | import uk.ac.ox.cs.rsacomb.util.{RSA, RDFoxHelpers} | 15 | import uk.ac.ox.cs.rsacomb.util.{RSA, RDFoxUtil} |
| 16 | 16 | ||
| 17 | /** Factory for [[uk.ac.ox.cs.rsacomb.FilteringProgram FilteringProgram]] */ | 17 | /** Factory for [[uk.ac.ox.cs.rsacomb.FilteringProgram FilteringProgram]] */ |
| 18 | object FilteringProgram { | 18 | object FilteringProgram { |
| @@ -310,7 +310,7 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) | |||
| 310 | r5a ::: r5b ::: r5c ::: | 310 | r5a ::: r5b ::: r5c ::: |
| 311 | r6 ::: r7b ::: r7a ::: | 311 | r6 ::: r7b ::: r7a ::: |
| 312 | r8a ::: r8b :: r8c ::: | 312 | r8a ::: r8b :: r8c ::: |
| 313 | r9 :: List()) map RDFoxHelpers.reify | 313 | r9 :: List()) map RDFoxUtil.reify |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | /** Pretty-print filtering rule */ | 316 | /** Pretty-print filtering rule */ |
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 678a5fa..016bb86 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.{RDFoxHelpers, RSA} | 13 | import util.{RDFoxUtil, RSA} |
| 14 | import sparql.ConjunctiveQuery | 14 | import sparql.ConjunctiveQuery |
| 15 | 15 | ||
| 16 | object RSAComb extends App { | 16 | object RSAComb extends App { |
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 | ||
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala index 59eb626..bc90c86 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala | |||
| @@ -11,7 +11,7 @@ import tech.oxfordsemantic.jrdfox.logic.sparql.pattern.{ | |||
| 11 | TriplePattern | 11 | TriplePattern |
| 12 | } | 12 | } |
| 13 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery | 13 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery |
| 14 | import uk.ac.ox.cs.rsacomb.util.RDFoxHelpers | 14 | import uk.ac.ox.cs.rsacomb.util.RDFoxUtil |
| 15 | 15 | ||
| 16 | /** Factory for [[uk.ac.ox.cs.rsacomb.sparql.ConjunctiveQuery]]. */ | 16 | /** Factory for [[uk.ac.ox.cs.rsacomb.sparql.ConjunctiveQuery]]. */ |
| 17 | object ConjunctiveQuery { | 17 | object ConjunctiveQuery { |
| @@ -35,7 +35,7 @@ object ConjunctiveQuery { | |||
| 35 | query: String, | 35 | query: String, |
| 36 | prefixes: Prefixes = new Prefixes() | 36 | prefixes: Prefixes = new Prefixes() |
| 37 | ): Option[ConjunctiveQuery] = | 37 | ): Option[ConjunctiveQuery] = |
| 38 | RDFoxHelpers.parseSelectQuery(query, prefixes).map(ConjunctiveQuery(_)) | 38 | RDFoxUtil.parseSelectQuery(query, prefixes).map(ConjunctiveQuery(_)) |
| 39 | 39 | ||
| 40 | } | 40 | } |
| 41 | 41 | ||
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxHelpers.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala index a05e416..99a9614 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxHelpers.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/util/RDFoxUtil.scala | |||
| @@ -21,7 +21,7 @@ import uk.ac.ox.cs.rsacomb.suffix.Nth | |||
| 21 | import uk.ac.ox.cs.rsacomb.implicits.RSAAtom | 21 | import uk.ac.ox.cs.rsacomb.implicits.RSAAtom |
| 22 | 22 | ||
| 23 | /** A collection of helper methods for RDFox */ | 23 | /** A collection of helper methods for RDFox */ |
| 24 | object RDFoxHelpers extends RSAAtom { | 24 | object RDFoxUtil extends RSAAtom { |
| 25 | 25 | ||
| 26 | /** Simplify conversion between Java and Scala `List`s */ | 26 | /** Simplify conversion between Java and Scala `List`s */ |
| 27 | import uk.ac.ox.cs.rsacomb.implicits.JavaCollections._ | 27 | import uk.ac.ox.cs.rsacomb.implicits.JavaCollections._ |
| @@ -48,8 +48,8 @@ object RDFoxHelpers extends RSAAtom { | |||
| 48 | * @return a tuple with the newly opened server and data store | 48 | * @return a tuple with the newly opened server and data store |
| 49 | * connections. | 49 | * connections. |
| 50 | * | 50 | * |
| 51 | * @see [[uk.ac.ox.cs.rsacomb.util.RDFoxHelpers.closeConnection | 51 | * @see [[uk.ac.ox.cs.rsacomb.util.RDFoxUtil.closeConnection |
| 52 | * RDFoxHelpers.closeConnection]] for | 52 | * RDFoxUtil.closeConnection]] for |
| 53 | * details on how to close an open connection. | 53 | * details on how to close an open connection. |
| 54 | */ | 54 | */ |
| 55 | def openConnection( | 55 | def openConnection( |
| @@ -205,7 +205,7 @@ object RDFoxHelpers extends RSAAtom { | |||
| 205 | * @param server server connection | 205 | * @param server server connection |
| 206 | * @param data data store connections | 206 | * @param data data store connections |
| 207 | * | 207 | * |
| 208 | * @see [[uk.ac.ox.cs.rsacomb.util.RDFoxHelpers.openConnection RDFoxHelpers.openConnection]] | 208 | * @see [[uk.ac.ox.cs.rsacomb.util.RDFoxUtil.openConnection RDFoxUtil.openConnection]] |
| 209 | * for details on how to create a new connection with RDFox. | 209 | * for details on how to create a new connection with RDFox. |
| 210 | */ | 210 | */ |
| 211 | def closeConnection( | 211 | def closeConnection( |
