Skip to content

Commit a702be1

Browse files
spec: single-targets: add examples FunctionMap and DatatypeMap
Fixes #54
1 parent 16b0780 commit a702be1

File tree

1 file changed

+219
-0
lines changed

1 file changed

+219
-0
lines changed

spec/section/single-targets.md

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,3 +549,222 @@ to a RDF dump with N-Triples as serialization format:
549549
<http://example.org/3> <http://xmlns.com/foaf/0.1/age> "36" .
550550
<http://example.org/4> <http://xmlns.com/foaf/0.1/age> "37" .
551551
</pre>
552+
553+
### Datatype Map {#datatype-map}
554+
555+
All triples with a datatype are exported to the specified targets
556+
in the Datatype Map [[RML]].
557+
558+
The following examples export all triples with a datatype xsd:integer
559+
to a RDF dump with N-Triples as serialization format:
560+
561+
<pre class="ex-input">
562+
[
563+
{
564+
"id": 0,
565+
"name": "Monica Geller",
566+
"age": 33
567+
},
568+
{
569+
"id": 1,
570+
"name": "Rachel Green",
571+
"age": 34
572+
},
573+
{
574+
"id": 2,
575+
"name": "Joey Tribbiani",
576+
"age": 35
577+
},
578+
{
579+
"id": 3,
580+
"name": "Chandler Bing",
581+
"age": 36
582+
},
583+
{
584+
"id": 4,
585+
"name": "Ross Geller",
586+
"age": 37
587+
}
588+
]
589+
</pre>
590+
591+
<pre class="ex-access">
592+
&lt;#DCATSourceAccess&gt; a rml:Source, dcat:Distribution;
593+
dcat:downloadURL "https://rml.io/specs/rml-target/Friends.json";
594+
.
595+
</pre>
596+
597+
<pre class="ex-mapping">
598+
&lt;#TriplesMap&gt; a rml:TriplesMap;
599+
rml:logicalSource [ a rml:LogicalSource;
600+
rml:source &lt;#DCATSourceAccess&gt;;
601+
rml:referenceFormulation rml:JSONPath;
602+
rml:iterator "$.[*]";
603+
];
604+
rml:subjectMap [ a rml:SubjectMap;
605+
rml:template "http://example.org/{id}";
606+
];
607+
rml:predicateObjectMap [ a rml:PredicateObjectMap;
608+
rml:predicateMap [ a rml:PredicateMap;
609+
rml:constant foaf:name;
610+
];
611+
rml:objectMap [ a rml:ObjectMap;
612+
rml:reference "$.name";
613+
rml:languageMap [
614+
rml:constant "en";
615+
];
616+
];
617+
];
618+
rml:predicateObjectMap [ a rml:PredicateObjectMap;
619+
rml:predicateMap [ a rml:PredicateMap;
620+
rml:constant foaf:age;
621+
];
622+
rml:objectMap [ a rml:ObjectMap;
623+
rml:reference "$.age";
624+
rml:datatypeMap [ a rml:DatatypeMap;
625+
rml:constant xsd:integer;
626+
rml:logicalTarget &lt;#TargetDump1&gt;;
627+
]
628+
];
629+
];
630+
.
631+
</pre>
632+
633+
<pre class="ex-target">
634+
&lt;#TargetDump1&gt; a rml:LogicalTarget;
635+
rml:target &lt;#VoIDDump1&gt;;
636+
rml:serialization formats:N-Triples;
637+
.
638+
</pre>
639+
640+
<pre class="ex-access">
641+
&lt;#VoIDDump1&gt; a rml:Target, void:Dataset ;
642+
void:dataDump &lt;file:///data/dump1.nt&gt;;
643+
.
644+
</pre>
645+
646+
<pre class="ex-output">
647+
# file:///data/dump1.nt
648+
&lt;http://example.org/0&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "33"^^xsd:integer .
649+
&lt;http://example.org/1&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "34"^^xsd:integer .
650+
&lt;http://example.org/2&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "35"^^xsd:integer .
651+
&lt;http://example.org/3&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "36"^^xsd:integer .
652+
&lt;http://example.org/4&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "37"^^xsd:integer .
653+
654+
# default target of the processor
655+
&lt;http://example.org/0&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Monica Geller"@en .
656+
&lt;http://example.org/1&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Rachel Green"@en .
657+
&lt;http://example.org/2&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Joey Tribbiani"@en .
658+
&lt;http://example.org/3&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Chandler Bing"@en .
659+
&lt;http://example.org/4&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Ross Geller"@en .
660+
</pre>
661+
662+
### Function Map {#function-map}
663+
664+
<pre class="ex-input">
665+
[
666+
{
667+
"id": 0,
668+
"name": "Monica Geller",
669+
"age": 33
670+
},
671+
{
672+
"id": 1,
673+
"name": "Rachel Green",
674+
"age": 34
675+
},
676+
{
677+
"id": 2,
678+
"name": "Joey Tribbiani",
679+
"age": 35
680+
},
681+
{
682+
"id": 3,
683+
"name": "Chandler Bing",
684+
"age": 36
685+
},
686+
{
687+
"id": 4,
688+
"name": "Ross Geller",
689+
"age": 37
690+
}
691+
]
692+
</pre>
693+
694+
<pre class="ex-access">
695+
&lt;#DCATSourceAccess&gt; a rml:Source, dcat:Distribution;
696+
dcat:downloadURL "https://rml.io/specs/rml-target/Friends.json";
697+
.
698+
</pre>
699+
700+
<pre class="ex-mapping">
701+
&lt;#TriplesMap&gt; a rml:TriplesMap;
702+
rml:logicalSource [ a rml:LogicalSource;
703+
rml:source &lt;#DCATSourceAccess&gt;;
704+
rml:referenceFormulation rml:JSONPath;
705+
rml:iterator "$.[*]";
706+
];
707+
rml:subjectMap [ a rml:SubjectMap;
708+
rml:template "http://example.org/{id}";
709+
];
710+
rml:predicateObjectMap [ a rml:PredicateObjectMap;
711+
rml:predicateMap [ a rml:PredicateMap;
712+
rml:constant foaf:name;
713+
];
714+
rml:objectMap [ a rml:ObjectMap;
715+
rml:functionExecution <#Execution>;
716+
rml:return grel:stringOut;
717+
];
718+
];
719+
rml:predicateObjectMap [ a rml:PredicateObjectMap;
720+
rml:predicateMap [ a rml:PredicateMap;
721+
rml:constant foaf:age;
722+
];
723+
rml:objectMap [ a rml:ObjectMap;
724+
rml:reference "$.age";
725+
];
726+
];
727+
.
728+
729+
<#Execution> a rml:FunctionExecution;
730+
rml:logicalTarget &lt;#TargetDump1&gt;;
731+
rml:function grel:toUppercase;
732+
rml:input [ a rml:Input;
733+
rml:parameter grel:valueParam;
734+
rml:inputValueMap [
735+
rml:reference "$.name"
736+
]
737+
]
738+
.
739+
740+
</pre>
741+
742+
<pre class="ex-target">
743+
&lt;#TargetDump1&gt; a rml:LogicalTarget;
744+
rml:target &lt;#VoIDDump1&gt;;
745+
rml:serialization formats:N-Quads;
746+
.
747+
</pre>
748+
749+
<pre class="ex-access">
750+
&lt;#VoIDDump1&gt; a rml:Target, void:Dataset ;
751+
void:dataDump &lt;file:///data/dump1.nq.gz&gt;;
752+
rml:compression rml:gzip;
753+
.
754+
</pre>
755+
756+
<pre class="ex-output">
757+
# dump1.nq.gz
758+
&lt;http://example.org/0&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "MONICA GELLER" .
759+
&lt;http://example.org/1&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "RACHEL GREEN" .
760+
&lt;http://example.org/2&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "JOEY TRIBBIANI" .
761+
&lt;http://example.org/3&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "CHANDLER BING" .
762+
&lt;http://example.org/4&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "ROSS GELLER" .
763+
764+
# default target of the processor
765+
&lt;http://example.org/0&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "33" .
766+
&lt;http://example.org/1&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "34" .
767+
&lt;http://example.org/2&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "35" .
768+
&lt;http://example.org/3&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "36" .
769+
&lt;http://example.org/4&gt; &lt;http://xmlns.com/foaf/0.1/age&gt; "37" .
770+
</pre>

0 commit comments

Comments
 (0)