mdesalvo/OWLSharp

Validation with cardinality restriction

Closed this issue · 3 comments

Hi Marco,

here are two simple examples of inconsistent ontology:
CardinalityTest1.ttl.txt
CardinalityTest0.ttl.txt

OWLValidator does not report the inconsistency:

OWLOntology ontology = OWLOntology.FromRDFGraph(RDFGraph.FromFile(RDFModelEnums.RDFFormats.Turtle, filepath));
OWLValidator validator = new();
foreach (OWLEnums.OWLValidatorRules rule in Enum.GetValues(typeof(OWLEnums.OWLValidatorRules)))
    validator.AddRule(rule);
OWLValidatorReport report = validator.ApplyToOntology(ontology);
Console.WriteLine(report.EvidencesCount); // writes 0 here

Hi constnick,
a fix for the reported situation is now available. Support for validating local cardinality constraints has been added in the ClassType rule.

Thanks and regards,
Marco

However, there is a little more complicated inference in other known reasoners.

For example, the following ontology is consistent:

ex:contains rdf:type owl:ObjectProperty .
ex:Item rdf:type owl:Class .
ex:item01 rdf:type ex:Item .
ex:item02 rdf:type ex:Item .

ex:iBox rdf:type [ rdf:type owl:Restriction ;
                   owl:onProperty ex:contains ;
                   owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                   owl:onClass ex:Item
                 ] ;
        ex:contains ex:item01 ,
                    ex:item02 .

In this case a reasoner infer that ex:item01 owl:sameAs ex:item02

The ontology become inconsistent only if assert the difference explicitly:
ex:item01 owl:differentFrom ex:item02 .

Hi constnick,
a fix for this kind of inconsistency to be driven by explicit owl:differentFrom is now available.
No updates to the reasoner (since this was a validation issue). It may come in next releases.

Thanks and regards,
Marco