Unofficial Draft
Copyright © 2024 the document editors/authors. Text is available under the Creative Commons Attribution 4.0 International Public License; additional terms may apply.
In RDF Mapping Language [RML], you can use a logical target to specify how and to which target generated RDF should be exported. Logical targets are statically described, i.e. they are constant values throughout a mapping process. There is no scalable solution in RML to dynamically define a logical target based on source data.
One use case for dynamic targets is enabling fine-grained access control in Solid [Solid]. Solid is a specification that lets people and organizations store their data securely as resources on decentralized data stores called Pods. Each resource is identified by a Uniform Resource Identifier [URI]. The access to the data in a Pod is controlled on resource level, i.e. per URI. To allow for fine-grained access control, it might be needed to define URI patterns that are based on the source data.
This section is non-normative.
We assume readers have basic familiarity with [RDF] and [RML] concepts.
In this document, examples assume the following namespace prefix bindings unless otherwise stated:
Prefix | Namespace |
---|---|
rml: |
http://w3id.org/rml/ |
rmle: |
https://rml.io/ns/extensions# |
htv: |
http://www.w3.org/2011/http# |
ex: |
http://example.org/ |
foaf: |
http://xmlns.com/foaf/0.1/ |
The examples are contained in color-coded boxes. We use the Turtle syntax [Turtle] to write RDF.
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.
Logical targets are a set of RDF triples. Consequently, it is possible to define RML mapping rules to generate logical targets based on source data.
The generated logical targets are to be used during the same mapping process by which they are generated. For this purpose a self-referencing logical target (rmle:ThisMapping
) is introduced. This logical target indicates that the RDF triples, generated during the current mapping process and exported to rmle:ThisMapping
, have to be added to the RML mapping rules that are part of the current mapping process, as additional RML rules.
In RML, logical targets are identified with a constant blank node or named node, connected to a term map with the rml:logicalTarget
property.
To refer to a generated logical target, a logical target map (rmle:LogicalTargetMap
) is introduced, connected to a term map the rmle:logicalTargetMap
property.
A logical target map is a subclass of an expression map, which is evaluated on the logical iteration of the triples maps in which it is declared, to generate identifiers of logical targets during the mapping process.
It is the responsibility of the author of the mapping file to ensure that the identifiers generated by a logical target map refer to valid logical target descriptions.
With the addition of a self-referencing logical target (rmle:ThisMapping
) and a logical target map (rmle:LogicalTargetMap
), RML can export RDF triples to dynamically generated logical targets based on the source data.
In this example RDF triples are exported using dynamic logical targets: one resource per person described in the source data. More persons in the source data result in more (dynamically generated) targets, using the same RML mapping. We can use this dynamic logical target, for example, to store one resource per person in a Solid pod.