Converting from OWL to SHACL, Part 2
Summary
This article, the second in a series, demonstrates converting an OWL ontology to SHACL by developing a hybrid system that combines both. It uses Jessica Talisman's NTWF (Named, Typed Workflow) ontology, a process flow ontology centered around a "Workflow" class, as a working example. The author details the OWL class and property definitions for `ntwf:Workflow` and `ntwf:WorkflowStep`, including properties like `ntwf:hasStep`, `ntwf:workflowStatus`, `ntwf:precedesStep`, and `ntwf:stepDescription`. The conversion then illustrates how to define SHACL Node Shapes (e.g., `shape:Workflow`, `shape:WorkflowStep`) and Property Shapes (e.g., `shape:Workflow_hasStep`, `shape:Workflow_WorkflowStatus`), highlighting the reverse linking model in SHACL compared to OWL. The article provides a full listing of the SHACL definitions and presents both valid and multiple invalid data examples, along with their corresponding SHACL validation reports, to demonstrate constraint checking.
Key takeaway
For AI Architects or Data Engineers designing or maintaining ontologies, consider a hybrid approach where SHACL augments existing OWL definitions. This strategy allows you to combine OWL's inferencing capabilities with SHACL's robust data validation, ensuring data quality and consistency while retaining semantic richness. You should prioritize defining SHACL constraints for critical data integrity checks, especially in systems where validation is paramount before inferencing, and use SHACL validation reports to identify and correct data anomalies.
Key insights
Hybrid OWL and SHACL systems augment validation with open-world dynamics, rather than replacing OWL.
Principles
- Augment OWL with SHACL for validation.
- SHACL models reverse RDFS/OWL linking.
- Property shapes create abstraction layers.
Method
Define OWL classes and properties, then create SHACL Node Shapes targeting OWL classes and Property Shapes for validation. Use `sh:path`, `sh:nodeKind`, `sh:class`, and cardinality constraints like `sh:minCount` and `sh:maxCount`.
In practice
- Use LLMs for initial OWL to SHACL conversion.
- Design SHACL schema first for validation-critical ontologies.
- Test SHACL against valid and invalid data.
Topics
- OWL
- SHACL
- Ontology Validation
- Workflow Ontologies
- Semantic Web
Best for: AI Architect, AI Engineer, Data Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by The Ontologist.