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

Commit 3e7ac19

Browse files
Clean-up in axioms.ForwardRuleReasonerOWLHorstTest
1 parent 84cc56f commit 3e7ac19

File tree

1 file changed

+43
-47
lines changed

1 file changed

+43
-47
lines changed

sansa-inference-spark/src/test/scala/net/sansa_stack/inference/spark/forwardchaining/axioms/ForwardRuleReasonerOWLHorstTest.scala

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class ForwardRuleReasonerOWLHorstTest extends FunSuite with SharedSparkContext w
465465
df.getOWLObjectPropertyAssertionAxiom(objProp01, indivA, indivB)))
466466
}
467467

468-
/** we exclude O10 because it needs more joins
468+
/**
469469
* O10:
470470
* Condition:
471471
* u p v
@@ -477,48 +477,47 @@ class ForwardRuleReasonerOWLHorstTest extends FunSuite with SharedSparkContext w
477477
* FIXME: Currently this does not include RDFS/OWL vocabulary like p being
478478
* rdf:type, rdfs:subClassOf, ...
479479
*/
480-
// test("Rule O10 should return correct results") {
481-
// val indivB = df.getOWLNamedIndividual(defaultPrefix + "indivB")
482-
// val indivD = df.getOWLNamedIndividual(defaultPrefix + "indivD")
483-
// val indivE = df.getOWLNamedIndividual(defaultPrefix + "indivE")
484-
// val indivG = df.getOWLNamedIndividual(defaultPrefix + "indivG")
485-
// val indivI = df.getOWLNamedIndividual(defaultPrefix + "indivI")
486-
// val indivJ = df.getOWLNamedIndividual(defaultPrefix + "indivJ")
487-
// val indivK = df.getOWLNamedIndividual(defaultPrefix + "indivK")
488-
// val indivL = df.getOWLNamedIndividual(defaultPrefix + "indivL")
489-
//
490-
//
491-
// val objProp01 = df.getOWLObjectProperty(defaultPrefix + "objProp01")
492-
// val objProp02 = df.getOWLObjectProperty(defaultPrefix + "objProp02")
493-
//
494-
// val input = getClass.getResource(resourcePath + "test_o10.owl").getPath
495-
//
496-
// val axiomsRDD = spark.owl(Syntax.FUNCTIONAL)(input)
497-
// val reasoner = new ForwardRuleReasonerOWLHorst(sc, sc.defaultMinPartitions)
498-
// val inferred: Seq[OWLAxiom] = reasoner.apply(axiomsRDD).collect()
499-
//
500-
// // Six axioms should be inferred:
501-
// // ObjectPropertyAssertion(:objProp01 :indivB :indivI)
502-
// // ObjectPropertyAssertion(:objProp01 :indivJ :indivD)
503-
// // ObjectPropertyAssertion(:objProp01 :indivB :indivD)
504-
// //
505-
// // ObjectPropertyAssertion(:objProp02 :indivE :indivK)
506-
// // ObjectPropertyAssertion(:objProp02 :indivL :indivG)
507-
// // ObjectPropertyAssertion(:objProp02 :indivE :indivG)
508-
// assert(inferred.size == 6)
509-
// assert(inferred.contains(
510-
// df.getOWLObjectPropertyAssertionAxiom(objProp01, indivB, indivI)))
511-
// assert(inferred.contains(
512-
// df.getOWLObjectPropertyAssertionAxiom(objProp01, indivJ, indivD)))
513-
// assert(inferred.contains(
514-
// df.getOWLObjectPropertyAssertionAxiom(objProp01, indivB, indivD)))
515-
// assert(inferred.contains(
516-
// df.getOWLObjectPropertyAssertionAxiom(objProp02, indivE, indivK)))
517-
// assert(inferred.contains(
518-
// df.getOWLObjectPropertyAssertionAxiom(objProp02, indivL, indivG)))
519-
// assert(inferred.contains(
520-
// df.getOWLObjectPropertyAssertionAxiom(objProp02, indivE, indivG)))
521-
// }
480+
ignore("Rule O10 should return correct results -- Rule O10 excluded because it needs more joins") {
481+
val indivB = df.getOWLNamedIndividual(defaultPrefix + "indivB")
482+
val indivD = df.getOWLNamedIndividual(defaultPrefix + "indivD")
483+
val indivE = df.getOWLNamedIndividual(defaultPrefix + "indivE")
484+
val indivG = df.getOWLNamedIndividual(defaultPrefix + "indivG")
485+
val indivI = df.getOWLNamedIndividual(defaultPrefix + "indivI")
486+
val indivJ = df.getOWLNamedIndividual(defaultPrefix + "indivJ")
487+
val indivK = df.getOWLNamedIndividual(defaultPrefix + "indivK")
488+
val indivL = df.getOWLNamedIndividual(defaultPrefix + "indivL")
489+
490+
val objProp01 = df.getOWLObjectProperty(defaultPrefix + "objProp01")
491+
val objProp02 = df.getOWLObjectProperty(defaultPrefix + "objProp02")
492+
493+
val input = getClass.getResource(resourcePath + "test_o10.owl").getPath
494+
495+
val axiomsRDD = spark.owl(Syntax.FUNCTIONAL)(input)
496+
val reasoner = new ForwardRuleReasonerOWLHorst(sc, sc.defaultMinPartitions)
497+
val inferred: Seq[OWLAxiom] = reasoner.apply(axiomsRDD).collect()
498+
499+
// Six axioms should be inferred:
500+
// ObjectPropertyAssertion(:objProp01 :indivB :indivI)
501+
// ObjectPropertyAssertion(:objProp01 :indivJ :indivD)
502+
// ObjectPropertyAssertion(:objProp01 :indivB :indivD)
503+
//
504+
// ObjectPropertyAssertion(:objProp02 :indivE :indivK)
505+
// ObjectPropertyAssertion(:objProp02 :indivL :indivG)
506+
// ObjectPropertyAssertion(:objProp02 :indivE :indivG)
507+
assert(inferred.size == 6)
508+
assert(inferred.contains(
509+
df.getOWLObjectPropertyAssertionAxiom(objProp01, indivB, indivI)))
510+
assert(inferred.contains(
511+
df.getOWLObjectPropertyAssertionAxiom(objProp01, indivJ, indivD)))
512+
assert(inferred.contains(
513+
df.getOWLObjectPropertyAssertionAxiom(objProp01, indivB, indivD)))
514+
assert(inferred.contains(
515+
df.getOWLObjectPropertyAssertionAxiom(objProp02, indivE, indivK)))
516+
assert(inferred.contains(
517+
df.getOWLObjectPropertyAssertionAxiom(objProp02, indivL, indivG)))
518+
assert(inferred.contains(
519+
df.getOWLObjectPropertyAssertionAxiom(objProp02, indivE, indivG)))
520+
}
522521

523522
/**
524523
* O11a:
@@ -745,10 +744,7 @@ class ForwardRuleReasonerOWLHorstTest extends FunSuite with SharedSparkContext w
745744
* Consequence:
746745
* u rdf:type v
747746
*
748-
* FIXME: for the test_o13.owl test data much more axioms are inferred
749-
* which seem wrong. Thus, this test should be adapted to do an exact count
750-
* on the inferred triples after the O13 rule was put into a separate method.
751-
* Right now these wrongly inferred axioms are not detected.
747+
* FIXME: Make this test check the exact count of inferred axioms
752748
*/
753749
test("Rule O13 should return correct results") {
754750
val cls01 = df.getOWLClass(defaultPrefix + "Cls01")

0 commit comments

Comments
 (0)