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

Commit f52cf3b

Browse files
Added test for Forw.RuleReasonerOWLHorst O7a rule
1 parent cf5ea63 commit f52cf3b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Prefix(:=<http://ex.com/default#>)
2+
3+
Ontology(<http://ex.com/ont/sample1.owl>
4+
<http://ex.com/ont/release/123/sample1.owl>
5+
6+
Declaration(ObjectProperty(:objProp01))
7+
Declaration(ObjectProperty(:objProp02))
8+
Declaration(ObjectProperty(:objProp03))
9+
10+
InverseObjectProperties(:objProp01 :objProp02)
11+
12+
Declaration(NamedIndividual(:indivA))
13+
Declaration(NamedIndividual(:indivB))
14+
Declaration(NamedIndividual(:indivC))
15+
16+
ObjectPropertyAssertion(:objProp01 :indivA :indivB)
17+
ObjectPropertyAssertion(:objProp03 :indivB :indivC)
18+
)

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,30 @@ class ForwardRuleReasonerOWLHorstTest extends FunSuite with SharedSparkContext w
412412
assert(inferred.contains(df.getOWLObjectPropertyAssertionAxiom(objProp01, indivA, indivD)))
413413
assert(inferred.contains(df.getOWLObjectPropertyAssertionAxiom(objProp01, indivB, indivD)))
414414
}
415+
416+
/**
417+
* O7a:
418+
* Condition:
419+
* p owl:inverseOf q
420+
* v p w
421+
* Consequence:
422+
* w q v
423+
*/
424+
test("Rule O7a should return correct results") {
425+
val indivA = df.getOWLNamedIndividual(defaultPrefix + "indivA")
426+
val indivB = df.getOWLNamedIndividual(defaultPrefix + "indivB")
427+
val objProp02 = df.getOWLObjectProperty(defaultPrefix + "objProp02")
428+
429+
val input = getClass.getResource(resourcePath + "test_o7a.owl").getPath
430+
431+
val axiomsRDD = spark.owl(Syntax.FUNCTIONAL)(input)
432+
val reasoner = new ForwardRuleReasonerOWLHorst(sc, sc.defaultMinPartitions)
433+
val inferred: Seq[OWLAxiom] = reasoner.apply(axiomsRDD).collect()
434+
435+
// One axiom should be inferred:
436+
// ObjectPropertyAssertion(:objProp02 :indivB :indivA)
437+
assert(inferred.size == 1)
438+
assert(inferred.contains(
439+
df.getOWLObjectPropertyAssertionAxiom(objProp02, indivB, indivA)))
440+
}
415441
}

0 commit comments

Comments
 (0)