Most knowledge graph projects start with an OWL ontology — it defines the classes, properties, and relationships in your domain. But OWL alone doesn't validate data. You need SHACL shapes to enforce constraints.
Writing SHACL shapes by hand is tedious and error-prone. Every class needs a shape. Every property needs constraints. And when the ontology changes, the shapes must change too.
RDF Studio's OWL-to-SHACL translator solves this by automatically generating SHACL shapes from your OWL ontology. It reads your class hierarchy, property definitions, domain/range declarations, and cardinality restrictions — then produces a complete set of SHACL shapes ready for validation.
The translator maps OWL constructs to their SHACL equivalents:
owl:Class
sh:NodeShape
sh:targetClass
nwo:Employee
nws:EmployeeShape
rdfs:domain
sh:property
foaf:firstName domain Employee
rdfs:range
sh:datatype
range xsd:string
sh:datatype xsd:string
sh:class
range nwo:Employee
sh:class nwo:Employee
owl:FunctionalProperty
sh:maxCount 1
owl:minCardinality
sh:minCount
owl:maxCardinality
sh:maxCount
owl:cardinality
rdfs:comment
sh:description
rdfs:subClassOf
xsd:pattern
sh:pattern
owl:oneOf
sh:in
owl:disjointWith
sh:not [ sh:class ]
owl:complementOf
owl:disjointUnionOf
sh:not
sh:or
owl:hasSelf
sh:not [ sh:disjoint <property> ]
owl:hasKey
sh:minCount 1
owl:someValuesFrom
owl:allValuesFrom
sh:qualifiedMinCount 1
sh:qualifiedMinCount
sh:qualifiedMaxCount
sh:qualifiedValueShape
owl:unionOf
The translator finds all owl:Class instances in the ontology and creates a sh:NodeShape for each:
# OWL input nwo:Customer a owl:Class ; rdfs:label "Customer" ; rdfs:subClassOf nwo:Organization . # SHACL output nws:CustomerShape a sh:NodeShape ; sh:targetClass nwo:Customer ; sh:name "Customer" .
For each property, the translator checks rdfs:domain to determine which class shape owns it:
# OWL input nwo:website a owl:DatatypeProperty ; rdfs:domain nwo:Organization ; rdfs:range xsd:anyURI ; rdfs:comment "The organization's official website URL." . # SHACL output (on OrganizationShape) sh:property [ sh:path nwo:website ; sh:datatype xsd:anyURI ; sh:description "The organization's official website URL." ; sh:nodeKind sh:Literal ; ] .
Note two important mappings:
sh:nodeKind sh:Literal
OWL cardinality restrictions (via owl:Restriction) become SHACL count constraints:
owl:Restriction
# OWL input — Employee must have exactly one firstName nwo:Employee rdfs:subClassOf [ a owl:Restriction ; owl:onProperty foaf:firstName ; owl:cardinality 1 ] . # SHACL output sh:property [ sh:path foaf:firstName ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; ] .
Functional properties (owl:FunctionalProperty) are treated as sh:maxCount 1:
# OWL input nwo:birthDate a owl:DatatypeProperty, owl:FunctionalProperty ; rdfs:domain nwo:Employee ; rdfs:range xsd:dateTime . # SHACL output sh:property [ sh:path nwo:birthDate ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; ] .
When a property has multiple domains via owl:unionOf, the translator creates a property shape on each domain class:
# OWL input — companyName belongs to multiple classes nwo:companyName rdfs:domain [ owl:unionOf (nwo:Customer nwo:Supplier nwo:Shipper) ] . # SHACL output — property appears on ALL three shapes nws:CustomerShape sh:property [ sh:path nwo:companyName ; ... ] . nws:SupplierShape sh:property [ sh:path nwo:companyName ; ... ] . nws:ShipperShape sh:property [ sh:path nwo:companyName ; ... ] .
This is how the Northwind ontology shares companyName across Customer, Supplier and Shipper — using owl:unionOf instead of inheritance. Both patterns work; the translator handles both.
companyName
Properties defined on a superclass are copied down to every subclass shape. See the dedicated "Inheritance Flattening" article for details.
If sh:closed mode is enabled (on by default), each shape whose class has no subclasses gets sh:closed true; a parent shape such as EmployeeShape stays open so its subclasses' extra properties are not rejected. rdf:type is not ignored when the ontology file declares the rdf: prefix, as Northwind's does — it is then required through an annotation rule (a file that does not declare the prefix gets rdf:type set to Ignore, which lists it in sh:ignoredProperties):
sh:closed
sh:closed true
rdf:type
rdf:
sh:ignoredProperties
nws:CustomerShape a sh:NodeShape ; sh:closed true ; sh:property [ sh:path rdf:type ; sh:minCount 1 ] ; ...
This reports any property that is neither listed in the shape nor in its sh:ignoredProperties — as a warning with the dialog's default "Undeclared properties severity", as a violation if you set it to Violation. See the "Closed Shapes" article for when to use this.
Properties are assigned sh:order values alphabetically by local name, so the order is the same on every run regardless of how the ontology file is written. This controls display ordering in the SHACL UI:
sh:order
sh:property [ sh:path nwo:address ; sh:order 0 ; ... ] ; sh:property [ sh:path skos:altLabel ; sh:order 1 ; ... ] .
If the ontology uses xsd:pattern facets on datatype restrictions, they become sh:pattern:
# OWL input — postalCode must match a pattern owl:onProperty nwo:postalCode ; owl:allValuesFrom [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:pattern "^[0-9]{5} RDF Studio – SPARQL Editor, Ontology Manager & Knowledge Graph Explorer RDF Studio is a free semantic web IDE and training platform for browsing, querying, and editing RDF knowledge graphs. Home of the Northwind RDF use case with 35 executable SPARQL competency questions (use case stories) and query templates. Key Features Northwind RDF Use Case – A curated training dataset with full OWL ontology, sample data, and 35 executable SPARQL competency questions with business use case stories following EKGF methodology. Query Library – 70 queries spanning data exploration, CRUD operations, OWL axioms, taxonomy navigation, federated queries, and graph analytics — each with descriptions and use case context. Query Templates – Reusable SPARQL patterns for basic exploration, data quality checks, and graph analytics that work across any dataset. SPARQL Editor – Full SPARQL 1.1 query editor with syntax highlighting, autocomplete, PREFIX folding, query library, and execution history. Visual Ontology Editor – Create and edit OWL/RDFS classes, properties, and restrictions in an interactive graph editor with draft workflow and layout persistence. SHACL Shapes Editor & Validator – Browse, edit, auto-generate, and validate SHACL shapes with a validation dashboard and maturity scoring. Knowledge Graph Visualization – Interactive graph visualization with multiple layout engines, node expansion, and search. Faceted Search – Auto-generated faceted search interfaces from RDF/OWL ontologies with filters, sorting, and pagination. Traversal Query Builder – Cross-class query builder for navigating complex knowledge graph relationships. Taxonomy & Vocabulary Management – SKOS taxonomy browser, vocabulary import (FOAF, Dublin Core, RDFS), and hierarchical tree editing. Multi-Database Support – Connect to external SPARQL endpoints (GraphDB, Virtuoso, Stardog, Neptune, Fuseki). RDF Instance CRUD – Create, read, update, and delete RDF instances with SHACL validation and named graph targeting. Ontology Maturity Scoring – 4-dimension assessment of ontology quality with schema-data drift detection. Supported Standards RDF, RDFS, OWL, OWL 2, SPARQL 1.1, SHACL, SKOS, Turtle, N-Triples, JSON-LD, Dublin Core, FOAF, Schema.org Supported Triple Stores Oxigraph, GraphDB, Virtuoso, Stardog, Amazon Neptune, Apache Jena Fuseki, and any SPARQL 1.1 compatible endpoint. Technology Built with Python, React, and TypeScript. Created by M Barbieri quot; ] ) ] . # SHACL output sh:property [ sh:path nwo:postalCode ; sh:datatype xsd:string ; sh:pattern "^[0-9]{5} RDF Studio – SPARQL Editor, Ontology Manager & Knowledge Graph Explorer RDF Studio is a free semantic web IDE and training platform for browsing, querying, and editing RDF knowledge graphs. Home of the Northwind RDF use case with 35 executable SPARQL competency questions (use case stories) and query templates. Key Features Northwind RDF Use Case – A curated training dataset with full OWL ontology, sample data, and 35 executable SPARQL competency questions with business use case stories following EKGF methodology. Query Library – 70 queries spanning data exploration, CRUD operations, OWL axioms, taxonomy navigation, federated queries, and graph analytics — each with descriptions and use case context. Query Templates – Reusable SPARQL patterns for basic exploration, data quality checks, and graph analytics that work across any dataset. SPARQL Editor – Full SPARQL 1.1 query editor with syntax highlighting, autocomplete, PREFIX folding, query library, and execution history. Visual Ontology Editor – Create and edit OWL/RDFS classes, properties, and restrictions in an interactive graph editor with draft workflow and layout persistence. SHACL Shapes Editor & Validator – Browse, edit, auto-generate, and validate SHACL shapes with a validation dashboard and maturity scoring. Knowledge Graph Visualization – Interactive graph visualization with multiple layout engines, node expansion, and search. Faceted Search – Auto-generated faceted search interfaces from RDF/OWL ontologies with filters, sorting, and pagination. Traversal Query Builder – Cross-class query builder for navigating complex knowledge graph relationships. Taxonomy & Vocabulary Management – SKOS taxonomy browser, vocabulary import (FOAF, Dublin Core, RDFS), and hierarchical tree editing. Multi-Database Support – Connect to external SPARQL endpoints (GraphDB, Virtuoso, Stardog, Neptune, Fuseki). RDF Instance CRUD – Create, read, update, and delete RDF instances with SHACL validation and named graph targeting. Ontology Maturity Scoring – 4-dimension assessment of ontology quality with schema-data drift detection. Supported Standards RDF, RDFS, OWL, OWL 2, SPARQL 1.1, SHACL, SKOS, Turtle, N-Triples, JSON-LD, Dublin Core, FOAF, Schema.org Supported Triple Stores Oxigraph, GraphDB, Virtuoso, Stardog, Amazon Neptune, Apache Jena Fuseki, and any SPARQL 1.1 compatible endpoint. Technology Built with Python, React, and TypeScript. Created by M Barbieri quot; ; ] .
RDF Studio is a free semantic web IDE and training platform for browsing, querying, and editing RDF knowledge graphs. Home of the Northwind RDF use case with 35 executable SPARQL competency questions (use case stories) and query templates.
RDF, RDFS, OWL, OWL 2, SPARQL 1.1, SHACL, SKOS, Turtle, N-Triples, JSON-LD, Dublin Core, FOAF, Schema.org
Oxigraph, GraphDB, Virtuoso, Stardog, Amazon Neptune, Apache Jena Fuseki, and any SPARQL 1.1 compatible endpoint.
Built with Python, React, and TypeScript.
Created by M Barbieri
rdfs:domain :X
:XShape
owl:DatatypeProperty
rdfs:
rdfs:label
owl:inverseOf
sh:inversePath
owl:propertyChainAxiom
owl:TransitiveProperty
owl:SymmetricProperty
owl:equivalentClass
These limits are intentional — the translator produces shapes that are safe and predictable. You can always add more constraints manually.