SHACL and OWL, part 2
The combination (26.03.2024)
Förderjahr 2023 / Stipendien Call #18 / ProjektID: 6794 / Projekt: Combining SHACL and Ontologies

In my first blog post, SHACL and OWL were introduced as separate, useful tools. Now we focus on the natural follow-up question: what happens when we consider both of them at the same time?

SHACL and OWL are two popular standards for handling data on the semantic web; one is used to express constraints to check quality of the data (SHACL), the other for encoding implicit knowledge (OWL). Combining the two means being able to enforce certain structures on your data, while keeping the option open to encode for instance concept hierarchies.

To make this more precise, we consider an example. We use the following data graph.

Datagraph: Linda owns a winged pet named Blue

So, our data consists of linda, an individual with the label ‘PetOwner’, who owns a pet, blu. She has the relationship hasWingedPet, who is a ‘Bird’.

We use SHACL to validate this graph, that is, we have a (or more) constraint(s):

The PetOwnerShape is defined as having an animal as pet

and a set of targets: PetOwnerShape(linda), i.e., we want to check whether we can find the PetOwnerShape-structure for linda. The required structure is an outgoing arrow labelled with hasPet. Moreover, the node reached by this arrow should contain the basic concept ‘Animal’. The graph above does not satisfy this requirement: there is no arrow with label hasPet leaving the node labelled with linda. Thus, in standard SHACL validation, this means that the above graph does not pass the test.

However, if we are allowed to reason using some reasoning rules, we see that the structure we have is close to the required structure. More precisely, if we would make precise that each ‘Bird’ must be an ‘Animal’ and that having a winged pet means having a pet,

Axioms: a bird is an animal, having a winged pet is having a pet

and we update the graph accordingly, we indeed find that the combination of the data graph and the axioms is enough to validate the shape graph.

Introducing new structures

In the above example we only considered relatively simple axioms and constraints for which it is straightforward what the combinations is supposed to mean: there is only one common sense way to materialise the implications of the axioms in the above data graph. That is, add that blue is an ‘Animal’, and add the relation hasPet to the arrow already decorated with hasWingedPet, and the validation result follows.

However, it is also possible to express the existence of whole structures in OWL: it may be stated that being a ‘Horse’ corresponds to having a hasParent outgoing arrow to a node labelled with ‘Horse’.

Axiom: a horse has a parent that is a horse

In that case there are different ways to materialise the implications of such an axiom: suppose we are given a ‘Horse’-labelled node, without an outgoing hasParent-edge. One of the possibilities to satisfy the described axiom is to add a hasParent-edge that starts and ends in this same node, meaning that this horse is its own parent, which would be weird in this example, but in general it is a possibility to be considered.

The other option is to add a fresh node that acts as the placeholder of the actual horse-parent of the ‘Horse’-labelled node. This means we do not declare which individual is the parent of the horse, but it allows us to reason about the existence of this horse. A drawback of the second method is that this freshly introduced blank node also has the label ‘Horse’ and no outgoing hasParent-edge either, as we did not introduce that yet, which means that we end up adding infinitely many blank nodes in a chain or eventually a horse that is its own parent.

To conclude, materialising facts is a promising and straightforward way to deal with the combination of SHACL and OWL as the example presented here shows. This seems to be an easy solution until you consider the more expressive features of SHACL and OWL. Knowing how to deal with the more complicated combinations of features is an open problem we try to solve in this research project.

Anouk Michelle Oudshoorn

Profile picture for user Anouk Michelle Oudshoorn
I am a PhD candidate in the Knowledge-Based Systems group at TU Wien, where I work under the supervision of Magdalena Ortiz. My project mainly focuses on providing logical foundations for SHACL (SHApe Constraint Language) and specifically on what it logically means to add OWL (Ontology Web Language) to the mix as well. This means that we are working on description logics and query answering techniques, as well as more general techniques used in the field of Knowledge Representation. In general, I am interested in logic in all its appearances, with extra emphasis on automata theory and fixed point logics.

Skills:

Logic
,
Formal Methods
CAPTCHA
Diese Frage dient der Überprüfung, ob Sie ein menschlicher Besucher sind und um automatisierten SPAM zu verhindern.
    Datenschutzinformation
    Der datenschutzrechtliche Verantwortliche (Internet Privatstiftung Austria - Internet Foundation Austria, Österreich) würde gerne mit folgenden Diensten Ihre personenbezogenen Daten verarbeiten. Zur Personalisierung können Technologien wie Cookies, LocalStorage usw. verwendet werden. Dies ist für die Nutzung der Website nicht notwendig, ermöglicht aber eine noch engere Interaktion mit Ihnen. Falls gewünscht, können Sie Ihre Einwilligung jederzeit via unserer Datenschutzerklärung anpassen oder widerrufen.