Skip to content

Commit

Permalink
adding graphmap section
Browse files Browse the repository at this point in the history
  • Loading branch information
dachafra committed Jan 23, 2025
1 parent b56b79e commit b980895
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions spec/docs/graphmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Assigning Triples to Named Graphs

Each triple generated from an [=RML mapping=]() is placed into one or more graphs of the [=output dataset=](). Possible target graphs are the unnamed [=default graph=](), the [=IRI=]()-named [=named graphs=](), and [=blank node=]() named [=named graphs=]()

Any [=subject map=]() or [=predicate-object=]() map MAY have one or more associated graph maps. They are specified in one of two ways:

1. using the rml:graphMap property, whose value MUST be a [=graph map=](),
2. using the [=constant shortcut property=]() rml:graph.

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.

If a [=graph map=]() generates the special IRI rml:defaultGraph, then the target graph is the [=default graph=]() of the [=output dataset=]().

In the following [=subject map=]() example, all generated RDF triples will be stored in the named graph ex:DepartmentGraph.

```turtle
[] rml:subjectMap [
rml:template "http://data.example.com/department/{DEPTNO}";
rml:graphMap [ rml:constant ex:DepartmentGraph ];
].
```
This is equivalent to the following example, which uses a [=constant shortcut property=]():

```turtle
[] rml:subjectMap [
rml:template "http://data.example.com/department/{DEPTNO}";
rml:graph ex:DepartmentGraph;
].
```
In the following example, RDF triples are placed into [=IRI=]()-named [=named graphs=]() according to the job title of employees:
```turtle
[] rml:subjectMap [
rml:template "http://data.example.com/employee/{EMPNO}";
rml:graphMap [ rml:template "http://data.example.com/jobgraph/{JOB}" ];
].
```

However, in this example, RDF triples of the [=predicate-object=]() `ex:name` are placed into a [=blank node=]() named [=named graphs=]() according to the job title of employees:
```turtle
[] rml:subjectMap [
rml:template "http://data.example.com/employee/{EMPNO}";
];
rml:predicateObjectMap [
rml:predicate ex:name;
rml:objectMap [ rml:reference "name"; ];
rml:graphMap [
rml:reference "JOB"
rml:termType rr:IRI
];
].
```

0 comments on commit b980895

Please sign in to comment.