You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/section/graphmap.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Any [=subject map=] or [=predicate-object map=] MUST have zero or more associate
7
7
1. using the `rml:graphMap` property, whose value MUST be a [=graph map=],
8
8
2. using the [=constant shortcut property=]`rml:graph`.
9
9
10
-
[=Graph maps=] are themselves [=term maps=]. When [=RDF triples are generated=], the set of target graphs is determined by taking into account any [=graph maps=] associated with the [=subject map=] or [=predicate-object map=].
10
+
[=Graph maps=] are themselves [=term maps=]. When [=RDF triples=] are generated, the set of target graphs is determined by taking into account any [=graph maps=] associated with the [=subject map=] or [=predicate-object map=].
11
11
12
12
If a [=graph map=] generates the special IRI `rml:defaultGraph`, then the target graph is the [=default graph=] of the [=output dataset=].
The base IRI of the [=mapping document=] is used to resolve relative [=IRIs=] in the RML document following the specification of the Turtle serialisaiton.
3
-
4
-
## Base IRI for mapping rules
5
-
6
-
The [=base IRI=] of the [=Triples Map=] is used in resolving relative [=IRIs=] produced by the [=RML mapping=].
7
-
8
-
9
-
<preclass="ex-mapping nohighlight">
10
-
# Triples Map that has a declared base IRI
11
-
<#TriplesMap>
12
-
a rml:TriplesMap;
13
-
rml:baseIri <http://example.com/> .
14
-
</pre>
15
-
16
-
The [=base IRI=] MUST be a valid [=IRI=]. It SHOULD NOT contain question mark ("`?`") or hash ("`#`") characters and SHOULD end in a slash ("`/`") character.
17
-
18
-
To obtain an absolute [=IRI=] from a relative [=IRI=], the term generation rules of RML use simple string concatenation, rather than the more complex algorithm for resolution of relative URIs defined in Section 5.2 of [RFC3986]. This ensures that the original database value can be reconstructed from the generated absolute [=IRI=]. Both algorithms are equivalent if all of the following are true:
19
-
20
-
1. The base IRI does not contain question marks or hashes,
21
-
2. the base IRI ends in a slash,
22
-
3. the relative [=IRI=] does not start with a slash, and
23
-
4. the relative [=IRI=] does not contain any "`.`" or "`..`" path segments.
Copy file name to clipboardExpand all lines: spec/section/joinconditions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,9 @@ The following RDF triples are generated by the [=RML mapping=] above.
55
55
56
56
A <dfndata-lt="join">join condition</dfn> is represented by a resource that has exactly one value for each of the following two properties:
57
57
58
-
* a child map (`rml:childMap`) property, whose value is a [=child map=].<br> A <dfn>child map</dfn> (`rml:ChildMap`) is an [=expression map=] which MUST be evaluated against the [=logical source=]of the [=triples map=] that contains the [=referencing object map=], i.e. the current [=triples map=], or it should have a [=constant value=].
58
+
* a child map (`rml:childMap`) property, whose value is a [=child map=], or a [=constant-valued expression map=].<br> A <dfn>child map</dfn> (`rml:ChildMap`) is an [=expression map=] which MUST be evaluated against the [=child logical source=]. The <dfn>child logical source</dfn> is the [=logical source=]of the [=triples map=] that contains the [=referencing object map=], i.e. the current [=triples map=]..
59
59
60
-
* a parent map (`rml:parentMap`) property, whose value is a [=parent map=].<br> A <dfn>parent map</dfn> (`rml:ParentMap`) is an [=expression map=], which MUST be evaluated against the [=logical source=]of the [=referencing object map=]'s [=parent triples map=], i.e. the referenced [=triples map=], or it should have a [=constant value=].
60
+
* a parent map (`rml:parentMap`) property, whose value is a [=parent map=], or a [=constant-valued expression map=].<br> A <dfn>parent map</dfn> (`rml:ParentMap`) is an [=expression map=], which MUST be evaluated against the [=parent logical source=]. The <dfn>parent logical source</dfn> is the [=logical source=]of the [=referencing object map=]'s [=parent triples map=], i.e. the referenced [=triples map=].
61
61
62
62
If the the [=logical source=] of the [=triples map=] that contains the [=referencing object map=] and the [=logical source=] of the [=referencing object map=]'s [=parent triples map=] are not [=effectively equal=], then the referencing object map MUST have one or more [=join conditions=].
The <dfn>output dataset</dfn> of an [=RML mapping=] is an [=RDF dataset=] that contains the [=generated RDF triples=] for each of the [=triples maps=] of the [=RML mapping=].
3
+
The [=output dataset=] MUST NOT contain any other [=RDF triples=] or [=named graphs=] besides these.
4
+
However, [=RML processors=] MAY provide access to datasets that contain additional triples or graphs beyond those in the [=output dataset=], such as inferred triples or provenance information.
2
5
3
-
The <dfn>output dataset</dfn> of an [=RML mapping=]is an[=RDF dataset=]that contains the [=generated RDF triples=] for each of the [=triples maps=] of the [=RML mapping=]. The [=output dataset=] MUST NOT contain any other [=RDF triples=] or [=named graphs=] besides these. However, [=RML processors=] MAY provide access to datasets that contain additional triples or graphs beyond those in the [=output dataset=], such as inferred triples or provenance information.
4
-
5
-
Conforming [=RML processors=] MAY rename [=blank nodes=] when providing access to the [=output dataset=]. This means that client applications may see actual [=blank node identifiers=] that differ from those produced by the [=RML mapping=]. Client applications SHOULD NOT rely on the specific text of the blank node identifier for any purpose.
6
+
Conforming [=RML processors=]MAY rename[=blank nodes=]when providing access to the [=output dataset=].
7
+
This means that client applications may see actual [=blank node identifiers=] that differ from those produced by the [=RML mapping=].
8
+
Client applications SHOULD NOT rely on the specific text of the blank node identifier for any purpose.
6
9
7
10
<asideclass="note">
8
11
RDF syntaxes and RDF APIs generally represent [=blank nodes=] with [=blank node identifiers=]. But the characters allowed in [=blank node identifiers=] differ between syntaxes, and not all characters occurring in the values produced by a [=term map=] may be allowed, so a bijective mapping function from values to valid [=blank node identifiers=] may be required. The details of this mapping function are implementation-dependent, and [=RML processors=] may have to use different functions for different output syntaxes or access interfaces. Strings matching the regular expression `[a-zA-Z_][a-zA-Z_0-9-]*` are valid [=blank node identifiers=] in all W3C-recommended RDF syntaxes (as of this document's publication).
@@ -11,3 +14,137 @@ RDF syntaxes and RDF APIs generally represent [=blank nodes=] with [=blank node
11
14
<asideclass="note">
12
15
[=RDF datasets=] may contain empty [=named graphs=]. RML cannot generate such [=output datasets=].
13
16
</aside>
17
+
18
+
## The Generated RDF Triples of a Triples Map
19
+
20
+
21
+
This subsection describes the normative process by which [=RDF triples=] are generated from a [=Triples Map=]. This process contributes [=RDF triples=] to the [=output dataset=]. Each generated triple MUST be placed into one or more graphs of the output dataset.
22
+
23
+
The generated RDF triples are determined by the following algorithm. [=RML Processors=] MAY employ alternative implementations to compute the generated [=RDF triples=], provided that the resulting output dataset is semantically equivalent to the one obtained by this algorithm.
24
+
25
+
26
+
Let:
27
+
28
+
-**sm** be the [=subject map=] of the [=Triples Map=].
29
+
-**records** be the set of logical records obtained by evaluating the [=logical source=] of the [=Triples Map=] using its declared [=reference formulation=].
30
+
-**classes** be the set of class [=IRIs=] defined in **sm** (via `rml:class`).
31
+
-**sgm** be the set of [=graph maps=] attached to **sm**.
32
+
33
+
For each logical record **record** in **records**, apply the following steps:
34
+
35
+
1. Let [=subject=] be the [=RDF term=] resulting from applying **sm** to **record**.
36
+
2. Let **subject_graphs** be the set of [=RDF term=] resulting from applying each graph map in **sgm** to **record**.
37
+
3. For each class [=IRI=] in **classes**, add a triple to the [=output dataset=] as follows:
38
+
39
+
| Component | Value |
40
+
|------------|--------|
41
+
| Subject |**subject**|
42
+
| Predicate |`rdf:type`|
43
+
| Object | class IRI |
44
+
| Target graphs | If **sgm** is empty → `rml:defaultGraph`; otherwise → **subject_graphs**|
45
+
46
+
4. For each [=predicate-object map=] of the Triples Map, apply the following steps:
47
+
48
+
- Let **predicates** be the set of [=RDF terms=] resulting from applying each predicate map of the predicate-object map to **record**.
49
+
- Let **objects** be the set of [=RDF terms=] resulting from applying each object map (excluding [=referencing object maps=]) to **record**.
50
+
- Let **pogm** be the set of graph maps of the predicate-object map.
51
+
- Let **predicate_object_graphs** be the set of RDF terms resulting from applying each graph map in **pogm** to **record**.
52
+
53
+
For each possible combination `<predicate, object>`, where *predicate* ∈ **predicates** and *object* ∈ **objects**, add a triple to the output dataset as follows:
54
+
55
+
| Component | Value |
56
+
|------------|--------|
57
+
| Subject |**subject**|
58
+
| Predicate |*predicate*|
59
+
| Object |*object*|
60
+
| Target graphs | If both **sgm** and **pogm** are empty → `rml:defaultGraph`; otherwise → union(**subject_graphs**, **predicate_object_graphs**) |
61
+
62
+
63
+
For each [=referencing object map=] of a [=predicate-object map=] in the [=Triples Map=] apply the following steps:
64
+
65
+
- Let **psm** be the [=subject map=] of the [=parent Triples Map=] referenced by [=referencing object map=].
66
+
- Let **pogm** be the set of [=graph maps=] of the [=predicate-object map=].
67
+
- Let **joined_records** be the result of evaluating the [=join conditions=] defined by the [=referencing object map=], combining records from both the child and parent logical sources.
68
+
69
+
For each pair `<child_record, parent_record>` in **joined_records**, apply the following steps:
70
+
71
+
1. Let **subject** be the [=RDF terms=] resulting from applying **sm** to **child_record**.
72
+
2. Let **predicates** be the set of [=RDF terms=] resulting from applying each [=predicate map=] of the [=predicate-object map=] to **child_record**.
73
+
3. Let **object** be the [=RDF terms=] resulting from applying **psm** to **parent_record**.
74
+
4. Let **subject_graphs** be the set of RDF terms resulting from applying each graph map in **sgm** to **child_record**.
75
+
5. Let **predicate_object_graphs** be the set of RDF terms resulting from applying each graph map in **pogm** to **child_record**.
76
+
77
+
For each *predicate* in **predicates**, add a triple to the output dataset as follows:
78
+
79
+
| Component | Value |
80
+
|------------|--------|
81
+
| Subject |**subject**|
82
+
| Predicate |*predicate*|
83
+
| Object |**object**|
84
+
| Target graphs | If both **sgm** and **pogm** are empty → `rml:defaultGraph`; otherwise → union(**subject_graphs**, **predicate_object_graphs**) |
85
+
86
+
87
+
#### Adding Triples to the Output Dataset
88
+
89
+
“Add triples to the output dataset” is a process that takes the following inputs:
|**Subject**| an [=IRI=], a [=URI=], [=blank node=], or empty |
94
+
|**Predicate**| an [=IRI=], a [=URI=], or empty |
95
+
|**Object**| an [=RDF term=] or empty |
96
+
|**Target graphs**| a set of zero or more [=IRIs=]|
97
+
98
+
Execute the following steps:
99
+
100
+
1. If **Subject**, **Predicate**, or **Object** is empty, **abort** these steps.
101
+
2. Otherwise, generate an [=RDF triple=]`<Subject, Predicate, Object>`.
102
+
3. If the set of target graphs includes `rml:defaultGraph`, add the triple to the [=default graph=] of the [=output dataset=].
103
+
4. For each [=IRI=] in the set of target graphs not equal to `rml:defaultGraph`, add the triple to the [=named graph=] identified by that [=IRI=] in the [=output dataset=].
104
+
- If the [=named graph=] does not yet exist, create it.
105
+
5. RDF graphs MUST NOT contain duplicate triples. Adding multiple identical triples to the same graph has the same effect as adding it once.
106
+
6. The scope of blank nodes is limited to the output dataset being generated.
107
+
108
+
### Generated RDF Term of a Term Map
109
+
110
+
111
+
A [=term map=] defines how an [=RDF term=] is generated from the evaluation of a [=logical iteration=] over a [=logical source=].
112
+
The result of evaluating a term map for a given logical record can be one of the following:
113
+
114
+
-**Empty**, if any referenced value of the [=term map=] evaluates to a null, empty or missing value (each data format defines it in [RML-IO-Registry](https://w3id.org/kg-construct/rml-io-registry/));
115
+
-**An [=RDF term=]**, when evaluation produces a valid [=RDF term=]according to the [=term generation rules=];
116
+
-**A data error**, when a valid RDF term cannot be produced.
117
+
118
+
The [=generated RDF term=] of a [=term map=] for a given logical record is determined as follows:
119
+
120
+
1. If the term map is a **constant-valued term map**, then the generated RDF term is the term map’s constant value.
121
+
2. If the term map is a **reference-valued term map**, then the generated RDF term is determined by evaluating the [=reference value=] expression over the logical record and applying the *term generation rules* to the resulting value.
122
+
3. If the term map is a **template-valued term map**, then the generated RDF term is determined by evaluating the [=template value=] against the logical record and applying the *term generation rules* to the resulting value.
123
+
124
+
The <dfn>term generation rules</dfn> define how a concrete RDF term is generated from a given value:
125
+
126
+
1.**If the value is null, empty or missing**, then no RDF term is generated.
127
+
128
+
2.**If the term type is `rml:IRI`:**
129
+
1. Let *value* be the [=natural RDF lexical form=] corresponding to the evaluated value.
130
+
2. If *value* is a valid [absolute IRI](https://datatracker.ietf.org/doc/html/rfc3987#section-2.2)[[RFC3987]], then return an [=IRI=] generated from *value*.
131
+
3. Otherwise, prepend *value* with the [=base IRI=]. If the result is a valid [absolute IRI](https://datatracker.ietf.org/doc/html/rfc3987#section-2.2)[[RFC3987]], then return that [=IRI=].
132
+
4. Otherwise, raise a **data error**.
133
+
134
+
3.**If the term type is `rml:URI`:**
135
+
1. Let *value* be the [=natural RDF lexical form=] corresponding to the evaluated value.
136
+
2. If *value* is a valid [=absolute URI=][[RFC3986]], then return an [=URI=] generated from *value*.
137
+
3. Otherwise, prepend *value* with the [=base IRI=]. If the result is a valid [=absolute URI=][[RFC3986]], then return that [=URI=] .
138
+
4. Otherwise, raise a **data error**.
139
+
140
+
4.**If the term type is `rml:BlankNode`:**
141
+
- Return a blank node that is unique in the target graph.
142
+
143
+
5.**If the term type is `rml:Literal`:**
144
+
- If the term map declares a [=language tag=], then return a literal with that language tag and the natural RDF lexical form corresponding to *value*.
145
+
- Otherwise, if the term map declares a non-empty [=datatype=] different from the natural RDF datatype corresponding to the value’s implicit datatype, then return an RDF literal with the specified datatype.
146
+
- Otherwise, return the natural RDF literal corresponding to *value*.
0 commit comments