RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
158 stars 61 forks source link

rr:template Yields URI instead of IRI #187

Open tobiasschweizer opened 2 years ago

tobiasschweizer commented 2 years ago

Hi there,

When using rr:template, URIs are produced instead of IRIs: https://data.connectome.ch/author/A%20Bergstr%C3%B6m instead of https://data.connectome.ch/author/A%20Bergström for "A Bergström".

I am using RMLMapper CLI: java -jar rmlmapper-6.0.0-r363-all.jar -m mapping.ttl -s turtle

Example data test.xml:

<result source="corda" type="relatedResult">

    <availableLanguages readOnly="true">en</availableLanguages>

    <rcn>4321</rcn>

    <id>1243</id>

    <title>Some title</title>

    <details>

        <authors><author>A Bergström</author>
        </authors>

        <journalTitle>Some Journal</journalTitle>

        <journalNumber>31/12</journalNumber>

        <publisher>Some Academic Publishers</publisher>

        <publishedYear>2016</publishedYear>

        <publishedPages>1243-1264</publishedPages>

    </details>

</result>

mapping.ttl:

PREFIX rr: <http://www.w3.org/ns/r2rml#>
PREFIX rml: <http://semweb.mmlab.be/ns/rml#>
PREFIX ql: <http://semweb.mmlab.be/ns/ql#>
PREFIX carml: <http://carml.taxonic.com/carml/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX premis: <http://id.loc.gov/vocabulary/preservation/>
PREFIX schema: <http://schema.org/>
@base <http://example.com/ns#>.

<#LogicalSourceArticle> a rml:BaseSource ;
    rml:source "test.xml";
    rml:referenceFormulation ql:XPath ;
    rml:iterator "/result[@type='relatedResult']" .

<#article> a rr:TriplesMap ;
    rml:logicalSource <#LogicalSourceArticle> ;

    rr:subjectMap [
        rr:template "https://data.connectome.ch/publication/{id}" ;
        rr:class schema:ScholarlyArticle ;
    ] ;

    rr:predicateObjectMap [
        rr:predicate schema:name ;
        rr:objectMap [
            rml:reference "title" ;
        ];
    ] ;

    rr:predicateObjectMap [
        rr:predicate schema:author ;
        rr:objectMap [
            rr:template "https://data.connectome.ch/author/{details/authors/author}" ;
        ];
    ] .

Result:

@prefix schema: <http://schema.org/> .

<https://data.connectome.ch/publication/1243> a schema:ScholarlyArticle;
  schema:author <https://data.connectome.ch/author/A%20Bergstr%C3%B6m>;
  schema:name "Some title" .

More context can be found here: https://github.com/kg-construct/rml-questions/discussions/28

Please let me know if more information is needed.

tobiasschweizer commented 2 years ago

I am not sure how to best ensure backward compatibility since IRIs would not match the URIs, e.g., when doing incremental updates of data etc.

DylanVanAssche commented 1 year ago

As discussed in in the link above, we may need to have rr:URI as well. The RMLMapper calls an encoding method to encode the parameters as in the R2RML spec.