This library serves two purposes.
Endpoint Definition. This specifies the class(es) of object(s) to be returned from an endpoint, along with information about ordering, and pagination.
$
. These values will
be populated at runtime with, in priority order:
Description forthcoming - available at /cql
The current set of SHACL profiles are tailored towards a set of known use cases for Prez.
Endpoint definition requirements:
The sh:targetClass is required due to a limitation with using sh:select
as a string. The sh:targetClass is required in
order to generate the Construct part of the generated SPARQL query. The sh:select subquery is only validated and
inserted - there is no programmatic extraction of components.
Properties of the focus objects to include/exclude are specified in a profile (see 3.1 -> 3.3).
Endpoint definition requirements:
Properties of the focus objects to include/exclude are specified in a profile (see 3.1 -> 3.3).
Endpoint definition requirements:
{"object": "http://my-object-uri"}
sh:targetNode "$object"
within the endpoint definition.Properties of the focus objects to include/exclude are specified in a profile (see 3.1 -> 3.3).
Includes all direct properties of a given focus node i.e. as a triple pattern <focus_uri> ?p ?o
There does not appear to be a relevant concept to borrow from SHACL that provides a mechanism to specify the retrieval of all predicate values from a given focus node. As this is a common use case when displaying data, for conciseness an extension property has been created:
http://example.com/shacl-extension#allPredicateValues
This property is used in place of specified path values under sh:path
, for example:
ex:OpenNodeShape
a sh:NodeShape ;
sh:property [
sh:path shext:allPredicateValues ;
] ;
Specifying properties to include implies all properties NOT specifically included are to be excluded.
Specified property paths can be included using SHACL Propety Paths
These can either be specified directly using sh:path
on a property shape, or multiple property paths can be specified
using sh:union
.
Profile requirement:
sh:path <property path expression>
Profile requirement:
sh:path ( sh:union ( <property path expression 1> <property path expression 2> ...) )
Specifying properties to exclude implies all direct properties NOT excluded are to be included.
Profile requirement:
NB: the current assumption is that a user can either include specified
Use of patterns in Prez endpoints
Although the SHACL vocabulary provides for ways to identify blank nodes, it does not appear there is a concise way to
specify that property chains including blank nodes should be included in the description of a focus node. For this
reason a custom property has been created. This property can be included on the nodeshape in a profile. The property is
http://example.com/shacl-extension#bnode-depth
. The range of the property is the number of blank node (object/subject
pairs) to follow. It is used as follows:
ex:OpenNodeShape
a sh:NodeShape ;
shext:bnode-depth 2 ;
.
Profile requirement:
sh:hasValue
for a single value or sh:in
with an RDF list for multiple values.The following table shows where different patterns are used in the proposed Prez endpoint definitions.
Endpoint | Endpoint Definition Pattern | Profile Definition Patterns |
---|---|---|
Catprez Catalog Listing | 1.2 List objects based on their class. | |
Catprez Catalog Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Catprez Resource Listing | 1.1 List objects based on their relationship to a container object. | 3.2.2 Include specified properties complex - multiple property paths |
Catprez Resource Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Vocprez Vocabulary Listing | 1.2 List objects based on their class. | |
Vocprez Vocabulary Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Vocprez Vocabulary Object Children Page 1/2 | 1.1 List objects based on their relationship to a container object. | 3.1 Include all properties of a focus node |
Vocprez Vocabulary Concept Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains 3.2.2 Include specified properties complex - multiple property paths |
Vocprez Collection Listing | 1.2 List objects based on their class. | |
Vocprez Collection Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Vocprez Collection Concept Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Spaceprez Dataset Listing | 1.2 List objects based on their class. | |
Spaceprez Dataset Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Spaceprez Feature Collection Listing | 1.1 List objects based on their relationship to a container object. | |
Spaceprez Feature Collection Object | 2.1 Describe an object given its URI | 3.3 Exclude specified properties of a focus node 3.4 Include blank node property chains |
Spaceprez Feature Listing | 1.1 List objects based on their relationship to a container object. | |
Spaceprez Feature Object | 2.1 Describe an object given its URI | 3.1 Include all properties of a focus node 3.4 Include blank node property chains |
Direct and Precise: sh:union and property paths allow direct referencing of specific properties, offering clear and granular control over displayed properties. They support SPARQL property path syntax for complex property relationships, and using sh:union, they can be specified together in a single RDF List.
- sh:inversePath
- sh:alternativePath
- sh:path
As these property paths are used in the profile, they are about the selection of properties after a set of focus nodes has been selected, as such the most common use cases are where a union of properties is required, rather than a logical and. sh:union can be mapped directly to SPARQL union, giving a clear and direct mapping from the profile to the SPARQL query.
As these are specified off of a property node, sh:minCount and sh:maxCount are also available, and can be used to indicate optional properties (sh:minCount 0) or to indicate that a property should be excluded (sh:maxCount 0).