Skip to content

Commit e700c08

Browse files
committed
Added test for iterative reasoning
1 parent 000bcb8 commit e700c08

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

OWLSharp.Test/Reasoner/OWLReasonerTest.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,59 @@ public async Task ShouldEntailTransitiveObjectPropertiesAsync()
10851085
Assert.IsTrue(inferences.TrueForAll(inf => string.Equals(inf.RuleName, OWLTransitiveObjectPropertyEntailment.rulename)));
10861086
}
10871087

1088+
[TestMethod]
1089+
public async Task ShouldEntailWithIterativeBehaviorAsync()
1090+
{
1091+
OWLOntology ontology = new OWLOntology
1092+
{
1093+
DeclarationAxioms = [
1094+
new OWLDeclaration(new OWLClass(new RDFResource("http://xmlns.com/foaf/0.1/Person"))),
1095+
new OWLDeclaration(new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows"))),
1096+
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Mark"))),
1097+
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Stiv"))),
1098+
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/John"))),
1099+
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Jenny"))),
1100+
new OWLDeclaration(new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Helen")))
1101+
],
1102+
ObjectPropertyAxioms = [
1103+
new OWLTransitiveObjectProperty(new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows"))),
1104+
new OWLObjectPropertyDomain(
1105+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1106+
new OWLClass(new RDFResource("http://xmlns.com/foaf/0.1/Person"))),
1107+
new OWLObjectPropertyRange(
1108+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1109+
new OWLClass(new RDFResource("http://xmlns.com/foaf/0.1/Person")))
1110+
],
1111+
AssertionAxioms = [
1112+
new OWLObjectPropertyAssertion(
1113+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1114+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Mark")),
1115+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/John"))),
1116+
new OWLObjectPropertyAssertion(
1117+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1118+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/John")),
1119+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Stiv"))),
1120+
new OWLObjectPropertyAssertion(
1121+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1122+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Stiv")),
1123+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Jenny"))),
1124+
new OWLObjectPropertyAssertion(
1125+
new OWLObjectProperty(new RDFResource("http://xmlns.com/foaf/0.1/knows")),
1126+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Jenny")),
1127+
new OWLNamedIndividual(new RDFResource("http://xmlns.com/foaf/0.1/Helen")))
1128+
]
1129+
};
1130+
OWLReasoner reasoner = new OWLReasoner { Rules = [
1131+
OWLEnums.OWLReasonerRules.TransitiveObjectPropertyEntailment,
1132+
OWLEnums.OWLReasonerRules.ObjectPropertyDomainEntailment,
1133+
OWLEnums.OWLReasonerRules.ObjectPropertyRangeEntailment
1134+
] };
1135+
List<OWLInference> inferences = await reasoner.ApplyToOntologyAsync(ontology, true);
1136+
1137+
Assert.HasCount(11, inferences);
1138+
Assert.IsTrue(inferences.TrueForAll(inf => inf.Axiom.IsInference));
1139+
}
1140+
10881141
[TestMethod]
10891142
public async Task ShouldEntailOntologyRulesAsync()
10901143
{

0 commit comments

Comments
 (0)