No project description provided
Project description
RDFrame | SHACL profiles | CQL profiles
About
This library serves two purposes.
- Development of X -> SPARQL mappings, currently in two flavours
- SHACL interpreted for display, + endpoint definitions as RDF -> SPARQL
- CQL to SPARQL i.e. a developer would write Python to implement mappings a particular way and can have a tight REPL process including visualising examples.
- End user generation/specification of profiles which use the above. i.e. a user would only use the web interface to specify profiles or specific CQL queries to achieve a desired outcome.
RDFrame GUI components
Prez SHACL version
-
Runtime values - Data specified at runtime when using for example the URI of an object to retrieve information about; the URI of a container object from which member items are listed; limit and offset values for use in pagination.
-
Endpoint Definition. This specifies the class(es) of object(s) to be returned from an endpoint, along with information about ordering, and pagination.
- Where a sh:target / sh:select is used, variables can be defined in the sh:select using a
$
. These values will be populated at runtime with, in priority order:- Runtime values
- Default values specified with the endpoint definition. At present custom properties have been used to define default limit and offset values. This
- Where a sh:target / sh:select is used, variables can be defined in the sh:select using a
-
Profile Definition. Used to specifiy which properties of focus objects should be returned.
-
SPARQL query. This is generated from the above three inputs.
-
Example data. This is any RDF data which can be used to test or demonstrate use of the profile/endpoint definition.
-
Results. The result of applying the generated SPARQL query against the Example data.
CQL version
Description forthcoming - available at /cql
Patterns to address common use cases
The current set of SHACL profiles are tailored towards a set of known use cases for Prez.
1.1 List objects based on their relationship to a container object.
Endpoint definition requirements:
- The container object's URI, either specified as a runtime value.
- sh:target / sh:select statement
- sh:targetClass
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).
1.1.1 Add triples to the CONSTRUCT part of the query from the FOCUS NODE selection
Optionally, triples can be added to the CONSTRUCT part of the query from the FOCUS NODE selection. Triples to add can be defined via sh:rule / with sh:subject sh:predicate sh:object. If a Literal is used as the range for any of these (sh:subject sh:predicate sh:object), and the Literal starts with a '?', it will be translated into a variable in the generated SPARQL query. Note: by default only the CLASS of an object is included from the focus node selection. This is the only provided mechanism to provide additional triples from the SELECT subquery which is used for focus node selection. Properties for inclusion can be specified in the profile (via SHACL property shapes).
1.2 List objects based on their class.
Endpoint definition requirements:
- sh:targetClass - the class of object to be listed.
Properties of the focus objects to include/exclude are specified in a profile (see 3.1 -> 3.3).
2.1 Describe an object given its URI
Endpoint definition requirements:
- A runtime value for the object for example:
{"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).
3.1 Include all properties of a focus node
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 ;
] ;
3.2 Include specified properties of a focus node
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
.
3.2.1 Include specified properties simple - single property path
Profile requirement:
sh:path <property path expression>
3.2.2 Include specified properties complex - multiple property paths
Profile requirement:
-
sh:path ( sh:union ( <property path expression 1> <property path expression 2> ...) )
3.3 Exclude specified properties of a focus node
Specifying properties to exclude implies all direct properties NOT excluded are to be included.
Profile requirement:
- Property shapes includes a sh:maxCount of 0
NB: the current assumption is that a user can either include specified
Use of patterns in Prez endpoints
3.4 Include blank node property chains
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 ;
.
4.1 Include specific object values
Profile requirement:
- Specify object values using
sh:hasValue
for a single value orsh:in
with an RDF list for multiple values.
Use of patterns in Prez endpoints
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 |
Appendix - why use sh:union and property shapes?
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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rdframe-0.1.1.tar.gz
.
File metadata
- Download URL: rdframe-0.1.1.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.6 Linux/6.2.0-37-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e508518c64932abf05fe123f00aadc6f90d0d6fae446fd0b01cec0a40f49a7a |
|
MD5 | 565fbf69cfe66e5cc362a0c58208750e |
|
BLAKE2b-256 | 6d68d7611d50845062cb528f247ee69288ae1fbecc57f4944022ba732457ebd7 |
File details
Details for the file rdframe-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: rdframe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.6 Linux/6.2.0-37-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a8c54da40aa9b57d8e1785d85e2013343038d4ef1f9255d2bc7cc0996301361 |
|
MD5 | 66622b9771b930be92b0bceeaca26480 |
|
BLAKE2b-256 | 29a4f9e2bd082c27fa909bb1dcc6355ceb0708bcc90ecd2080c7aca50eb445e2 |