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

Key error mapping a csv file #98

Closed RichDijk closed 1 year ago

RichDijk commented 1 year ago

RML mapping using rdfizer 4.6.6.2 crashes with:

File "E:\Python310\lib\site-packages\rdfizer\__init__.py", line 103, in determine_prefix
    return prefixes[url] + ":" + value
KeyError: '<http://data#

Mapping

@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#>.
@prefix data: <http://data#>.

<#Mapping> a rr:TriplesMap;
    rml:logicalSource [
        rml:source "irissample.csv";
        rml:referenceFormulation ql:CSV;
    ];
    rr:subjectMap [
        rr:template "http://mydataset/iris#{index}";
        rr:class data:Instance;
    ];
    rr:predicateObjectMap [
        rr:predicate rdfs:sepalLength;
        rr:objectMap [ rml:reference  "sepal_length" ]
    ];
.

input csv

index,sepal_length,sepal_width,petal_length,petal_width,species
1,5.1,3.5,1.4,0.2,setosa
2,4.9,3.0,1.4,0.2,setosa
3,4.7,3.2,1.3,0.2,setosa
4,4.6,3.1,1.5,0.2,setosa
5,5.0,3.6,1.4,0.2,setosa
eiglesias34 commented 1 year ago

Dear @RichDijk,

Thank you for using the SDM-RDFizer. I found the issue and fixed it. Please test it out.

SIncerely, Enrique Iglesias

RichDijk commented 1 year ago

Hi Enrique,

Thank you for the fix, this work fine.

Regards, Richard