Package: rdframe
RDFrame |SHACL profiles|CQL profilesAboutThis library serves two purposes.Development of X -> SPARQL mappings, currently in two flavoursSHACL interpreted for display, + endpoint definitions as RDF -> SPARQLCQLto SPARQLi.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 componentsPrez SHACL versionRuntime 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 valuesDefault values specified with the endpoint definition. At present custom properties have been used to define
default limit and offset values. ThisProfile 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 versionDescription forthcoming - available at/cqlPatterns to address common use casesThe current set of SHACL profiles are tailored towards a set of known use cases forPrez.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 statementsh:targetClassThe sh:targetClass is required due to a limitation with usingsh:selectas 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 selectionOptionally, 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 URIEndpoint 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 nodeIncludes all direct properties of a given focus node i.e. as a triple pattern<focus_uri> ?p ?oThere 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#allPredicateValuesThis property is used in place of specified path values undersh:path, for example:ex:OpenNodeShape
    a              sh:NodeShape ;
    sh:property [
        sh:path shext:allPredicateValues ;
    ] ;3.2 Include specified properties of a focus nodeSpecifying properties to include implies all properties NOT specifically included are to beexcluded.Specified property paths can be included usingSHACL Propety PathsThese can either be specified directly usingsh:pathon a property shape, or multiple property paths can be specified
usingsh:union.3.2.1 Include specified properties simple - single property pathProfile requirement:sh:path <property path expression>3.2.2 Include specified properties complex - multiple property pathsProfile requirement:sh:path ( sh:union ( <property path expression 1> <property path expression 2> ...) )3.3 Exclude specified properties of a focus nodeSpecifying properties to exclude implies alldirectproperties NOT excluded are to beincluded.Profile requirement:Property shapes includes a sh:maxCount of 0NB: the current assumption is that a user can either include specifiedUse of patterns in Prez endpoints3.4 Include blank node property chainsAlthough 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 ishttp://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 valuesProfile requirement:Specify object values usingsh:hasValuefor a single value orsh:inwith an RDF list for multiple values.Use of patterns in Prez endpointsThe following table shows where different patterns are used in the proposed Prez endpoint definitions.EndpointEndpoint Definition PatternProfile Definition PatternsCatprez Catalog Listing1.2 List objects based on their class.Catprez Catalog Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsCatprez Resource Listing1.1 List objects based on their relationship to a container object.3.2.2 Include specified properties complex - multiple property pathsCatprez Resource Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsVocprez Vocabulary Listing1.2 List objects based on their class.Vocprez Vocabulary Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsVocprez Vocabulary Object Children Page 1/21.1 List objects based on their relationship to a container object.3.1 Include all properties of a focus nodeVocprez Vocabulary Concept Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chains3.2.2 Include specified properties complex - multiple property pathsVocprez Collection Listing1.2 List objects based on their class.Vocprez Collection Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsVocprez Collection Concept Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsSpaceprez Dataset Listing1.2 List objects based on their class.Spaceprez Dataset Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsSpaceprez Feature Collection Listing1.1 List objects based on their relationship to a container object.Spaceprez Feature Collection Object2.1 Describe an object given its URI3.3 Exclude specified properties of a focus node3.4 Include blank node property chainsSpaceprez Feature Listing1.1 List objects based on their relationship to a container object.Spaceprez Feature Object2.1 Describe an object given its URI3.1 Include all properties of a focus node3.4 Include blank node property chainsAppendix - 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:inversePathsh:alternativePathsh:path
As these property paths are used in the profile, they are about the selection of propertiesafter a set of focus nodeshas 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).