Describes a linked data resource.
Constraints accepted by the resource shape factory.
The shapes a resource shape extends.
The members a resource carries, keyed by the name each is stated under.
A member a resource carries.
The member naming a resource.
The member typing a resource.
A member carrying values of its own.
Constraints accepted by the member factories.
Property constraints admitting explicit cardinality bounds.
Resolves the class the resources a shape describes belong to.
Resolves the classes the resources a shape describes belong to on top of their own.
Resolves the name of the member naming the resources a shape describes.
Resolves the name of the member typing the resources a shape describes.
Resolves the members the resources a shape describes carry.
Creates a resource shape.
Creates the member naming a resource.
Creates the member typing a resource.
Creates a member carrying any number of values.
Creates a member carrying at least one value.
Creates a member carrying at most one value.
Creates a member carrying exactly one value.
Creates a member carrying a stated number of values.
Resource shape types and operations.
Defines the shapes describing linked data resources and the members they carry, and provides the factories stating them and the accessors reading them. The resource factory states a shape, extending the shapes it is given and closed over the members declared for it; the member factories give each member the shape its values are drawn from and how many of them a resource may carry.
Resource shapes are closed: a validated resource carries only the members the shape declares, and any other field is rejected.
Every IRI a validated resource carries is absolute. Relative references are resolved against a base as client input is decoded, before validation sees them.
Defining resource shapes
Give each member a range and a cardinality:
The four named cardinalities cover
1..1,0..1,1..*and0..*; property states any other bounds:A member ranging over a dictionary stands apart from its cardinality: it carries the language map whole at every one, never in an array, and the bounds count the values of its other alternatives alone.
Each factory takes, after the range, the constraints the member carries beyond its cardinality, such as the predicate it maps to, the labels it carries, or whether it is serialised by default:
Linked and embedded resources
A member reaches another resource in one of two ways. A reference links a standalone resource, identified and managed in its own right; a resource shape included directly describes an embedded resource, carried inline with no identity of its own.
An embedded resource carries no id member: having no identity of its own, an identifier is rejected as a value is validated rather than as the shape is built, since an id-bearing embedded range reads exactly like an expanded captive target until a value is matched against it.
A shape reaching itself defers the range, breaking the definition cycle:
Inheritance
A shape extends the ones it is given first, carrying their members and constraints:
Constraints accumulate: a value is held to the constraints the extending shape states and to every one it inherits. An override tightens what it inherits and never relaxes it.
A member reaching a resource is refined by re-pointing it at a shape extending the inherited target: the refinement states what it adds alone, as the narrower target carries the inherited definition through its own parents, the classes it belongs to included, which every value the refined member admits is held to. A union-valued member is refined by dropping alternatives and tightening the ones it keeps, never by adding new ones.
Reading a resource off a shape
getShapeClass and getShapeClasses resolve the classes the resources a shape describes belong to, getShapeId and getShapeType the names their identifier and class are stated under, and getShapeProperties the members they carry. Each resolves a deferred shape and crosses a link through to the resource behind it, answering with nothing where the shape reaches no resource at all.
See