W3C First Public Working Draft
Copyright © 2025-2026 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
This specification describes Shapes Constraint Language (SHACL) User Interfaces.
This specification is published by the Data Shapes Working Group.
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C standards and drafts index.
This document was published by the Data Shapes Working Group as a First Public Working Draft using the Recommendation track.
Publication as a First Public Working Draft does not imply endorsement by W3C and its Members.
This is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to cite this document as other than a work in progress.
This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent that the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 18 August 2025 W3C Process Document.
This specification is part of the SHACL 1.2 family of specifications. See the SHACL 1.2 Overview for a more detailed introduction to them.
The specifications are as follows:
Implementers can partially check their level of conformance with the above specifications by successfully passing the test cases of the SHACL 1.2 test suite. Note, however, that passing all the tests in the test suite does not imply complete conformance to the specifications. It only implies that the implementation conforms to the aspects tested by the test suite.
Content.
This section is non-normative.
RDF applications commonly provide user interfaces that allow users to view and edit RDF resources. SHACL Core, together with vocabularies such as DASH, has often been used for this purpose by describing the structure, constraints, labels, and presentation-relevant metadata associated with RDF data.
SHACL User Interfaces are defined by this specification as a complementary vocabulary and rendering model for generating forms from SHACL shapes. It introduces UI-specific concepts and processing rules for determining widgets, resolving labels, and grouping and ordering the form components used to manage RDF resources.
Existing SHACL shapes and RDF data can be used to generate functional forms without additional SHACL UI annotations. SHACL UI annotations allow authors to provide more specific rendering information, enabling implementations to generate more tailored and consistent forms. The goal is to improve interoperability between SHACL-based form generation systems by defining common behavior across implementations.
This specification is intended for RDF application developers, RDF data editors, and authors of SHACL shapes who wish to generate forms for their data.
This section is non-normative.
The scope of this specification is limited to form rendering for viewing and editing RDF resources using SHACL Core concepts such as shapes, constraints, and property paths. It defines processing behavior for label and language resolution, field grouping and ordering, and widget determination for value nodes.
This specification does not define the visual styling of the user interface, including the styling of individual widgets or the form as a whole.
Although it addresses some presentation-adjacent aspects, such as field grouping through sh:PropertyGroup and label handling, it defines how these are processed rather than how they are displayed.
This specification also does not define broader application-level user interface features such as search, filtering, or navigation. It does not define a protocol for updating data stores, nor does it define form submission handling, validation behavior, or error handling. Accessibility requirements for implementations and rendered interfaces are also out of scope, though implementations are encouraged to follow relevant accessibility guidelines.
Link to definitions and concepts from other docs, such as SHACL Core, RDF 1.2, etc.
Terminology used throughout this specification is taken from several sources:
The SHACL & RDF terms include: binding , blank node , conformance , constraint , constraint component , data graph , datatype , failure , focus node , RDF graph , ill-formed , IRI , literal , local name , member , node , node shape , object , parameter , pre-binding , predicate , property path , property shape , RDF term , SHACL instance , SHACL list , SHACL subclass , shape , shapes graph , solution , subject , target , triple , validation , validation report , validation result , validator , value , value node .
sh:path, the latter of which is commonly used to label form elements.
The process includes language resolution and considers labeling-related annotations from the
shapes graph, data graph, application environment, and user preferences, to determine the best label for UI presentation.
Within this specification, the following namespace prefix definitions are used:
| Prefix | Namespace |
|---|---|
rdf: |
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
rdfs: |
http://www.w3.org/2000/01/rdf-schema# |
sh: |
http://www.w3.org/ns/shacl# |
shui: |
http://www.w3.org/ns/shacl-ui# |
xsd: |
http://www.w3.org/2001/XMLSchema# |
ex: |
http://example.com/ns# |
dct: |
http://purl.org/dc/terms/ |
Within this specification, the following JSON-LD context is used:
{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"sh": "http://www.w3.org/ns/shacl#",
"shui": "http://www.w3.org/ns/shacl-ui#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"ex": "http://example.com/ns#",
"dct": "http://purl.org/dc/terms/"
}
}
Note that the URI of the graph defining the SHACL vocabulary itself is
equivalent to the namespace above, i.e., it includes the
#. References to the SHACL vocabulary, e.g., via
owl:imports should include the #.
Throughout the specification, color-coded boxes containing RDF graphs in Turtle and JSON-LD will appear. The color and title of a box indicate whether it is a Shapes graph, a Data graph, or something else. The Turtle specification fragments use the prefix bindings given above. The JSON-LD specification fragments use the context given above. Only the Turtle specifications will have parts highlighted.
Grey boxes such as this include syntax rules that apply to the shapes graph.
true denotes the RDF term
"true"^^xsd:boolean. false denotes the RDF
term "false"^^xsd:boolean.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, and SHOULD in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
TODO: define conformance criteria for SHACL UI implementations.
At the time of writing, RDF 1.2 is a Working Draft. This section will be reviewed and updated when RDF 1.2 becomes a W3C Recommendation.
SHACL Renderers implementing this specification MUST support RDF 1.1 and SHOULD support RDF 1.2. When RDF 1.2 is supported, and unless stated otherwise in this document, implementations SHOULD prefer RDF 1.2 syntax and data model features over their RDF 1.1 counterparts.
This section is non-normative.
TODO: provide an introduction, use cases, and examples on SHACL UI basics.
Add conceptual model diagram and UI mockups to illustrate the concepts.
This section explains the UI concepts and how they work together.
A SHACL Renderer is software that processes SHACL shapes and data and dynamically generates a user-interface using one or more node UI components. Implementations may add supplementary UI elements, such as a submit button to save changes, controls to toggle between edit and view modes, selectors for focus node and node shape, or visualizations of validation report messages. They may also provide:
TODO: review SHACL Renderer definition, particularly the manual and automatic mode, now that we have the scoring system defined.
SHACL UI may operate in different modes - such as search or query - to support various UI use cases. Each may require different inputs to the traditional form use case.
This section focuses specifically on the form mode.
At a minimum, a SHACL UI processor requires the following inputs:
In form mode, SHACL UI uses the focus node as the primary resource to render, and the node shape as the root definition, applying its own constraints - as well as any other connected shapes - to generate the form.
In some scenarios, an application may allow the user to choose which node shape to apply to a form. To support this, the system needs a function that determines which node shapes are valid for, or targets a given focus node, based on the data and shapes graphs. This process may occur before supplying the required inputs to the SHACL UI processor.
Another possible input combination is to provide a data graph, a shapes graph, and a focus node, and let the SHACL UI processor determine the most suitable root node shape to apply to the form. However, this approach might not be feasible in practice, as it introduces significant complexity and places additional burden on UI implementors.
What other input combinations should we consider?
TODO: Describe the constraint collection/aggregation behaviour here for both Node and Property UI Component.
When generating user interfaces, it is often necessary to determine the most suitable user interface widget (e.g., a text input, a date picker, a checkbox) for a given value or SHACL constraint. To achieve this, SHACL UI defines a scoring system built on top of SHACL's validation process, providing a flexible and extensible mechanism that implementers and applications can use to determine which widgets are applicable.
Common use cases for the scoring system include:
xsd:date.sh:datatype constraint.The Select function determines which widget should be used for a given combination of a focus node and a property shape.
Inputs:
undefined.shui:WidgetScore instances that define how widgets are scored.shui:editor or shui:viewer.Output:
shui:Widget.Steps:
shui:WidgetAcceptMatcher instance AM with a matching shui:widget value.AM.shui:WidgetScore instances that define how widgets are scored.true, return the Widget IRI.false, continue with the next step. When a widget is not accepted it falls through to scoring.matches:
false.shui:WidgetScore instances that define how widgets are scored.matches
WI.shui:WidgetAcceptMatcher instance AM with a matching shui:widget value.WI.AM.shui:WidgetScore instances that define how widgets are scored.true, return WI.false, continue with the next iteration.matches, return undefined.The Select function MUST raise an error and terminate the algorithm in the following scenarios:
The validation function used by the matcher function to validate the focus node against a list of shape nodes.
Inputs:
Steps:
true.false.false.true.
If any SHACL validation fails due to malformed shapes, the validation function should log a warning and return false.
Shape validation errors should not cause the Matcher function to fail.
The matcher function used by the score function and the accept function to validate whether a widget score applies to a given focus node and shape node.
Inputs:
shui:WidgetAcceptMatcher.Steps:
shui:dataGraphShape property
is present, and no value for the shui:shapesGraphShape is present, return false.shui:shapesGraphShape property of matcher node as shape node.false, return false.true.shui:dataGraphShape property of matcher node as shape node.false, return false.true.The score function used to find the best widget or an ordered list of matches.
Inputs:
Steps:
results.shui:WidgetScore in the scoring graph, sorted by shui:score
in descending order and then lexicographically by the Unicode codepoint values of shui:widget.S of type shui:WidgetScore
shui:WidgetAcceptMatcher instance M with a matching shui:widget value.M as matcher node.true, and best is true, return the object with the following:
shui:widget of S.S.shui:score of S.true, record widget score by appending the object to results.results.The accept function used to check if a widget is applicable.
Inputs:
Steps:
shui:WidgetAcceptMatcher instance M with a matching shui:widget value.M exists, return true.M as matcher node.The widget with the highest score SHOULD be selected as the default widget from the Scoring Algorithm results. Implementations MAY allow users to switch to any widget included in the results.
Since multiple score entries may reference the same widget, a post-processing step SHOULD be performed to normalize the score results (for example, by aggregating or de-duplicating entries by widget) before presenting the widget choices to the user.
Widget Scores are malformed if they fail to validate against this score validation shapes graph.
TODO: consider moving this section under "SHACL UI Concepts".
The following sub-sections enumerate the currently defined instances of shui:Editor from the SHACL UI namespace.
Property shapes can explicitly specify the preferred editor for its values using shui:editor.
If no such value has been specified, the system should pick a suitable default viewer based on the
scoring system outlined for each widget.
The following sub-sections enumerate the currently defined instances of shui:Viewer from the SHACL UI namespace.
A property shape can have an explicitly specified preferred viewer for its values in shui:viewer.
If no such value has been specified, the system should pick a suitable default viewer based on the
scoring system outlined for each widget.
Most viewers render a single RDF value on the screen, typically as a single widget.
Form editors offer buttons to edit individual values and to add or delete values.
However, some viewers need to take more complete control over how multiple values of a property at a focus node are rendered.
The only example of such a viewer in SHACL UI is shui:ValueTableViewer, which displays
all values of a property as an HTML table.
In such cases, the notions of generic add and delete buttons do not apply.
Such viewers are called Multi Viewers and are declared instances of shui:MultiViewer instead of shui:SingleViewer.
The equivalent classes for editors are shui:MultiEditor and shui:SingleEditor.
TODO: This section may not be needed if we decide to fold in the use of different constraints for common form scenarios under the Patterns section.
SHACL Property Paths can be used to render a SHACL shape as a user interface. Property paths define how data values are accessed or modified relative to a focus node.
The following subsections outline the scenarios in which SHACL UI implementations are expected to support different kinds of property paths for viewing and editing operations.
In view mode, property paths are used to retrieve and display data values associated with a shape. A SHACL UI implementation must provide mechanisms to resolve these paths for visualization.
SHACL UI implementations MUST support both predicate paths and inverse paths in view mode. This ensures that values reachable via simple forward or inverse relationships can be displayed to the user.
The following example illustrates how predicate and inverse paths are used in view mode to access and display values, either directly from the focus node or through incoming relationships from other nodes.
SHACL UI implementations SHOULD support complex property paths in view mode. Complex paths include sequence paths, alternative paths, zero-or-more paths, one-or-more paths, and zero-or-one paths as defined in SHACL Core.
Support for complex paths is recommended, but can be left out in cases where the implementation aims to provide symmetry between view and edit modes, and complex paths are not supported in edit mode.
The following examples illustrate a sequence path and an alternative path, both of which may be used for richer data traversal in view mode.
A SHACL UI could display Alice’s city as "Ghent" by traversing the ex:address node,
and display the title of ex:book1 as “Linked Data Design”.
In edit mode, property paths determine how changes to data and the creation of new data are applied through the user interface.
SHACL UI implementations MUST support predicate paths and inverse paths in edit mode. This allows users to modify data linked by simple properties or inverse properties.
The following example illustrates how predicate and inverse paths can be used in edit mode to modify a person’s name and manage their membership in departments.
A SHACL UI might render a text input for foaf:name and a selector for the
departments.
Editing inverse paths requires the UI to ensure consistent updates on the related nodes.
SHACL UI implementations SHOULD support alternative paths in edit mode. This enables editing where a shape can constrain multiple potential properties, and the UI can allow users to choose which alternative to use when entering or modifying data.
When editing existing or newly created statements, the UI SHOULD provide a mechanism to update the
predicate to one of the enumerated paths in the sh:alternativePath list, but only if
those paths are either predicate paths or inverse paths. This restriction is necessary
because the object of sh:alternativePath is a SHACL list that may contain any valid
property path expression, including complex path types that are not generally feasible to edit
directly through a user interface.
Although redundant, SHACL permits nesting of sh:alternativePath expressions.
Such nesting simply flattens to a single list of predicate or inverse paths and does not alter the
effective set of alternatives available for editing.
The following example illustrates how an alternative path can be used in edit mode to allow a book's
title to be provided through either dct:title or rdfs:label.
A SHACL UI could show the existing title “Semantic Web Foundations” and allow the user to choose
whether
to edit it via dct:title or rdfs:label.
SHACL UI implementations MAY support the other complex paths (i.e., sequence paths, zero-or-more paths, one-or-more paths, and zero-or-one paths) in edit mode.
Implementers are encouraged to support these when their use cases require advanced data navigation or editing patterns, but such support is not mandatory as the complexity of editing through these paths may not be feasible in all user interface contexts.
Supporting complex property paths in edit mode introduces challenges related to ambiguity and the generation of intermediate data structures. Even when a path is used for view-only purposes, implementations must ensure that restrictions are in place to prevent ambiguous traversal results. SHACL property paths allow navigation across multiple steps in a graph, which can lead to situations where a single value is reachable through multiple distinct paths.
The following shape and data graph illustrate how a node can be reachable via a complex path expression, making editing operations ambiguous.
In this example, the node ex:screw can be reached from
ex:compounded-thing through two distinct paths:
ex:compounded-thing → ex:hasPart → ex:part-a → ex:hasPart → ex:screwex:compounded-thing → ex:hasPart → ex:part-b → ex:hasPart → ex:screwThis illustrates why editing along complex property paths is non-trivial: it can be unclear which intermediate nodes or triples correspond to a user’s intended modification.
UI literals — such as labels, descriptions, and other human-readable strings required for rendering a user interface — are selected based on language tags. This section defines how an application determines which language to use when multiple language-tagged literals are available for a given property.
When selecting a UI literal, the preferred language is determined according to the following order of priority. Each option itself provides an ordered list of languages where earlier entries are preferred over later ones:
sh:languageIn, when present in the applicable shapes graph context. This
specification extends the semantics of sh:languageIn giving the order of language tags in the
list a meaning. Implementations MUST prefer literals according to the order of the
sh:languageIn values.
Accept-Language HTTP header or the navigator.languages Web API. These SHOULD be
used as the default values when no application-level language preference has been configured.
Language tags are matched according to the basic filtering scheme defined in [RFC4647] section 3.3.1.
In particular, a language tag such as en-US SHOULD be considered a match for a preferred
language of en.
If no literal matching the preferred language is available, implementations MAY fall back to a literal in another available language (or without a declared language) or apply the label resolution fallback strategy as defined for the relevant context.
In this example, sh:languageIn declares French (fr) and English (en)
as accepted languages, in that order. A SHACL Renderer would prefer the French label "Nom"@fr
for the field label and "Alice"@fr for the value, unless the application has been configured to
use a different language.
Label resolution determines the most appropriate human-readable string to display for an RDF resource in a user interface. This section defines the algorithm for determining that label, considering annotations in the shapes graph, values in the data graph, and fallback strategies when no suitable label is found.
Label resolution is applied in two contexts:
sh:path.
To determine the label for a property UI component whose property shape has
sh:path pointing to a property path P, implementations MUST
apply the following steps in order, stopping at the first step that yields a result:
sh:name), select the best
matching value using language resolution. If a match is found, use that literal
as the label.
rdfs:label triples with subject P, select
the best matching value using language resolution. If a match is found, use
that literal as the label.
rdfs:label triples with subject P, select
the best matching value using language resolution. If a match is found, use
that literal as the label.
To determine the label for a single value node V, implementations MUST apply the following steps in order, stopping at the first step that yields a result:
sh:path is annotated with
shui:propertyRole shui:LabelRole, retrieve the values of that path from
the data graph for subject V. Select the best matching value using
language resolution. If a match is found, use that literal as the label.
rdfs:label) for V,
select the best matching value using language resolution. If a match is found, use
that literal as the label.
rdfs:label) for V,
select the best matching value using language resolution. If a match is found, use
that literal as the label.
To determine the label for an IRI, the local name L of the IRI SHOULD be used; this process is called local name resolution. Implementations SHOULD transform the local name into a human-friendly form, for example, by splitting camel case identifiers into words.
When rendering with a German language preference, the foaf:firstName field
label is resolved to "Vorname"@de from sh:name. The label
for the value node ex:acme is resolved to "ACME GmbH"@de
from rdfs:label in the data graph.
Since the property shape for dct:creator has no sh:name and
no rdfs:label is available for the dct:creator predicate,
the label falls back to the local name "creator", which a renderer might
display as "Creator" after capitalizing the first letter. The value node
ex:author1 has no rdfs:label in the data graph, so its label
falls back to the local name "author1". A renderer might further transform
this by splitting on the digit boundary and capitalizing, yielding "Author 1".
Add common UI form patterns here, e.g., error handling and validation, conditional rendering, etc. For each section, clearly state whether it's normative or informative and describe its use case.
TODO: consider removing the explicit "patterns" section and move these topics under SHACL UI
TODO: Add a pattern describing how applications choose the initial node shape and focus node for rendering. This pattern should explain that applications may nominate one or more root node shapes for entry-point forms.
Add a pattern for conditional or dynamic sub-forms. Consider how the following constraints would work here. sh:class, sh:node, sh:or, sh:qualifiedValueShape.
Add a pattern for select widgets. This should cover common sources for option lists: sh:in, class-based instance selection, SKOS concepts, node expressions, and implementation-provided query services. It should distinguish static enumerations from dynamic lookups. Some of the UI meetings have discussed using node expressions, dynamic SHACL, and SPARQL with the SERVICE clause.
This proposal allows someone to have federated references in their dataset and select/view those in a rich user interface.
Given that:
sh:inWe have:
ex:propertyCity
sh:path ex:city ;
sh:in [
sh:select """
select ?city where {
SERVICE <http://example.org/sparql> {
?city a ex:City .
}
}
""" ;
] . Notice:
A mechanism to fetch labels and possibly other properties of a resource.
ex:propertyCity
sh:path ex:city ;
sh:in ( ex:Amsterdam ex:Rotterdam ex:NewYork ) ;
shui:displayProvider ex:myDisplay ;
].
ex:myDisplay
a shui:DisplayProvider ;
sh:select """
select $value $label $depiction $description where {
$value rdfs:label $label .
optional { $value schema:depiction $depiction }
optional { $value schema:description $description }
}
""" .$value will be pre-bound with the value node of which the SHACL renderer needs to render a labelshui:EnumSelectEditor and the shui:AutocompleteEditor and other places where it might apply.shui:displayProvider is given the SHACL renderer may fall back to it's own label resolution algorithm.A mechanism to filter resources with a search term.
ex:propertyCity
sh:path ex:city ;
sh:in ( ex:Amsterdam ex:Rotterdam ex:NewYork ) ;
shui:resourceFilter ex:myFilter ;
].
ex:myFilter
a shui:ResourceFilter ;
sh:select """
select $value where {
$value rdfs:label ?label .
filter(contains(?label, $searchTerm))
}
""" .$value will be pre-bound with the value node of which the SHACL renderer needs to if it should be shown.$searchTerm will be bound with the search term the user is entering.shui:AutocompleteEditor and other places where it might apply.shui:resourceFilter is given the SHACL renderer may fall back to it's own resource filter. Which in turn can use the display provider if defined or the fallback label resolution algorithm.ex:propertyCity
sh:path ex:city ;
shui:displayProvider ex:myDisplay ;
shui:resourceFilter ex:myFilter ;
sh:in [
sh:select """
select ?city where {
SERVICE <http://example.org/sparql> {
?city a ex:City .
}
}
""" ;
] .
ex:myFilter
a shui:ResourceFilter ;
sh:select """
select $value where {
SERVICE <http://example.org/sparql> {
$value rdfs:label ?label .
$value ex:synonym ?synonym .
$value rdfs:comment ?description .
bind (concat(
?label, " ",
?synonym, " ",
?description
) as ?allText)
filter(contains(?allText, $searchTerm))
}
}
""" .
ex:myDisplay
a shui:DisplayProvider ;
sh:select """
select $value $label $depiction $description where {
SERVICE <http://example.org/sparql> {
$value rdfs:label $label .
FILTER(lang($label) = "en")
optional { $value schema:depiction $depiction }
optional { $value schema:description $description }
}
}
""" .bif:contains the end user could use that mechanism inside the shui:ResourceFilter select query.Currently, DASH forms provide ways to populate widgets such as the AutoCompleteEditor and ValueTableViewer by declaring shapes and constraints to describe the shape of the data. This works well, and SHACL UI should adopt this. However, this approach assumes all data resides in the data graph when in practice, most datasets are compartmentalised into named graphs for data management purposes. We could build on the work established in DASH forms by adding support for targeting named graphs when populating data for widgets.
SHACL UI could also enable data updates across multiple named graphs through a single form. Without named graph support in SHACL Core, however, this would be difficult to implement and may feel inconsistent. That said, widget-level named graph support could still function effectively. Because data retrieval for widgets is read-only (fetching data to populate them), any updates involving widget data would continue to be written only to the data graph.
Example: When a user is updating an address form, the drop-down list of Australian states and territories (code list) could be retrieved from a named graph separate from the main data graph. Selecting a state or territory from the drop-down would then write the chosen value to the data graph.
Is this a sensible proposal to support named graphs for widgets? And should we explore further on the idea of data updates working across multiple named graphs?
Related:
Add a pattern explaining how renderers can use sh:group, sh:order, and possibly implementation-specific layout annotations to organize property UI components.
In the SHACL 1.0 spec we have the chapter "2.3.2 Non-Validating Property Shape Characteristics" which contains sh:order and sh:group. I wonder if it would make sense to move these two to the shui namespace and deprecate them. Meanwhile we should recommend or require implementers of a spec compliant SHACL renderer to still support sh:order and sh:group. However going forward shui:order and shui:group would be the standard way to go.
Pro's
Cons
We need to think of who used these predicates and how they have been used.
Are there uses of sh:order and sh:group besides UI work?
Are they both used only in UI or is sh:group easier to move?
The section should explain that a single shapes graph may contain shapes used for different purposes, and implementations may need to distinguish validation shapes and UI rendering shapes.
We may need a more broader set of patterns documented for creating, updating, and deleting data via SHACL UI.
In our platform we have a property xy:defaultNS which stores the suggested default namespace for new resources in a given graph. It is attached to the home resource of the named graph (often an owl:Ontology). It is used whenever the user creates new instances which typically starts with entering the display label, from which the system will derive a suitable URI consisting of the label as local name, and the default namespace.
It would be great if such a property shui:defaultNamespace (datatype xsd:anyURI) could be added.
The pattern should describe how renderers may handle and display form errors, including validation errors and submission errors.
The task force discussed this topic and agreed that the SHACL UI document would benefit from a dedicated guidance section on form error handling for SHACL constraint violations, specifically on how implementations might map SHACL validation reports back to form fields.
This section should cover both client-side and server-side form validation, weighing the trade-offs of each approach. For instance, not all shapes are suitable for client-side validation: those containing SPARQL-based constraints require access to the full dataset, rather than the subset rendered in the form. For server-side validation, when either the data graph or the shapes graph contains blank nodes, implementations must use skolemisation whenever data crosses document boundaries, so that constraint violations in the validation report can be reliably traced back to the originating form field.
Below are some of the areas we intend to explore for the section:
SHACL UI should support a way to display alerts and messages in the form. These messages can be both positive and negative and potentially sourced via the validation report and provide a vocabulary to customise icons, styling, and colour of the message.
Discussion:
This sub-section should address the "Mapping validation results to the form" mentioned in ISSUE 823.
The pattern should describe how renderers may associate sh:ValidationResult entries with property UI components or node UI components, using sh:focusNode, sh:resultPath, sh:value, sh:sourceShape, sh:resultSeverity, and sh:resultMessage. It should avoid defining when validation runs or how an applications prevents malformed submissions.
The following subsections enumerate the currently built-in instances of shui:Editor from the
SHACL UI namespace.
40 if the property indicates its preference for shui:AutoCompleteEditor using a shui:editor statement and has a sh:class constraint, and the value is an IRI.10 if the property has a sh:nodeKind sh:IRI and a sh:class constraint.
Rendering:
An auto-complete field to enter the label of instances of the class specified for the property.
For example, if the sh:class of the property is ex:Country and the user starts
typing "Nig", then "Niger" and "Nigeria" would show up as possible choices.
ex:Person-bornIn
a sh:PropertyShape ;
sh:path ex:bornIn ;
sh:class ex:Country ;
...
Implementations may want to also support the combination of sh:class with sh:node
constraints to further narrow the set of valid values.
In this case, the component would filter out any instances of the class that do not conform to the specified node shape.
In the following example, the auto-complete would only show countries that have true as their value
for ex:sovereign.
ex:Person-bornIn
a sh:PropertyShape ;
sh:path ex:bornIn ;
sh:class ex:Country ;
sh:node [
sh:property [
sh:path ex:sovereign ;
sh:hasValue true ;
]
] ; ...
40 if the property indicates its preference for shui:BlankNodeEditor using a shui:editor statement, and the value is a blank node.1 if the value is a blank node.Rendering: A read-only editor that displays the blank node, similar to shui:BlankNodeViewer, yet allows the surrounding user interface to at least provide a delete button.
40 if the property indicates its preference for shui:BooleanEditor using a shui:editor
statement, and the value is an xsd:boolean literal.
20 if the value is an xsd:boolean literal.10 if the property has a sh:datatype xsd:boolean constraint.Rendering: A widget for editing boolean values, typically rendered as a checkbox, toggle switch, or select dropdown offering true and false, and, where the property is optional, optionally an additional control state representing the absence of a value.
The exact rendering of the BooleanEditor may vary between implementations depending on the complexity and
requirements of the use case. In particular, implementations should carefully distinguish between optional
and required boolean properties: for optional properties, the absence of a value is semantically different
from the value false, and an implementation may therefore render a select dropdown with three choices
(e.g., true, false, and none) where none represents no value; for required properties, where a value
must always be present, a checkbox or toggle switch may be appropriate. Implementations may choose the most
suitable rendering approach, provided this semantic distinction is preserved.
ex:Person-married
a sh:PropertyShape ;
sh:path ex:married ;
sh:datatype xsd:boolean ;
...
40 if the property indicates its preference for shui:DatePickerEditor using a shui:editor statement, and the value is an xsd:date literal.20 if the value is an xsd:date literal.10 if the property has a sh:datatype xsd:date constraint.Rendering: A calendar-like date picker.
ex:Person-dateOfBirth
a sh:PropertyShape ;
sh:path ex:dateOfBirth ;
sh:datatype xsd:date ;
...
40 if the property indicates its preference for shui:DateTimePickerEditor using a shui:editor statement, and the value is an xsd:dateTime literal.20 for xsd:dateTime literals.10 if the property has a sh:datatype xsd:dateTime constraint.Rendering: A calendar-like date picker including a time selector.
ex:Customer-lastVisitTime
a sh:PropertyShape ;
sh:path ex:lastVisitTime ;
sh:datatype xsd:dateTime ;
...
40 if the property indicates its preference for shui:DetailsEditor using a shui:editor statement, and the value is an IRI or a blank node.0 if the value is an IRI or a blank node.
Rendering:
Typically rendered as a nested form that allows editing the properties of the value node inline within the surrounding form.
The fields of the nested form are determined by the shape that applies to the value node.
This shape may be specified explicitly (e.g., via sh:node or other mechanisms that associate a shape with the value),
or implicitly via constraints such as sh:class.
Alternatively, nested fields may be defined directly on the surrounding property shape using sh:property.
When rendered as a nested form, the implementation recursively evaluates the applicable shape of the value node and renders its declared property shapes as sub-fields. Implementations may alternatively render the details in a separate dialog or dedicated view, provided that the editing semantics remain equivalent.
This editor is particularly useful for blank nodes or tightly coupled resources that are typically created and edited only in the context of their parent resource. However, it may also be used for IRIs referencing other resources.
ex:Product
a owl:Class ;
a sh:NodeShape ;
rdfs:label "Product" ;
rdfs:subClassOf owl:Thing ;
sh:property ex:Product-weight .
ex:Product-weight
a sh:PropertyShape ;
sh:path ex:weight ;
shui:editor shui:DetailsEditor ;
shui:viewer shui:DetailsViewer ;
sh:description "A blank node with a numeric field and a unit which is one of the QUDT mass units." ;
sh:maxCount 1 ;
sh:name "weight" ;
sh:node ex:ValueWithWeight ;
sh:nodeKind sh:BlankNode .
ex:ValueWithWeight
a sh:NodeShape ;
rdfs:label "Value with weight" ;
sh:property ex:ValueWithWeight-numericValue ;
sh:property ex:ValueWithWeight-unit .
ex:ValueWithWeight-numericValue
a sh:PropertyShape ;
sh:path ex:numericValue ;
sh:datatype xsd:decimal ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:name "numeric value" .
ex:ValueWithWeight-unit
a sh:PropertyShape ;
sh:path ex:unit ;
sh:class <http://qudt.org/schema/qudt/Unit> ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:name "unit" ;
sh:node [
rdfs:label "Permissible values must have quantity kind Mass." ;
sh:property [
sh:path <http://qudt.org/schema/qudt/hasQuantityKind> ;
sh:hasValue <http://qudt.org/vocab/quantitykind/Mass> ;
] ;
] .
This widget requires that the surrounding property (ex:weight, above) declares sh:nodeKind sh:BlankNode
and also has a sh:node constraint that points at a node shape that declares the properties that shall be editable.
40 if the property indicates its preference for shui:EnumSelectEditor using a shui:editor statement and has a sh:in constraint.30 if the property has a sh:in constraint.
Rendering:
A drop-down editor for enum fields (based on the sh:in list, in that order).
ex:AustralianAddressShape-addressRegion
a sh:PropertyShape ;
sh:path schema:addressRegion ;
sh:in ( "ACT" "NSW" "NT" "QLD" "SA" "TAS" "VIC" "WA" ) ;
...
40 if the property indicates its preference for shui:InstancesSelectEditor using a shui:editor statement and has a sh:class constraint, and the value is an IRI.0 if the property has a sh:class constraint.
Rendering:
A drop-down editor for all instances of the target class (based on sh:class of the property).
Typically only used for classes that have few instances.
ex:Person-homeCountry
a sh:PropertyShape ;
sh:path ex:homeCountry ;
sh:class ex:Country ;
shui:editor shui:InstancesSelectEditor ;
...
40 if the property indicates its preference for shui:IRIEditor using a shui:editor statement, and the value is an IRI.20 if the value is an IRI, and the property has a sh:nodeKind sh:IRI and no sh:class constraint.10 if the property has a sh:nodeKind sh:IRI constraint and no sh:class constraint.0 if the value is an IRI.
Rendering:
An input field to enter the IRI of a resource, e.g., as value of rdfs:seeAlso or to enter the URL of an image on the web.
ex:Thing-seeAlso
a sh:PropertyShape ;
sh:path rdfs:seeAlso ;
sh:nodeKind sh:IRI ;
shui:editor shui:IRIEditor ;
...
40 if the property indicates its preference for shui:NumberFieldEditor using a shui:editor
statement, and the value is an xsd:decimal, xsd:integer, xsd:double, or xsd:float literal.
20 if the value is an xsd:decimal, xsd:integer, xsd:double, or xsd:float literal.10 if the property has a sh:datatype xsd:decimal, xsd:integer, xsd:double, or xsd:float
constraint.
Rendering:
An input field to enter numeric values. The field should only allow entering valid numeric values according
to the specified datatype. If no sh:datatype constraint is specified, xsd:decimal is assumed to be the
default numeric datatype.
ex:Product-price
a sh:PropertyShape ;
sh:path ex:price ;
sh:datatype xsd:decimal ;
shui:editor shui:NumberFieldEditor ;
...
40 if the property indicates its preference for shui:RichTextEditor using a shui:editor statement, and the value is an rdf:HTML literal.20 if the value is an rdf:HTML literal.10 if the property has a sh:datatype rdf:HTML constraint.
Rendering:
A rich text editor to enter the lexical value of a literal and a drop-down to select language.
The selected language is stored in the HTML lang attribute of the root node in the HTML DOM tree.
ex:Concept-definition
a sh:PropertyShape ;
sh:path skos:definition ;
sh:datatype rdf:HTML ;
...
40 if the property indicates its preference for shui:SubClassEditor using a shui:editor statement and has a sh:rootClass constraint, and the value is an IRI.
Rendering:
This can be an auto-complete widget to select a class, a class hierarchy widget, or a combination thereof.
The permissible values are a given class or its subclasses, defaulting to rdfs:Resource.
This is typically used with sh:rootClass to allow the user to select a subclass of the given root class.
ex:Drug-impactedCell
a sh:PropertyShape ;
sh:path ex:impactedCell ;
sh:rootClass obo:CL_0000000 ;
shui:editor shui:SubClassEditor ;
...
-1 if the property has a sh:singleLine true constraint.40 if the property indicates its preference for shui:TextAreaEditor using a shui:editor statement.30 if the value is an xsd:string literal and the property has a sh:singleLine false constraint.20 if the value is an xsd:string literal.5 if the property has xsd:string among the permissible datatypes.0 if the property has a sh:singleLine false constraint.Rendering: A multi-line text area to enter the value of a literal.
ex:Country-description
a sh:PropertyShape ;
sh:path ex:description ;
sh:datatype xsd:string ;
sh:singleLine false ;
...
-1 if the property has a sh:singleLine true constraint.40 if the property indicates its preference for shui:TextAreaWithLangEditor using a shui:editor statement.30 if the value is an rdf:langString literal and the property has a sh:singleLine false constraint.20 if the value is an rdf:langString literal.5 if the property has rdf:langString among the permissible datatypes.1 if the property has xsd:string among the permissible datatypes.Rendering: A multi-line text area to enter the value of a literal and a drop-down to select a language.
ex:Country-description
a sh:PropertyShape ;
sh:path ex:description ;
sh:datatype rdf:langString ;
sh:singleLine false ;
...
-1 if the property has a sh:singleLine false constraint.40 if the property indicates its preference for shui:TextFieldEditor using a shui:editor statement.30 if the value is an xsd:string literal.10 if the property has xsd:string among the permissible datatypes.0 if the property has a custom datatype (not from xsd or rdf namespaces but for example geo:wktLiteral).Rendering: An input field to enter the value of a literal, without the ability to change language or datatype.
ex:Country-code
a sh:PropertyShape ;
sh:path ex:code ;
sh:datatype xsd:string ;
...
-1 if the property has a sh:singleLine false constraint.40 if the property indicates its preference for shui:TextFieldWithLangEditor using a shui:editor statement.30 if the value is an rdf:langString literal.10 if the property has rdf:langString among the permissible datatypes.1 if the property has xsd:string among the permissible datatypes.
Rendering:
A single-line input field to enter the value of a literal and a drop-down to select language,
which is mandatory unless xsd:string is among the permissible datatypes.
ex:Concept-prefLabel
a sh:PropertyShape ;
sh:path skos:prefLabel ;
sh:datatype rdf:langString ;
...
The following subsections enumerate the currently built-in instances of shui:Viewer from the SHACL UI namespace.
30 if the property indicates its preference for shui:BlankNodeViewer using a shui:viewer statement, and the value is a blank node.1 if the value is a blank node.Rendering: A human-readable label of the blank node. For example, if the blank node is an OWL restriction, then Manchester Syntax could be used. If the blank node is a SPIN RDF expression, then a SPARQL string could be produced. This rendering may include hyperlinks to other resources that can be reached from the blank node.
30 if the property indicates its preference for shui:DetailsViewer using a shui:viewer statement, and the value is an IRI or a blank node.0 if the value is an IRI or a blank node.
Rendering:
Displays the details of the value node as a nested, form-like structure within the surrounding view.
The properties shown are determined by the shape that applies to the value node.
This may be specified explicitly (e.g., via sh:node or other mechanisms that associate a shape with the value),
inferred via constraints such as sh:class,
or defined directly as nested sh:property declarations on the property shape.
When rendered as a nested display, the implementation recursively evaluates the applicable shape and presents its property shapes as structured subsections of the parent form. Implementations may vary in layout and visual styling, but the logical grouping and recursive traversal of the applicable shape SHOULD be preserved.
30 if the property indicates its preference for shui:HTMLViewer using a shui:viewer statement, and the value is an rdf:HTML or xsd:string literal.20 if the value is an rdf:HTML literal.
Rendering:
The literal parsed into HTML DOM elements.
Hyperlinks in the HTML may get redirected to select resources within the same application.
Also displays the language if the HTML has a lang attribute on its root DOM element.
30 if the property indicates its preference for shui:HyperlinkViewer using a shui:viewer statement, and the value is an xsd:anyURI or xsd:string literal.20 if the value is an xsd:anyURI literal.0 if the value is an xsd:string literal.Rendering: A clickable hyperlink to the specified URI/URL.
30 if the property indicates its preference for shui:ImageViewer using a shui:viewer statement.20 if the value is an IRI or a literal that has a case-insensitive recognized image file extension ending such as .png, .jpg, .jpeg, .gif, or .svg.
Rendering:
The image at the given URL, using <img> in HTML.
30 if the property indicates its preference for shui:IRIViewer using a shui:viewer statement, and the value is an IRI.1 if the value is an IRI.Rendering: As a hyperlink to that IRI. Also includes other ways of interacting with the IRI, such as opening a nested summary display.
30 if the property indicates its preference for shui:LabelViewer using a shui:viewer statement, and the value is an IRI.10 if the value is an IRI.
Rendering:
As a hyperlink to that URI based on the display label of the resource.
The display label is typically based on the most suitable rdfs:label or
skos:prefLabel for the current user, based on their language preferences.
Also includes other ways of interacting with the URI, such as opening a nested summary display.
30 if the property indicates its preference for shui:LangStringViewer using a shui:viewer statement.20 if the value is an rdf:langString literal.Rendering: As the text plus a language indicator (flag or language tag).
30 if the property indicates its preference for shui:LiteralViewer using a shui:viewer statement.1 if the value is a literal.Rendering: The lexical form of the value.
This is a Multi Viewer.
Score:30 if the property indicates its preference for shui:ValueTableViewer using a shui:viewer statement.
Rendering:
All values of the property at the focus node are rendered into a single (HTML) table that can be scrolled
and paged independently of the rest of the form.
Each value becomes one row.
The columns of the table are derived from the node shape specified using sh:node for the property,
in the order specified using sh:order.
In this example, we have used a sh:values rule to infer the values of the first column.
In this case, the values are simply pointing back to the focus node of each row, using sh:this.
Note that sh:targetClass is needed to get this inference correctly.
skos:Concept
sh:property ex:Concept-broader-inverse .
ex:Concept-broader-inverse
a sh:PropertyShape ;
sh:path [ sh:inversePath skos:broader ] ;
sh:group skos:HierarchicalRelationships ;
sh:name "narrower (table)" ;
shui:viewer shui:ValueTableViewer ;
sh:node ex:ConceptTableShape .
ex:ConceptTableShape
a sh:NodeShape ;
sh:targetClass skos:Concept ;
rdfs:comment "A node shape defining the columns for a shui:ValueTableViewer." ;
rdfs:label "Concept table shape" ;
sh:property ex:ConceptTableShape-self ;
sh:property ex:ConceptTableShape-type ;
sh:property ex:ConceptTableShape-altLabel .
ex:ConceptTableShape-self
a sh:PropertyShape ;
sh:path ex:self ;
sh:description "This column is used to render the (narrower) concept itself." ;
sh:name "narrower concept" ;
sh:nodeKind sh:IRI ;
sh:order "0"^^xsd:decimal ;
sh:values sh:this .
ex:ConceptTableShape-type
a sh:PropertyShape ;
sh:path rdf:type ;
sh:description "The second column shows the type of each value." ;
sh:name "type" ;
sh:nodeKind sh:IRI ;
sh:order "1"^^xsd:decimal .
ex:ConceptTableShape-altLabel
a sh:PropertyShape ;
sh:path skos:altLabel ;
sh:description "The third column shows the alternative labels." ;
sh:name "alt labels" ;
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
sh:order "2"^^xsd:decimal .
RDF resources commonly use properties to specify labels, descriptions, and other information needed for rendering, which user-interface engines depend on to render structured content. However, the vocabularies defining these properties vary across domains and communities. To ensure consistent interpretation, property shapes can be annotated with explicit roles for elements such as labels, descriptions, and other rendering properties.
This section introduces Property Roles for annotating SHACL property shapes, along with several built-in property roles defined in the SHUI namespace.
Property Roles are defined in the SHUI namespace and define the class shui:PropertyRole and the property shui:propertyRole.
Property roles can be annotated on property shapes by using the shui:propertyRole predicate and linking directly to a property role instance.
SHACL renderers may use such direct annotations to drive the way specific user-interface elements are displayed.
It is possible but not recommended to assign the same property role to multiple property shapes that apply to the same focus node using the direct role annotation form. When this is done, the resulting behavior is undefined.
The example below illustrates the common case where a property shape is directly annotated with shui:LabelRole. This informs user-interfaces that the shape's value nodes represent human-readable labels for resources.
This example illustrates the common case where a property shape is directly annotated with shui:LabelRole.
This informs user-interfaces that the shape's value nodes represent human-readable labels for resources.
When multiple predicates serve the same role in the data but require a defined precedence, the qualified role annotation should be used.
For property shapes annotated with the same role, user interfaces should prefer the shape with the smallest sh:order value. If multiple shapes
share the same role, they must be sorted and processed in ascending order of their sh:order values. In addition, any property shape
using a qualified role annotation is always preferred over a shape using a direct, unqualified role annotation.
The following example demonstrates two property shapes with qualified role annotations ordered by sh:order.
The qualified role annotation can also be expressed using triple annotations. SHACL Renderers that support RDF 1.2 should support the triple annotation syntax in addition to the RDF 1.1-compatible qualified role annotation syntax.
This example demonstrates two property shapes with qualified role annotations ordered by sh:order using RDF 1.2 triple annotations.
The following sections define the instances of shui:PropertyRole in the SHUI namespace. These property roles MUST be supported
by SHACL Renderers. Additional property roles may be defined in other namespaces.
The shui:LabelRole is used to identify properties whose values serve as human-readable display labels.
Common examples of display label predicates include rdfs:label, skos:prefLabel, and schema:name.
The class of roles that a property shape may take with respect to its focus nodes. It is not required, but recommended, that roles
defined in other namespaces subclass shui:PropertyRole.
The property used to annotate property shapes with roles. Its value is expected to be either an instance of shui:PropertyRole or a
resource that itself declares a shui:propertyRole and an associated sh:order value.
This section is non-normative.
TODO
This section is non-normative.
TODO
This section is non-normative.
TODO
This section is non-normative.
Many people contributed to this document, including members of the RDF Data Shapes Working Group.
This section enumerates the SHACL Core syntax elements and links to their corresponding SHACL UI representations.
| Section used | |
|---|---|
| Shapes | |
| sh:NodeShape | |
| sh:PropertyShape | |
| Constraint Components | |
| Value Type Constraint Components | |
| sh:class | |
| sh:datatype | |
| sh:nodeKind | |
| Cardinality Constraint Components | |
| sh:minCount | |
| sh:maxCount | |
| Value Range Constraint Components | |
| sh:minExclusive | |
| sh:minInclusive | |
| sh:maxExclusive | |
| sh:maxInclusive | |
| String-based Constraint Components | |
| sh:minLength | |
| sh:maxLength | |
| sh:pattern | |
| sh:singleLine | |
| sh:languageIn | |
| sh:uniqueLang | |
| List Constraint Components | |
| sh:memberShape | |
| sh:minListLength | |
| sh:maxListLength | |
| sh:uniqueMembers | |
| Property Pair Constraint Components | |
| sh:equals | |
| sh:disjoint | |
| sh:subsetOf | |
| sh:lessThan | |
| sh:lessThanOrEquals | |
| Logical Constraint Components | |
| sh:not | |
| sh:and | |
| sh:or | |
| sh:xone | |
| Shape-based Constraint Components | |
| sh:node | |
| sh:property | |
| sh:someValue | |
| sh:qualifiedValueShape | |
| sh:qualifiedMinCount | |
| sh:qualifiedMaxCount | |
| sh:reifierShape | |
| sh:reificationRequired | |
| Other Constraint Components | |
| sh:closed | |
| sh:ignoredProperties | |
| sh:hasValue | |
| sh:in | |
| sh:rootClass | |
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in: