Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a726f76
Merge pull request #2 from dachafra/spec
dachafra Oct 10, 2025
cbafd15
generated RDF triples dfn
dachafra Oct 10, 2025
a514906
generated RDF triples dfn
dachafra Oct 10, 2025
92ca9bd
using iteration and not record
dachafra Oct 13, 2025
146411a
adding language and datatype map in the output dataset
dachafra Oct 14, 2025
75d1dfa
adding multivalues in ouput
dachafra Oct 14, 2025
59717c0
Update spec/section/output.md
dachafra Nov 24, 2025
3c68cc3
Update spec/section/output.md
dachafra Nov 24, 2025
a1398af
Update spec/section/output.md
dachafra Nov 24, 2025
1788406
Update spec/section/output.md
dachafra Nov 24, 2025
3cf0a59
Update spec/section/output.md
dachafra Nov 24, 2025
96d71e2
Update spec/section/output.md
dachafra Nov 24, 2025
a144cc2
Update spec/section/output.md
dachafra Nov 24, 2025
8e22607
Update spec/section/output.md
dachafra Nov 24, 2025
5d761d8
Update spec/section/output.md
dachafra Nov 24, 2025
0144a9a
Update spec/section/output.md
dachafra Nov 24, 2025
5540336
Update spec/section/output.md
dachafra Nov 24, 2025
936275e
Update spec/section/output.md
dachafra Nov 24, 2025
e812d9b
Update spec/section/output.md
dachafra Nov 24, 2025
4bd9bdc
Update spec/section/output.md
dachafra Nov 24, 2025
0ede959
Update spec/section/output.md
dachafra Nov 24, 2025
52fa018
Update spec/section/output.md
dachafra Nov 24, 2025
d82676a
Update spec/section/output.md
dachafra Nov 24, 2025
b914b74
Update spec/section/output.md
dachafra Nov 24, 2025
482cd9a
Update spec/section/output.md
dachafra Nov 24, 2025
4d7b6b6
Update spec/section/output.md
dachafra Nov 24, 2025
123044f
Update spec/section/output.md
dachafra Nov 24, 2025
cab81ab
adding class IRI dfn
dachafra Nov 25, 2025
be8ba55
removing URI from 92-93
dachafra Nov 25, 2025
eb7c926
adding scope of BN
dachafra Nov 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spec/section/graphmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ However, in this example, RDF triples of the [=predicate=] `ex:title` are placed

</aside>

## Scope of Blank Nodes

[=Blank nodes=] in the [=output dataset=] are scoped to a single [=RDF graph=]. If the same [=blank node identifier=] occurs in multiple [=RDF triples=] that are in the same graph, then the triples will share the same blank node. If, however, the same blank node identifier occurs in multiple graphs, then a distinct blank node be created for each graph. An RML-generated blank node can never be shared by two triples in two different graphs.

This implies that triples generated from a single logical source row will have different subjects if the subjects are blank nodes and the triples are placed into different graphs.
5 changes: 3 additions & 2 deletions spec/section/mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ A <dfn>subject map</dfn> is a [=term map=]. It specifies a rule for generating t

## Typing Resources (rml:class)

A [=subject map=] MAY have one or more _**class IRIs**_. They are represented by the `rml:class` property.
A <dfn>class IRI</dfn> is an [=IRI=] that denotes an [=RDFS class=].
A [=subject map=] MAY have one or more [=class IRIs=]. They are represented by the `rml:class` property.
The values of the `rml:class` property MUST be [=IRIs=].
For each [=RDF term=] generated by the [=subject map=], [=RDF triples=] with [=predicate=] `rdf:type` and the class [=IRI=] as [=object=] will be generated.

<aside class="note">
Mappings where the class [=IRI=] is not constant,
but needs to be computed based on the contents of the database,
but needs to be computed based on the contents of the logical source,
can be achieved by defining a [=predicate-object map=] with predicate `rdf:type`
and a non-constant [=object map=].
</aside>
Expand Down
79 changes: 39 additions & 40 deletions spec/section/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@ RDF syntaxes and RDF APIs generally represent [=blank nodes=] with [=blank node

## The Generated RDF Triples of a Triples Map

This subsection describes the process of <dfn data-lt="generated RDF triples">generating RDF triples</dfn> 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.

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.

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.
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.


Let:

- **sm** be the [=subject map=] of the [=Triples Map=].
- **records** be the set of logical records obtained by evaluating the [=logical source=] of the [=Triples Map=] using its declared [=reference formulation=].
- **classes** be the set of class [=IRIs=] defined in **sm** (via `rml:class`).
- **iterations** be the set of [=logical iterations=] obtained by evaluating the [=logical source=] of the [=Triples Map=] using its declared [=reference formulation=].
- **classes** be the set of [=class IRIs=] defined in **sm** (via `rml:class`).
- **sgm** be the set of [=graph maps=] attached to **sm**.

For each logical record **record** in **records**, apply the following steps:
For each [=logical iteration=] **iteration** in **iterations**, apply the following steps:

1. Let [=subject=] be the [=RDF term=] resulting from applying **sm** to **record**.
2. Let **subject_graphs** be the set of [=RDF term=] resulting from applying each graph map in **sgm** to **record**.
3. For each class [=IRI=] in **classes**, add a triple to the [=output dataset=] as follows:
1. Let [=subject=] be the [=generated RDF term=] resulting from applying **sm** to **iteration**.
2. Let **subject_graphs** be the set of [=generated RDF terms=] resulting from applying each graph map in **sgm** to **iteration**.
3. For each [=class IRI=] in **classes**, add a triple to the [=output dataset=] as follows:

| Component | Value |
|------------|--------|
Expand All @@ -45,10 +44,10 @@ For each logical record **record** in **records**, apply the following steps:

4. For each [=predicate-object map=] of the Triples Map, apply the following steps:

- Let **predicates** be the set of [=RDF terms=] resulting from applying each predicate map of the predicate-object map to **record**.
- Let **objects** be the set of [=RDF terms=] resulting from applying each object map (excluding [=referencing object maps=]) to **record**.
- Let **predicates** be the set of [=generated RDF terms=] resulting from applying each predicate map of the predicate-object map to **iteration**.
- Let **objects** be the set of [=generated RDF terms=] resulting from applying each [=object map=] (excluding [=referencing object maps=]) to **iteration**.
- Let **pogm** be the set of graph maps of the predicate-object map.
- Let **predicate_object_graphs** be the set of RDF terms resulting from applying each graph map in **pogm** to **record**.
- Let **predicate_object_graphs** be the set of [=generated RDF terms=] resulting from applying each [=graph map=] in **pogm** to **iteration**.

For each possible combination `<predicate, object>`, where *predicate* ∈ **predicates** and *object* ∈ **objects**, add a triple to the output dataset as follows:

Expand All @@ -64,15 +63,15 @@ For each [=referencing object map=] of a [=predicate-object map=] in the [=Tripl

- Let **psm** be the [=subject map=] of the [=parent Triples Map=] referenced by [=referencing object map=].
- Let **pogm** be the set of [=graph maps=] of the [=predicate-object map=].
- 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.
- Let **joined_iterations** be the result of evaluating the [=join conditions=] defined by the [=referencing object map=], combining iterations from both the [=child logical source=] and [=parent logical sources=].

For each pair `<child_record, parent_record>` in **joined_records**, apply the following steps:
For each pair `<child_iteration, parent_iteration>` in **joined_iterations**, apply the following steps:

1. Let **subject** be the [=RDF terms=] resulting from applying **sm** to **child_record**.
2. Let **predicates** be the set of [=RDF terms=] resulting from applying each [=predicate map=] of the [=predicate-object map=] to **child_record**.
3. Let **object** be the [=RDF terms=] resulting from applying **psm** to **parent_record**.
4. Let **subject_graphs** be the set of RDF terms resulting from applying each graph map in **sgm** to **child_record**.
5. Let **predicate_object_graphs** be the set of RDF terms resulting from applying each graph map in **pogm** to **child_record**.
1. Let **subject** be the [=generated RDF term=] resulting from applying **sm** to **child_iteration**.
2. Let **predicates** be the set of [=generated RDF terms=] resulting from applying each [=predicate map=] of the [=predicate-object map=] to **child_iteration**.
3. Let **object** be the [=generated RDF term=] resulting from applying **psm** to **parent_iteration**.
4. Let **subject_graphs** be the set of [=generated RDF terms=] resulting from applying each [=graph map=] in **sgm** to **child_iteration**.
5. Let **predicate_object_graphs** be the set of [=generated RDF terms=] resulting from applying each graph map in **pogm** to **child_iteration**.

For each *predicate* in **predicates**, add a triple to the output dataset as follows:

Expand All @@ -88,40 +87,40 @@ For each *predicate* in **predicates**, add a triple to the output dataset as fo

“Add triples to the output dataset” is a process that takes the following inputs:

| Input | Description |
|--------|-------------------------------------------------|
| **Subject** | an [=IRI=], a [=URI=], [=blank node=], or empty |
| **Predicate** | an [=IRI=], a [=URI=], or empty |
| **Object** | an [=RDF term=] or empty |
| **Target graphs** | a set of zero or more [=IRIs=] |
| Input | Description |
|--------|---------------------------|
| **Subject** | an [=IRI=], [=blank node=], or empty |
| **Predicate** | an [=IRI=], or empty |
| **Object** | an [=RDF term=] or empty |
| **Target graphs** | a set of zero or more [=IRIs=] |

Execute the following steps:

1. If **Subject**, **Predicate**, or **Object** is empty, **abort** these steps.
2. Otherwise, generate an [=RDF triple=] `<Subject, Predicate, Object>`.
3. If the set of target graphs includes `rml:defaultGraph`, add the triple to the [=default graph=] of the [=output dataset=].
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=].
- If the [=named graph=] does not yet exist, create it.
5. RDF graphs MUST NOT contain duplicate triples. Adding multiple identical triples to the same graph has the same effect as adding it once.
6. The scope of blank nodes is limited to the output dataset being generated.
- If the [=named graph=] does not yet exist, create it.

RDF graphs MUST NOT contain duplicate triples. Adding multiple identical triples to the same graph has the same effect as adding it once. Also note the [[[#scope-of-blank-nodes]]].

### Generated RDF Term of a Term Map


A [=term map=] defines how an [=RDF term=] is generated from the evaluation of a [=logical iteration=] over a [=logical source=].
The result of evaluating a term map for a given logical record can be one of the following:
The result of evaluating a term map for a given [=logical iteration=] can be one of the following:

- **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/));
- **An [=RDF term=]**, when evaluation produces a valid [=RDF term=]according to the [=term generation rules=];
- **A data error**, when a valid RDF term cannot be produced.
- **Empty**, if the [=expression evaluation result=] 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/));
- **An [=RDF term=]**, when evaluation produces a valid [=RDF term=] according to the [=term generation rules=];
- **A [=data error=]**, when a valid RDF term cannot be produced.

The [=generated RDF term=] of a [=term map=] for a given logical record is determined as follows:
The [=generated RDF term=] of a [=term map=] for a given [=logical iteration=] is determined as follows:

1. If the term map is a **constant-valued term map**, then the generated RDF term is the term map’s constant value.
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.
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.
1. If the term map is a [=constant-valued term map=], then the generated RDF term is the term map’s [=constant value=].
2. If the term map is a [=reference-valued term map=], then the generated RDF term is determined by applying the [=term generation rules=] to its [=reference value=].
3. If the term map is a [=template-valued term map=], then the generated RDF term is determined by applying the [=term generation rules=] to the [=template value=].

The <dfn>term generation rules</dfn> define how a concrete RDF term is generated from a given value:
The <dfn>term generation rules</dfn> define how a concrete RDF term is generated from each value from an [=expression evaluation result=]:

1. **If the value is null, empty or missing**, then no RDF term is generated.

Expand All @@ -141,9 +140,9 @@ The <dfn>term generation rules</dfn> define how a concrete RDF term is generated
- Return a blank node that is unique in the target graph.

5. **If the term type is `rml:Literal`:**
- 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*.
- 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.
- Otherwise, return the natural RDF literal corresponding to *value*.
- If the term map declares a [=language map=], then evaluate the [=language map=] to obtain a [=language tag=] and return a literal with that [=language tag=] and the natural RDF lexical form corresponding to *value*.
- Otherwise, if the term map declares a [=datatype map=], then evaluate it to obtain a [=datatype-override RDF literal=] corresponding to *value* and the specified datatype.
- Otherwise, return the [=natural RDF literal=] corresponding to *value*.



Expand Down
5 changes: 5 additions & 0 deletions spec/section/terminology.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ This section lists some terms normatively defined in [[RDF11-CONCEPTS]] and used
- <dfn><a data-cite="RDF11-CONCEPTS#dfn-resource">resource</a></dfn>
- <dfn><a data-cite="RDF11-CONCEPTS#dfn-subject">subject</a></dfn>

## RDFS Terminology

This section lists some terms normatively defined in [[RDF11-SCHEMA]] and used in RML:

- <dfn><a data-cite="RDF11-schema#ch_class">RDFS class</a></dfn>

# XML Schema Definition Language (XSD) Terminology

Expand Down