RMLio/yarrrml-parser

Inverse predicates with the yarrrml-parser

thomasdegroot18 opened this issue ยท 1 comments

Issue type: ๐Ÿ› Bug

Description

I'm unable to use Inverse predicates with the yarrrml-parser. The inverse predicates are not parsed and handled when transforming the .yml mappings to rml mapping. When following the example from the specification (https://rml.io/yarrrml/spec/#predicates-and-objects) with the yarrrml parser I notice that the inverse predicate is not parsed.

Steps

I've created the following .yml file which takes a small example json file and the mappings to create two triples one in the regular way, with a regular predicates, and one with the inverse predicate.

prefixes:
  ex: http://www.example.com/

mappings:
  test:
    sources:
       - [person.json~jsonpath, $]
    s:
       - "http://example.org/$(id)"
    predicateobjects:
      - predicates: ex:created
        inversepredicates: ex:createdBy
        objects: [$(foafprofile)~iri]

This yml file resulted in the following rml mapping structure. Note that only the predicate ex:created can be found in the turtle file and the ex:createdBy can not be found.

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix void: <http://rdfs.org/ns/void#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix : <http://mapping.example.com/>.
@prefix ex: <http://www.example.com/>.

:rules_000 a void:Dataset;
    void:exampleResource :map_test_000.
:map_test_000 rml:logicalSource :source_000.
:source_000 a rml:LogicalSource;
    rml:source "person.json";
    rml:iterator "$";
    rml:referenceFormulation ql:JSONPath.
:map_test_000 a rr:TriplesMap;
    rdfs:label "test".
:s_000 a rr:SubjectMap.
:map_test_000 rr:subjectMap :s_000.
:s_000 rr:template "http://example.org/{id}".
:pom_000 a rr:PredicateObjectMap.
:map_test_000 rr:predicateObjectMap :pom_000.
:pm_000 a rr:PredicateMap.
:pom_000 rr:predicateMap :pm_000.
:pm_000 rr:constant ex:created.
:pom_000 rr:objectMap :om_000.
:om_000 a rr:ObjectMap;
    rml:reference "foafprofile";
    rr:termType rr:IRI.

The dataset I wanted to transform to linked data.

{
  "id": "10",
  "foafprofile": "http://www.foafProfile.com/10"
}

This resulted in the following triple:

<http://example.org/10> <http://www.example.com/created> <http://www.foafProfile.com/10> .

What was expected

That in total 2 triples would show up:

<http://example.org/10> <http://www.example.com/created> <http://www.foafProfile.com/10> .
<http://foafProfile.org/10> <http://www.example.com/createdBy> <http://www.example.com/10> .

Environment

rmlmapper version 5.0.0 and the latest version of the yarrrml-parser installed.

Hi @thomasdegroot18

Yeah, this is not implemented in the parser, because this is something that we would like to have in YARRRML but that's at the moment not possible in [R2]RML.