RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
147 stars 61 forks source link

Invalid path concatenation in rml:source #102

Closed mielvds closed 3 years ago

mielvds commented 3 years ago

When starting a path with ./ (which is correct according to the spec I think?), concatenating the path fails in the docker setup, but probably also beyond.

$ docker run --rm -v $(pwd):/data rmlmapper -m /data/mapping/mapping.rml.ttl
09:01:19.041 [main] ERROR be.ugent.rml.cli.Main               .main(312) - /data/./files/data.json (No such file or directory)

Does the mapper already use Path?

DylanVanAssche commented 3 years ago

Hi @mielvds!

Thanks for creating a bug report for your issue. However, I cannot reproduce it. Could you maybe provide a minimal failing example?

I'm trying to reproduce this with the following setup:

Command

docker run --rm -v $(pwd):/data rmlmapper -m /data/mapping/mapping.rml.ttl

File structure

dylan@dylan-Latitude-5590:~/Projects/rmlmapper-java-docker$ tree files mapping
files
└── data.json
mapping
└── mapping.rml.ttl

mapping.rml.ttl

@prefix rr:         <http://www.w3.org/ns/r2rml#> .
@prefix foaf:       <http://xmlns.com/foaf/0.1/> .
@prefix ex:         <http://example.com/> .
@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 org:        <http://www.w3.org/ns/org#> .
@prefix skos:       <http://www.w3.org/2004/02/skos/core#> .
@prefix dc:         <http://purl.org/dc/terms/> .
@base               <http://example.org/tm/> .

<json>
  a rr:TriplesMap;

  rml:logicalSource [
    rml:source "./files/data.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$[*]"
  ];
  rr:subjectMap [
    rr:template "http://example.org/{custom_fields[?(@.label=='OR-ID')].value}";
    rr:class org:Organization
  ]; 
  rr:predicateObjectMap [ 
    rr:predicate skos:altLabel; 
    rr:objectMap [ rml:reference "name"; rr:language "nl" ]
  ].

data.json

[
  {
    "id": "001",
    "name": "x",
    "custom_fields": [
      {
        "value": "OR-12345",
        "label": "OR-ID"
      }
    ]
  },
  {
    "id": "003",
    "name": "z",
    "custom_fields": [
      {
        "value": "OR-1011",
        "label": "OR-ID"
      }
    ]
  }
]
no-response[bot] commented 3 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.