aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswerSpecs.scala
blob: b24b1d22f2125a82920db75b297a5cb15aafccae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * Copyright 2020, 2021 KRR Oxford
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package uk.ac.ox.cs.rsacomb.sparql

import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import tech.oxfordsemantic.jrdfox.logic.expression.{IRI, Variable}

object ConjunctiveQueryAnswerSpec {

  val varX = Variable.create("X")
  val varY = Variable.create("Y")
  val varZ = Variable.create("Z")
  val iri1 = IRI.create("_:iri1")
  val iri2 = IRI.create("_:iri2")
  val iri3 = IRI.create("_:iri3")

  // val oneAnswer = new ConjunctiveQueryAnswers(
  //   false,
  //   Seq(varX, varY, varZ),
  //   Seq((4, Seq(iri1, iri2, iri3)))
  // )
  // val multipleAnswers =
  //   new ConjunctiveQueryAnswers(
  //     false,
  //     Seq(varY, varZ),
  //     Seq((1, Seq(iri1, iri1)), (2, Seq(iri1, iri2)), (1, Seq(iri1, iri3)))
  //   )
  // val noAnswer = new ConjunctiveQueryAnswers(false, Seq(), Seq())
  // val emptyAnswer =
  //   new ConjunctiveQueryAnswers(false, Seq(varX, varY), Seq((3, Seq())))

  // val falseAnswer = new ConjunctiveQueryAnswers(true, Seq(), Seq())
  // val trueAnswer1 = new ConjunctiveQueryAnswers(true, Seq(), Seq((1, Seq())))
  // val trueAnswer2 =
  //   new ConjunctiveQueryAnswers(
  //     true,
  //     Seq(varX, varY),
  //     Seq((5, Seq(iri1, iri1)), (2, Seq(iri1, iri2)), (1, Seq(iri1, iri3)))
  //   )
}

class ConjunctiveQueryAnswerSpec extends AnyFlatSpec with Matchers {

  import ConjunctiveQueryAnswerSpec._

  // "Test answer 1" should "have length 1 (4 with multiplicity)" in {
  //   oneAnswer should have(
  //     'length (1),
  //     'lengthWithMultiplicity (4)
  //   )
  // }
  // "Test answer 2" should "have length 3 (4 with multiplicity)" in {
  //   multipleAnswers should have(
  //     'length (3),
  //     'lengthWithMultiplicity (4)
  //   )
  // }
  // "Test answer 3" should "have length 0 (0 with multiplicity)" in {
  //   noAnswer should have(
  //     'length (0),
  //     'lengthWithMultiplicity (0)
  //   )
  // }
  // "Test answer 4" should "have length 1 (3 with multiplicity)" in {
  //   emptyAnswer should have(
  //     'length (1),
  //     'lengthWithMultiplicity (3)
  //   )
  // }
  // "Test boolean answer 1" should "have length 0 (0 with multiplicity)" in {
  //   falseAnswer should have(
  //     'length (0),
  //     'lengthWithMultiplicity (0)
  //   )
  // }
  // "Test boolean answer 2" should "have length 1 (1 with multiplicity)" in {
  //   trueAnswer1 should have(
  //     'length (0),
  //     'lengthWithMultiplicity (1)
  //   )
  // }
  // "Test boolean answer 3" should "have length 3 (8 with multiplicity)" in {
  //   trueAnswer2 should have(
  //     'length (0),
  //     'lengthWithMultiplicity (8)
  //   )
  // }

  // "A conjunctive query" should "print an header and a single line if it has a single answer" in {
  //   oneAnswer.toString shouldBe s"X\tY\tZ\n${iri1.getIRI}\t${iri2.getIRI}\t${iri3.getIRI}"
  // }

  // it should "print a header and multiple answers on multiple lines" in {
  //   multipleAnswers.toString shouldBe s"Y\tZ\n${iri1.getIRI}\t${iri1.getIRI}\n${iri1.getIRI}\t${iri2.getIRI}\n${iri1.getIRI}\t${iri3.getIRI}"
  // }

  // it should "print a special \"NO ANSWER.\" string when it has no answer" in {
  //   noAnswer.toString shouldBe "NO ANSWER."
  // }

  // it should "print only the header when it has an empty answer" in {
  //   emptyAnswer.toString shouldBe "X\tY\n"
  // }

  // "A boolean conjunctive query" should "print \"FALSE\" when it has no answer" in {
  //   falseAnswer.toString shouldBe "FALSE"
  // }

  // it should "print \"TRUE\" when it has a single empty answer" in {
  //   trueAnswer1.toString shouldBe "TRUE"
  // }

  // it should "print \"TRUE\" when it has a non-empty collection of answers" in {
  //   trueAnswer2.toString shouldBe "TRUE"
  //}
}