I'm using RMLMapper to transfrom JSON to RDF. One of the values stored in the JSON is a URL. I would like to use this as the basis of an IRI for the object of RDF statements.
The input is
{
"documentId": {
"value": "http://example.org/345299"
},
...
I want the IRI for the subject of statements to be http://example.org/345299#item
, e.g. <http://example.org/345299#item> a <http://schema.org/Thing> .
I tried
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
<#Mapping> a rr:TriplesMap ;
rml:logicalSource [
rml:source "input.json";
rml:referenceFormulation ql:JSONPath;
rml:iterator "$"
];
rr:subjectMap [
rr:template "{documentId.value}#item" ;
rr:class schema:Thing
]
gives and error that rr:template "{documentId.value}#item"
doesn't produce a valid IRI.
Providing a value for @base gives a valid IRI, but it is the base with the url-encoded value appended to the base, e.g. <http://example.org/http%3A%2F%2Fexample.org%2Fjobposts%2F345299#item>
So is there any way in r2rml / rml to take a value and just use it as an IRI? Or to convert a string in to an IRI?
rml:reference
is close enough.Doesn't seem to let me append
#item
but it'll do for now.