Skip to content
This repository was archived by the owner on Oct 8, 2020. It is now read-only.

Commit a4bdb1e

Browse files
Improved tests.
1 parent d4b7eeb commit a4bdb1e

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

sansa-inference-spark/src/test/scala/net/sansa_stack/inference/spark/conformance/RDFSConformanceTest.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package net.sansa_stack.inference.spark.conformance
22

3+
import java.io.File
4+
35
import net.sansa_stack.test.conformance.RDFSConformanceTestBase
46
import org.apache.jena.rdf.model.Model
5-
67
import net.sansa_stack.inference.data.RDFTriple
7-
import scala.collection.mutable
88

9+
import scala.collection.mutable
910
import net.sansa_stack.inference.spark.data.model.RDFGraph
1011
import net.sansa_stack.inference.spark.data.writer.RDFGraphWriter
1112

sansa-inference-tests/src/test/scala/net/sansa_stack/test/conformance/ConformanceTestBase.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import java.io.File
55
import org.apache.jena.rdf.model.Model
66
import org.junit.runner.RunWith
77
import net.sansa_stack.inference.data.RDFTriple
8-
import org.apache.jena.sparql.util.FmtUtils
8+
import org.apache.jena.shared.PrefixMapping
9+
import org.apache.jena.sparql.util.{FmtUtils, PrefixMapping2}
910
import org.scalatest.junit.JUnitRunner
1011
import org.scalatest.{BeforeAndAfterAll, FlatSpec}
1112

@@ -28,6 +29,11 @@ abstract class ConformanceTestBase extends FlatSpec with BeforeAndAfterAll {
2829
// the base directory of the test cases
2930
def testsCasesFolder: File
3031

32+
val pm = PrefixMapping.Factory.create()
33+
.setNsPrefix("ex", "http://www.example.org#")
34+
.setNsPrefix("", "http://www.example.org#")
35+
.withDefaultMappings(PrefixMapping.Standard)
36+
3137
// load the test cases
3238
val testCases = TestCases.loadTestCases(testsCasesFolder).filter(t => testCaseIds.contains(t.id))
3339

@@ -47,6 +53,7 @@ abstract class ConformanceTestBase extends FlatSpec with BeforeAndAfterAll {
4753

4854
// compute inferred graph
4955
val inferredModel = computeInferredModel(triples)
56+
inferredModel.setNsPrefixes(pm)
5057

5158
// remove the input triples such that we can compare only the conclusion graph
5259
inferredModel.remove(testCase.inputGraph)

sansa-inference-tests/src/test/scala/net/sansa_stack/test/conformance/OWLHorstConformanceTestBase.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class OWLHorstConformanceTestBase extends ConformanceTestBase {
1616

1717
behavior of "conformance of OWL Horst entailment rules"
1818

19-
override def testCaseIds = Set(
19+
override def testCaseIds: Set[String] = Set(
2020
"rdfbased-sem-rdfs-domain-cond",
2121
"rdfbased-sem-rdfs-range-cond",
2222
"rdfbased-sem-rdfs-subclass-cond",
@@ -29,15 +29,15 @@ abstract class OWLHorstConformanceTestBase extends ConformanceTestBase {
2929
"rdfbased-sem-char-symmetric-inst",
3030
"rdfbased-sem-char-transitive-inst",
3131
"rdfbased-sem-inv-inst",
32-
"rdfbased-sem-eqdis-eqclass-subclass-1",
32+
"rdfbased-sem-eqdis-eqclass-subclass-1", // the test works but returns more correct triples than specified
3333
"rdfbased-sem-eqdis-eqclass-subclass-2",
34-
"rdfbased-sem-eqdis-eqprop-subprop-1",
34+
"rdfbased-sem-eqdis-eqprop-subprop-1", // the test works but returns more correct triples than specified
3535
"rdfbased-sem-eqdis-eqprop-subprop-2",
3636
"rdfbased-sem-restrict-hasvalue-inst-obj",
3737
"rdfbased-sem-restrict-hasvalue-inst-subj",
3838
"rdfbased-sem-restrict-somevalues-inst-subj",
3939
"rdfbased-sem-restrict-allvalues-inst-obj"
4040
)
4141

42-
override def testsCasesFolder = new File(this.getClass.getClassLoader.getResource("data/conformance/owl2rl").getPath)
42+
override def testsCasesFolder: File = new File(this.getClass.getClassLoader.getResource("data/conformance/owl2rl").getPath)
4343
}

sansa-inference-tests/src/test/scala/net/sansa_stack/test/conformance/RDFSConformanceTestBase.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ abstract class RDFSConformanceTestBase extends ConformanceTestBase {
2424
"rdfbased-sem-rdfs-subprop-cond",
2525
"rdfbased-sem-rdfs-subprop-trans")
2626

27-
override def testsCasesFolder = new File(this.getClass.getClassLoader.getResource("data/conformance/rdfs").getPath)
27+
override def testsCasesFolder: File = new File(this.getClass.getClassLoader.getResource("data/conformance/rdfs").getPath)
2828
}

0 commit comments

Comments
 (0)