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?
question from:
https://stackoverflow.com/questions/65900785/is-there-any-way-in-rml-r2rml-to-take-a-value-as-an-iri 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…