diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-02 18:46:32 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-02 18:46:32 +0100 |
| commit | f755fae778fc2ff657ea2c9fdf84e3e804e44fb3 (patch) | |
| tree | 7a36028503b5dfe9eed91e42bae2cfce8ca7ca25 | |
| parent | c90ba19acc72eba90b7fa20c63fd3bf5b2fe4aa8 (diff) | |
| download | RSAComb-f755fae778fc2ff657ea2c9fdf84e3e804e44fb3.tar.gz RSAComb-f755fae778fc2ff657ea2c9fdf84e3e804e44fb3.zip | |
Update duplicate test queries
| -rw-r--r-- | src/test/scala/rsacomb/FilteringProgramSpecs.scala | 110 |
1 files changed, 93 insertions, 17 deletions
diff --git a/src/test/scala/rsacomb/FilteringProgramSpecs.scala b/src/test/scala/rsacomb/FilteringProgramSpecs.scala index 027c790..8d7b6d2 100644 --- a/src/test/scala/rsacomb/FilteringProgramSpecs.scala +++ b/src/test/scala/rsacomb/FilteringProgramSpecs.scala | |||
| @@ -81,7 +81,7 @@ object FilteringProgramSpec { | |||
| 81 | val query2 = Query.create( | 81 | val query2 = Query.create( |
| 82 | QueryType.SELECT, | 82 | QueryType.SELECT, |
| 83 | false, | 83 | false, |
| 84 | List(v("w"), v("doc"), v("doc"), v("document_hyperlink")).asJava, | 84 | List(v("w"), v("doc"), v("document_hyperlink")).asJava, |
| 85 | Conjunction.create( | 85 | Conjunction.create( |
| 86 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), | 86 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), |
| 87 | Atom.rdf(v("w"), c("wellboreDocument"), v("doc")), | 87 | Atom.rdf(v("w"), c("wellboreDocument"), v("doc")), |
| @@ -93,24 +93,26 @@ object FilteringProgramSpec { | |||
| 93 | 93 | ||
| 94 | // val query3 = parseQuery( | 94 | // val query3 = parseQuery( |
| 95 | // """ | 95 | // """ |
| 96 | // SELECT ?w ?doc ?document_hyperlink | 96 | // SELECT ?wellbore ?formation_pressure |
| 97 | // WHERE { | 97 | // WHERE { |
| 98 | // ?w a :Wellbore ; | 98 | // ?w a :Wellbore ; |
| 99 | // :wellboreDocument ?doc . | 99 | // :name ?wellbore ; |
| 100 | // ?doc :hasURL ?document_hyperlink | 100 | // :hasFormationPressure ?fp . |
| 101 | // ?fp :valueInStandardUnit ?formation_pressure | ||
| 101 | // } | 102 | // } |
| 102 | // """, | 103 | // """, |
| 103 | // prefixes | 104 | // prefixes |
| 104 | // ) | 105 | // ) |
| 105 | 106 | ||
| 106 | val query3 = Query.create( | 107 | val query3 = Query.create( |
| 107 | QueryType.SELECT, | 108 | QueryType.SELECT, |
| 108 | false, | 109 | false, |
| 109 | List(v("w"), v("doc"), v("document_hyperlink")).asJava, | 110 | List(v("wellbore"), v("formation_pressure")).asJava, |
| 110 | Conjunction.create( | 111 | Conjunction.create( |
| 111 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), | 112 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), |
| 112 | Atom.rdf(v("w"), c("wellboreDocument"), v("doc")), | 113 | Atom.rdf(v("w"), c("name"), v("wellbore")), |
| 113 | Atom.rdf(v("doc"), c("hasURL"), v("document_hyperlink")) | 114 | Atom.rdf(v("w"), c("hasFormationPressure"), v("fp")), |
| 115 | Atom.rdf(v("fp"), c("valueInStandardUnit"), v("formation_pressure")) | ||
| 114 | ) | 116 | ) |
| 115 | ) | 117 | ) |
| 116 | 118 | ||
| @@ -118,24 +120,37 @@ object FilteringProgramSpec { | |||
| 118 | 120 | ||
| 119 | // val query4 = parseQuery( | 121 | // val query4 = parseQuery( |
| 120 | // """ | 122 | // """ |
| 121 | // SELECT ?w ?doc ?document_hyperlink | 123 | // SELECT * |
| 122 | // WHERE { | 124 | // WHERE { |
| 123 | // ?w a :Wellbore ; | 125 | // ?w a :Wellbore ; |
| 124 | // :wellboreDocument ?doc . | 126 | // :hasGeochemicalMeasurement ?measurement . |
| 125 | // ?doc :hasURL ?document_hyperlink | 127 | // ?measurement :cgType ?cgtype ; |
| 128 | // :peakName ?peakType ; | ||
| 129 | // :peakHeight ?peak_height ; | ||
| 130 | // :peakAmount ?peak_amount | ||
| 126 | // } | 131 | // } |
| 127 | // """, | 132 | // """, |
| 128 | // prefixes | 133 | // prefixes |
| 129 | // ) | 134 | // ) |
| 130 | 135 | ||
| 131 | val query4 = Query.create( | 136 | val query4 = Query.create( |
| 132 | QueryType.SELECT, | 137 | QueryType.SELECT, |
| 133 | false, | 138 | false, |
| 134 | List(v("w"), v("doc"), v("document_hyperlink")).asJava, | 139 | List( |
| 140 | v("w"), | ||
| 141 | v("measurement"), | ||
| 142 | v("cgtype"), | ||
| 143 | v("peakType"), | ||
| 144 | v("peak_height"), | ||
| 145 | v("peak_amount") | ||
| 146 | ).asJava, | ||
| 135 | Conjunction.create( | 147 | Conjunction.create( |
| 136 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), | 148 | Atom.rdf(v("w"), IRI.RDF_TYPE, c("Wellbore")), |
| 137 | Atom.rdf(v("w"), c("wellboreDocument"), v("doc")), | 149 | Atom.rdf(v("w"), c("hasGeochemicalMeasurement"), v("measurement")), |
| 138 | Atom.rdf(v("doc"), c("hasURL"), v("document_hyperlink")) | 150 | Atom.rdf(v("measurement"), c("cgType"), v("cgtype")), |
| 151 | Atom.rdf(v("measurement"), c("peakName"), v("peakType")), | ||
| 152 | Atom.rdf(v("measurement"), c("peakHeight"), v("peak_height")), | ||
| 153 | Atom.rdf(v("measurement"), c("peakAmount"), v("peak_amount")) | ||
| 139 | ) | 154 | ) |
| 140 | ) | 155 | ) |
| 141 | 156 | ||
| @@ -304,4 +319,65 @@ class FilteringProgramSpec | |||
| 304 | val program = new FilteringProgram(query2, List()) | 319 | val program = new FilteringProgram(query2, List()) |
| 305 | program.bounded shouldBe empty | 320 | program.bounded shouldBe empty |
| 306 | } | 321 | } |
| 322 | |||
| 323 | query3.toString() should "have {?w, ?fp} as bounded variables" in { | ||
| 324 | val w = Variable.create("w") | ||
| 325 | val fp = Variable.create("fp") | ||
| 326 | val program = new FilteringProgram(query3, List()) | ||
| 327 | program.bounded should contain theSameElementsAs List(w, fp) | ||
| 328 | } | ||
| 329 | |||
| 330 | query4.toString() should "have no bounded variable" in { | ||
| 331 | val program = new FilteringProgram(query4, List()) | ||
| 332 | program.bounded shouldBe empty | ||
| 333 | } | ||
| 334 | |||
| 335 | query5.toString() should "have a non-empty bounded set" in { | ||
| 336 | val w = Variable.create("w") | ||
| 337 | val c_int = Variable.create("c_int") | ||
| 338 | val f_int = Variable.create("f_int") | ||
| 339 | val c_unit = Variable.create("c_unit") | ||
| 340 | val program = new FilteringProgram(query5, List()) | ||
| 341 | program.bounded should contain theSameElementsAs List( | ||
| 342 | w, | ||
| 343 | c_int, | ||
| 344 | f_int, | ||
| 345 | c_unit | ||
| 346 | ) | ||
| 347 | } | ||
| 348 | |||
| 349 | query6.toString() should "have a non-empty bounded set" in { | ||
| 350 | val w = Variable.create("w") | ||
| 351 | val int = Variable.create("int") | ||
| 352 | val program = new FilteringProgram(query6, List()) | ||
| 353 | program.bounded should contain theSameElementsAs List(w, int) | ||
| 354 | } | ||
| 355 | |||
| 356 | query7.toString() should "have a non-empty bounded set" in { | ||
| 357 | val w = Variable.create("w") | ||
| 358 | val z = Variable.create("z") | ||
| 359 | val u = Variable.create("u") | ||
| 360 | val strat_unit_name = Variable.create("strat_unit_name") | ||
| 361 | val wellbore = Variable.create("wellbore") | ||
| 362 | val cored_int = Variable.create("cored_int") | ||
| 363 | val c = Variable.create("c") | ||
| 364 | val sample_depth = Variable.create("sample_depth") | ||
| 365 | val p = Variable.create("p") | ||
| 366 | val top = Variable.create("top") | ||
| 367 | val bot = Variable.create("bot") | ||
| 368 | val program = new FilteringProgram(query7, List()) | ||
| 369 | program.bounded should contain theSameElementsAs List( | ||
| 370 | w, | ||
| 371 | z, | ||
| 372 | u, | ||
| 373 | strat_unit_name, | ||
| 374 | wellbore, | ||
| 375 | cored_int, | ||
| 376 | c, | ||
| 377 | sample_depth, | ||
| 378 | p, | ||
| 379 | top, | ||
| 380 | bot | ||
| 381 | ) | ||
| 382 | } | ||
| 307 | } | 383 | } |
