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

CSV template references dont work in Graphs statement #88

Closed pabloalarconm closed 2 years ago

pabloalarconm commented 2 years ago

I cant use data references $() in a CSV in graphs statement. Im trying to add data in named graph as quad. graph statement allowed me to create quad with a certian template but data references seems not to work on them.

Is RDFizer allowed to add data references at Graphs in a quad?

Material used to reproduce: RML template:

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix fnml: <http://semweb.mmlab.be/ns/fnml#>.
@prefix fno: <https://w3id.org/function/ontology#>.
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#>.
@prefix void: <http://rdfs.org/ns/void#>.
@prefix dc: <http://purl.org/dc/terms/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix : <http://mapping.example.com/>.
@prefix biolink: <https://w3id.org/biolink/vocab/>.
@prefix obo: <http://purl.obolibrary.org/obo/>.
@prefix sio: <http://semanticscience.org/resource/>.
@prefix this: <http://example.org/data/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

:rules_000 a void:Dataset.
:source_000 a rml:LogicalSource;
    rdfs:label "source_cde_test";
    rml:source "/data/test1.csv";
    rml:iterator "$";
    rml:referenceFormulation ql:CSV.
:rules_000 void:exampleResource :map_cde_test_000.
:map_cde_test_000 rml:logicalSource :source_000;
    a rr:TriplesMap;
    rdfs:label "cde_test".
:s_000 a rr:SubjectMap.
:map_cde_test_000 rr:subjectMap :s_000.
:s_000 rr:template "http://example.org/data/{pid}#ID";
    rr:graphMap :gm_000.
:gm_000 a rr:GraphMap;
    rr:template "http://example.org/data/{pid}#Graph".
:pom_000 a rr:PredicateObjectMap.
:map_cde_test_000 rr:predicateObjectMap :pom_000.
:pm_000 a rr:PredicateMap.
:pom_000 rr:predicateMap :pm_000.
:pm_000 rr:constant sio:denotes.
:pom_000 rr:objectMap :om_000.
:om_000 a rr:ObjectMap;
    rr:template "http://example.org/data/{pid}#Role";
    rr:termType rr:IRI.

Simple csv file with pid column on it:

pid
id_test_1_000001
id_test_1_000002
id_test_1_000003
id_test_1_000004
id_test_1_000005

Real obtained: http://example.org/data/id_test_1_000001#ID http://semanticscience.org/resource/denotes http://example.org/data/id_test_1_000001#Role http://example.org/data/{pid}#Graph.

Expected behavior http://example.org/data/id_test_1_000001#ID http://semanticscience.org/resource/denotes http://example.org/data/id_test_1_000001#Role http://example.org/data/id_test_1#Graph.

Thank you

eiglesias34 commented 2 years ago

Hello @pabloalarconm,

Thank you for using the SDM-RDFizer. What version are you using? I am using the most recent version and got this result:

<http://example.org/data/id_test_1_000001#ID> <http://semanticscience.org/resource/denotes> <http://example.org/data/id_test_1_000001#Role> <http://example.org/data/id_test_1_000001#Graph>.
<http://example.org/data/id_test_1_000002#ID> <http://semanticscience.org/resource/denotes> <http://example.org/data/id_test_1_000002#Role> <http://example.org/data/id_test_1_000002#Graph>.
<http://example.org/data/id_test_1_000003#ID> <http://semanticscience.org/resource/denotes> <http://example.org/data/id_test_1_000003#Role> <http://example.org/data/id_test_1_000003#Graph>.
<http://example.org/data/id_test_1_000004#ID> <http://semanticscience.org/resource/denotes> <http://example.org/data/id_test_1_000004#Role> <http://example.org/data/id_test_1_000004#Graph>.
<http://example.org/data/id_test_1_000005#ID> <http://semanticscience.org/resource/denotes> <http://example.org/data/id_test_1_000005#Role> <http://example.org/data/id_test_1_000005#Graph>.

In other words, I did not get the error. Please check if the version you are using is the most recent. If you are using the most recent version, please send me the config file you are using so that I can see the configuration you are running.

Thank you again. Sincerely, Enrique Iglesias

eiglesias34 commented 2 years ago

Given the inactivity of this issue, I am going to close it. Thank you again for using the SDM-RDFizer.