RMLio / RML-Processor

16 stars 13 forks source link

A complete example #13

Closed berezovskyi closed 5 years ago

berezovskyi commented 6 years ago

Hi, maybe a complete example somewhere could be helpful. It took me a while to debug a number of mapping configurations until I was able to see more than 0 generated triples after the RML mapping was done (maybe that's just me).

Here is the full example I was able to put together:

@prefix rr:     <http://www.w3.org/ns/r2rml#>.
@prefix rml:    <http://semweb.mmlab.be/ns/rml#> .
@prefix crml:   <http://semweb.mmlab.be/ns/crml#> .
@prefix ql:     <http://semweb.mmlab.be/ns/ql#> .
@prefix mail:   <http://example.com/mail#>.
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#>.
@prefix ex:     <http://www.example.com/> .
@prefix hydra:  <http://www.w3.org/ns/hydra/core#> .
@base <http://example.com/base> .

<#InputAPI>
    a hydra:IriTemplate ;
    hydra:template "https://biblio.ugent.be/publication/{publication_id}.json" .

<#Author>
    rml:logicalSource [
    rml:source <#InputAPI>;
        rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.author[*]";
    ];

    rr:subjectMap [
        rr:template "http://www.ex.com/author/{ugent_id}";
        rr:class ex:Author
    ];

    rr:predicateObjectMap [
        rr:predicate ex:firstName;

        rr:objectMap [
            rml:reference "first_name" ;
            ]
    ];

    rr:predicateObjectMap [
        rr:predicate ex:lastName;

        rr:objectMap [
            rml:reference "last_name" ;
            ]
    ].

And the command:

bin/RML-Mapper -m ../map-h.ttl -o ../out.ttl -p publication_id=8551871

Provided that the Turtle files are in the project root and the RML-Mapper has been cloned into a subfolder there.

canarvaeza commented 6 years ago

Do you know what exactly does hydra?

pheyvaer commented 5 years ago

Please see this issue at the repo of the new version of the RMLMapper.