# Shape Constraints & Expressions — Interactive Learning Companion

Source: [Shape Constraints & Expressions — Interactive Learning Companion.html](Shape%20Constraints%20%26%20Expressions%20%E2%80%94%20Interactive%20Learning%20Companion.html)

## What you can learn

This companion teaches shape-based validation for RDF graphs, especially SHACL and ShEx.

You can learn how to:

- Understand the difference between a data graph and a shapes graph.
- Write SHACL node shapes and property shapes.
- Use targets such as `sh:targetClass`, `sh:targetNode`, `sh:targetSubjectsOf`, and `sh:targetObjectsOf`.
- Apply constraint components for cardinality, datatype, class membership, value ranges, string patterns, and node kind.
- Follow how a SHACL processor evaluates focus nodes and reports validation results.
- Compare SHACL and ShEx in syntax, targeting, recursion, standardization, and common use cases.
- Use property paths in SHACL, including inverse paths, sequence paths, and alternative paths.

## Interactive Activities

- Chapter topic explorer.
- Shape authoring sandbox.
- Validation simulator.
- Constraint component lab.
- SHACL vs ShEx comparison.
- SHACL challenge.
- Chapter quiz and cheat sheet.

## Best Used For

Use this after RDF/RDFS and before building production-quality knowledge graphs. It is the validation counterpart to ontology modelling.

## Key Takeaway

RDFS and OWL infer meaning; SHACL and ShEx check whether data conforms to expected shapes.
