oeg-upm / yatter

Translate YARRRML into easy-to-read [R2]RML mappings
https://doi.org/10.5281/zenodo.7024500
Apache License 2.0
22 stars 6 forks source link

Supporting conditionals rules #80

Open jatoledo opened 6 months ago

jatoledo commented 6 months ago

Error translating functions in RML at the PO level.

yarrrml mapping:

prefixes:
  grel: http://users.ugent.be/~bjdmeest/function/grel.ttl#
  idlab-fn: http://example.com/idlab/function/

mappings:
  person:
    sources:
     - [test.csv~csv]
    subject: http://example.org/$(firstname)
    predicateobjects:
     - predicates: foaf:firstName
       objects: $(firstname)
       condition:
        function: idlab-fn:equal
        parameters:
         - [grel:valueParameter, $(firstname)]
         - [grel:valueParameter2, "test"]

How is connected the TMP with the function ?

@prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#>.
@prefix idlab-fn: <http://example.com/idlab/function/>.
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix schema: <http://schema.org/>.
@prefix formats: <http://www.w3.org/ns/formats/>.
@prefix comp: <http://semweb.mmlab.be/ns/rml-compression#>.
@prefix void: <http://rdfs.org/ns/void#>.
@prefix fnml: <http://semweb.mmlab.be/ns/fnml#>.
@base <http://example.com/ns#>.

<function_person_0> a fnml:Execution;
    fnml:function idlab-fn:equal ; 
    fnml:input
        [
            a fnml:Input;
            fnml:parameter grel:valueParameter;
            fnml:valueMap [
                a fnml:ValueMap;
                rml:reference "firstname";
            ];
        ],
        [
            a fnml:Input;
            fnml:parameter grel:valueParameter2;
            fnml:valueMap [
                a fnml:ValueMap;
                rr:constant "test";
            ];
        ].

<person_0> a rr:TriplesMap;

    rml:logicalSource [
        a rml:LogicalSource;
        rml:source "test.csv";
        rml:referenceFormulation ql:CSV
    ];
    rr:subjectMap [
        a rr:SubjectMap;
        rr:template "http://example.org/{firstname}";
    ];
    rr:predicateObjectMap [
        rr:predicateMap [
            a rr:PredicateMap;
            rr:constant foaf:firstName;
        ];
        rr:objectMap [
            a rr:ObjectMap;
            rml:reference "firstname";
        ];
    ].

Version: yatter: 1.1.2

dachafra commented 6 months ago

@jatoledo this is a conditional generation of the triples, which is not part of any RML spec. That's why it's not supported in Yatter. You can proceed as follows:

  1. Propose to include conditionals in RML at the CG (kg-construct))
  2. I know that this behavior was included in the YARRRML spec, and I asked for the corresponding translation to RML (bc in the spec is not provided), see https://github.com/kg-construct/yarrrml-spec/issues/2
dachafra commented 6 months ago

This is not going to be implemented until the spec of YARRRML provides actual examples on how to do the proper translation