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

Commit f665825

Browse files
Added test for Forw.RuleReasonerOWLHorst rule O12c
1 parent 71c3dc0 commit f665825

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
Declaration(ObjectProperty(:objProp04))
10+
Declaration(ObjectProperty(:objProp05))
11+
12+
# should be detected as equivalent properties
13+
SubObjectPropertyOf(:objProp02 :objProp01)
14+
SubObjectPropertyOf(:objProp01 :objProp02)
15+
16+
# just random sub property axioms
17+
SubObjectPropertyOf(:objProp04 :objProp03)
18+
SubObjectPropertyOf(:objProp04 :objProp05)
19+
20+
Declaration(DataProperty(:dataProp01))
21+
Declaration(DataProperty(:dataProp02))
22+
Declaration(DataProperty(:dataProp03))
23+
Declaration(DataProperty(:dataProp04))
24+
Declaration(DataProperty(:dataProp05))
25+
26+
# should be detected as equivalent properties
27+
SubDataPropertyOf(:dataProp02 :dataProp01)
28+
SubDataPropertyOf(:dataProp01 :dataProp02)
29+
30+
# just random sub property axioms
31+
SubDataPropertyOf(:dataProp04 :dataProp03)
32+
SubDataPropertyOf(:dataProp04 :dataProp05)
33+
)

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,4 +705,35 @@ class ForwardRuleReasonerOWLHorstTest extends FunSuite with SharedSparkContext w
705705
// There is no EquivalentAnnotationProperties( ) construct --> annotation
706706
// property equivalence skipped
707707
}
708+
709+
/**
710+
* O12c:
711+
* Condition:
712+
* v owl:subPropertyOf w
713+
* w owl:subPropertyOf v
714+
* Consequence:
715+
* v rdfs:equivalentProperty w
716+
*/
717+
test("Rule O12c should return correct results") {
718+
val objProp01 = df.getOWLObjectProperty(defaultPrefix + "objProp01")
719+
val objProp02 = df.getOWLObjectProperty(defaultPrefix + "objProp02")
720+
721+
val dataProp01 = df.getOWLDataProperty(defaultPrefix + "dataProp01")
722+
val dataProp02 = df.getOWLDataProperty(defaultPrefix + "dataProp02")
723+
724+
val input = getClass.getResource(resourcePath + "test_o12c.owl").getPath
725+
726+
val axiomsRDD = spark.owl(Syntax.FUNCTIONAL)(input)
727+
val reasoner = new ForwardRuleReasonerOWLHorst(sc, sc.defaultMinPartitions)
728+
val inferred: Seq[OWLAxiom] = reasoner.apply(axiomsRDD).collect()
729+
730+
// Two axioms should be inferred:
731+
// EquivalentObjectProperties(:objProp01 :objProp02)
732+
// EquivalentDataProperties(:dataProp01 :dataProp02)
733+
assert(inferred.size == 2)
734+
assert(inferred.contains(
735+
df.getOWLEquivalentObjectPropertiesAxiom(objProp01, objProp02)))
736+
assert(inferred.contains(
737+
df.getOWLEquivalentDataPropertiesAxiom(dataProp01, dataProp02)))
738+
}
708739
}

0 commit comments

Comments
 (0)