julianrojas87 / ttl-merge

A CLI to merge multiple turtle (RDF) files into one file
MIT License
2 stars 2 forks source link

Error when adding prefix file #3

Open MathiasVDA opened 1 year ago

MathiasVDA commented 1 year ago

Hello,

I'm trying to run this on my windows machine and am not that successful. Just merging multiple ttl files works fine. But when I want to point to a json prefix file I get this error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: Unexpected "��@prefix" on line 1.
    at N3Lexer._syntaxError (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\n3\lib\N3Lexer.js:478:17)
    at reportSyntaxError (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\n3\lib\N3Lexer.js:406:21)
    at N3Lexer._tokenizeToEnd (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\n3\lib\N3Lexer.js:376:86)
    at C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\n3\lib\N3Lexer.js:532:18
    at N3StreamParser._transform (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\n3\lib\N3StreamParser.js:46:7)
    at N3StreamParser.Transform._write (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\transform.js:153:8)
    at writeOrBuffer (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\writable.js:334:12)
    at _write (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\writable.js:283:10)  
    at N3StreamParser.Writable.write (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\writable.js:286:10)
    at ReadStream.ondata (node:internal/streams/readable:754:22)
Emitted 'error' event on N3StreamParser instance at:
    at emitErrorNT (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\destroy.js:126:8)
    at emitErrorCloseNT (C:\Users\VBP8501\AppData\Roaming\npm\node_modules\ttl-merge\node_modules\readable-stream\lib\internal\streams\destroy.js:98:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  context: { token: undefined, line: 1, previousToken: undefined }

When I put the same command in a .bat file, my machine enters into an infinite loop.

This is the command I try to run:

ttl-merge -i ./ -p prefixes.json > merged-withprefixes.ttl

And this is the json file:

{
  "rml": "http://semweb.mmlab.be/ns/rml#",
  "owl": "http://www.w3.org/2002/07/owl#",
  "ql": "http://semweb.mmlab.be/ns/ql#",
  "rr": "http://www.w3.org/ns/r2rml#",
  "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "era": "http://data.europa.eu/949/",
  "gsp": "http://www.opengis.net/ont/geosparql#",
  "geo": "http://www.w3.org/2003/01/geo/wgs84_pos#",
  "skos": "http://www.w3.org/2004/02/skos/core#",
  "prov": "http://www.w3.org/ns/prov#",
  "idlab-fn": "http://example.com/idlab/function/",
  "fnml": "http://semweb.mmlab.be/ns/fnml#",
  "fno": "https://w3id.org/function/ontology#",
  "inf-o": "https://data.infrabel.be/edm/",
  "inf-d": "https://data.infrabel.be/data/"
}

Any ttl files as input give the error

MathiasVDA commented 1 year ago

I just had a hunch, it's the ./ that points to the input files. I just put both my export file and the input files in the same folder. But when you put the input files one directory deeper, say in data/, then the error doesn't occur

julianrojas87 commented 1 year ago

Hi @VBP8501, Thanks for reporting this. I'll try to reproduce it and find a solution.