1

I would like to validate RDF data (irrespective of the format), against an ontology that is constructed.

Can we solve this program programmatically (model checker) to identify the consistency of the dataset ontology?

For ex,

aaa <http://bbb/date> "2004"^^<http://www.w3.org/2001/XMLSchema#integer> .

The above triple has a property date, which requires a date in the object position. Assuming this constraint is mentioned in the ontology, I would like to verify this triple automatically without human intervention programmatically.

  • 2
    I think what you refer to as consistency checking is really constraints checking. Consistency checking tries to find **logical** errors. I.e., if the concepts A and B are disjoint then an individual that belongs to both A and B will lead to an logical inconsistency. What you referred to in your example is constraints checking for which you can [shex](https://shex.io/shex-primer/) or [shacl](https://www.w3.org/TR/shacl/). – Henriette Harmse Jul 26 '21 at 12:18
  • Henriette, the original poster asks about consistency and gives an example that is presumably showing a **logical** inconsistency (assuming there is an ontology that says the range of `` is `xsd:date`). So I see no reason to tell the OP that they are not asking the question they want. – Antoine Zimmermann Jul 28 '21 at 08:08

2 Answers2

1

It's important to note that the datatype specified in the ontology is not a constraint. Instead, when a datatype is specified in an OWL definition, it's a statement about the range of that datatype. This can be used by reasoning engines to make inferences about data in the graph. This is also true for domain and range declarations. If you say that the range of the relation hasBoyfriend is a schema:Person but add a relation to the graph that says Person_A hasBoyfriend Dog_A, the inference engine will create a new predicate that says Dog_A is both a dog and schema:Person.

As Henriette mentioned in the comments, for consistency checking you'll need to use a separate but related technology: either shex or shacl. Make sure that whichever stack you're using supports one or the other before giving it a go!

Thomas
  • 720
  • 9
  • 22
  • "for consistency checking" -> you mean "for constraint checking". The original poster is perhaps asking about consistency checking specifically. After all, this is what the OP said, and the example is clearly illustrating a logical inconsistency problem. We should be answering the question asked, not the question we want to be asked. – Antoine Zimmermann Jul 28 '21 at 08:11
  • Thomas, one may use SHACL or ShEx for a bunch of things, but the asker is requesting for a way to check consitency of an RDF graph with respect to an ontology. You can advise the asker to use a shape schema instead of an ontology, but it is not answering the question asked. It is possible that the asker is mistankingly using the wrong terms, in which case it is good to do what Henriette did, namely commenting to ensure the OP can clarify their need. Then, maybe, your answer will be on point. – Antoine Zimmermann Jul 29 '21 at 22:30
0

You can test consistency of RDF data wrt an ontology by combining the ontology and the data together and using a reasoner on this. There are different approaches for this: load everything into the reasoner's data structure and test for consistency from there, or use a database where you materialise inferred data and look for contradicting facts.

For instance, if you have an ontology that says:

onto:date  a  owl:DatatypeProperty;
  rdfs:range  xsd:date .

and your data has:

ex:aaa  onto:date  "2004"^^xsd:integer .

then the merge of the two will be inconsistent according to an OWL reasoner, or even an RDFS reasoner that supports datatypes xsd:date and xsd:integer. If you are using materialisation, the contradiction becomes apparent because the data entails:

ex:aaa  onto:date  _:bnode .
_:bnode  rdf:type  xsd:integer .

and the combination of this data with the ontology entails:

_:bnode  rdf:type  xsd:date .

We thus have a node that belongs to two incompatible datatypes, which is a direct contradiction.

If you know you are only dealing with certain kinds of inconsistencies, such as datatype inconsistencies, then using a full-fledged reasoner is not the most efficient option. Also, from your question, it is not clear whether you want to test logical consistency or some kind of integrity constraints, because the case of datatypes is special. A lot of people confuse axioms and constraints. This is why both Henriette Hamrse in her comment, and Thomas in his answer are referring to ShEx and SHACL, which would be much more appropriate for testing constraints.

Antoine Zimmermann
  • 5,314
  • 18
  • 36
  • Thanks for the answer. I am not only concerned about datatype inconsistency. But many more. From your answer seems like a better option is to go for the Apache Jena framework, which has multiple reasoners built-in. I have read something related to Kripke structures (model checker) in research articles. I wanted to know about that as well. I am not interested in SHACL or any other constraint language. – Aparna Bhat Aug 02 '21 at 09:48