SDM-TIB / SDM-RDFizer

An Efficient RML-Compliant Engine for Knowledge Graph Construction
https://doi.org/10.5281/zenodo.3872103
Apache License 2.0
107 stars 25 forks source link

Predicate with "reference" mapping type as IRI #80

Closed nleguillarme closed 2 years ago

nleguillarme commented 2 years ago

Hi, In my RML mapping rules, I have the following:

<#CONSUMER>
    a rr:TriplesMap;
    rml:logicalSource [
        rml:source "./s.tsv";
        rml:referenceFormulation ql:CSV;
    ];
    rr:subjectMap [
        a rr:Subject;
        rr:termType rr:BlankNode;
        rr:template "test_consumer_{ID}";
        rr:class obo:CARO_0001010;
    ];
    rr:predicateObjectMap [
        rr:predicateMap [ rml:reference "interaction_type_uri" ];
        rr:objectMap    [
            rr:parentTriplesMap <#RESOURCE>;
            rr:joinCondition    [
                rr:child    "ID";
                rr:parent   "ID";
            ];
        ];
    ];
.

As you can see, I have a predicate map with mapping type "reference". In my source file, the "interaction_type_uri" column contains my predicate IRIs without the <> (e.g. http://purl.obolibrary.org/obo/RO_0002470). When running rdfizer, this reference is substituted by a string ("http://purl.obolibrary.org/obo/RO_0002470") and not by an IRI (http://purl.obolibrary.org/obo/RO_0002470).

I managed to fix this issue by adding predicate = "<" + predicate[1:-1] + ">" after line 2262 in semantify.py

eiglesias34 commented 2 years ago

Hello @nleguillarme,

Thank you for using the SDM-RDFizer. I added what you suggested to the SDM-RDFizer.

Thank you again, Enrique Iglesias