aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-23 09:44:01 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-23 09:44:01 +0000
commit402e3ec13ca1a0a870dde530d1364a528079782d (patch)
treee841cb7719fee1bf5280ba0f3bc94df7784df325 /src
parent65a8bbeaa25cdf42dfe150305fb48248e1a4b7b9 (diff)
downloadRSAComb-402e3ec13ca1a0a870dde530d1364a528079782d.tar.gz
RSAComb-402e3ec13ca1a0a870dde530d1364a528079782d.zip
Rename `boolean` as `bcq`
Diffstat (limited to 'src')
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala2
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala4
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala11
-rw-r--r--src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuerySpec.scala6
4 files changed, 11 insertions, 12 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 9ef8986..4693e04 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala
@@ -310,7 +310,7 @@ class RSAOntology(val ontology: OWLOntology) extends RSAAxiom {
310 RSA.Prefixes 310 RSA.Prefixes
311 ) 311 )
312 .map( 312 .map(
313 new ConjunctiveQueryAnswers(query.boolean, _) 313 new ConjunctiveQueryAnswers(query.bcq, _)
314 ) 314 )
315 .get 315 .get
316 RDFoxHelpers.closeConnection(server, data) 316 RDFoxHelpers.closeConnection(server, data)
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 b523938..4d397d8 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
@@ -75,7 +75,7 @@ class ConjunctiveQuery(
75 * query selects '''all''' variables with `*`, `select` is empty as 75 * query selects '''all''' variables with `*`, `select` is empty as
76 * well. 76 * well.
77 */ 77 */
78 val boolean: Boolean = select.isEmpty && !query.getAllPossibleVariables 78 val bcq: Boolean = select.isEmpty && !query.getAllPossibleVariables
79 79
80 /** Returns the full set of variables involved in the query. */ 80 /** Returns the full set of variables involved in the query. */
81 val variables: Set[Variable] = 81 val variables: Set[Variable] =
@@ -116,7 +116,7 @@ class ConjunctiveQuery(
116 opts: JMap[String, String] = new JHashMap[String, String]() 116 opts: JMap[String, String] = new JHashMap[String, String]()
117 ): ConjunctiveQueryAnswers = 117 ): ConjunctiveQueryAnswers =
118 new ConjunctiveQueryAnswers( 118 new ConjunctiveQueryAnswers(
119 boolean, 119 bcq,
120 RDFoxHelpers.submitSelectQuery(data, query, opts) 120 RDFoxHelpers.submitSelectQuery(data, query, opts)
121 ) 121 )
122 122
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala
index 223e121..ded8d6b 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala
@@ -2,23 +2,22 @@ package uk.ac.ox.cs.rsacomb.sparql
2 2
3import tech.oxfordsemantic.jrdfox.logic.expression.Resource 3import tech.oxfordsemantic.jrdfox.logic.expression.Resource
4 4
5/** A collections of answers to a query 5/** A collections of answers to a query.
6 * 6 *
7 * Will take the query type (CQ or BCQ) into consideration when 7 * Will take the query type (CQ or BCQ) into consideration when
8 * serialised. 8 * serialised.
9 * 9 *
10 * @param boolean whether the answers are to a BCQ 10 * @param bcq whether the answers are the result of a BCQ.
11 * @param answers collection of answers to a query. When dealing with 11 * @param answers collection of answers to a query. When dealing with
12 * BCQs, and empty collection represents a ''false'', 12 * BCQs, and empty collection represents a ''false'', ''true'' otherwise.
13 * ''true'' otherwise.
14 */ 13 */
15class ConjunctiveQueryAnswers( 14class ConjunctiveQueryAnswers(
16 boolean: Boolean, 15 bcq: Boolean,
17 val answers: Seq[Seq[Resource]] 16 val answers: Seq[Seq[Resource]]
18) { 17) {
19 18
20 override def toString(): String = 19 override def toString(): String =
21 if (boolean) { 20 if (bcq) {
22 if (answers.isEmpty) "FALSE" else "TRUE" 21 if (answers.isEmpty) "FALSE" else "TRUE"
23 } else { 22 } else {
24 if (answers.isEmpty) 23 if (answers.isEmpty)
diff --git a/src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuerySpec.scala b/src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuerySpec.scala
index e683d36..07e7bfb 100644
--- a/src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuerySpec.scala
+++ b/src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuerySpec.scala
@@ -150,15 +150,15 @@ class ConjunctiveQuerySpec
150 } 150 }
151 151
152 "A query with proper SELECT defined" should "not be a BCQ" in { 152 "A query with proper SELECT defined" should "not be a BCQ" in {
153 ConjunctiveQuery(cq0).value should not be 'boolean 153 ConjunctiveQuery(cq0).value should not be 'bcq
154 } 154 }
155 155
156 "A query with a \"*\" SELECT" should "not be a BCQ" in { 156 "A query with a \"*\" SELECT" should "not be a BCQ" in {
157 ConjunctiveQuery(cq1).value should not be 'boolean 157 ConjunctiveQuery(cq1).value should not be 'bcq
158 } 158 }
159 159
160 "An ASK query" should "not be a BCQ" in { 160 "An ASK query" should "not be a BCQ" in {
161 ConjunctiveQuery(bcq0).value shouldBe 'boolean 161 ConjunctiveQuery(bcq0).value shouldBe 'bcq
162 } 162 }
163 163
164 "Queries" should "have distinct answer and bounded variables" in { 164 "Queries" should "have distinct answer and bounded variables" in {