Closed aucampia closed 3 years ago
JSON-LD does not correctly process stdin when supplied with -.
-
echo '{"@context": { "@vocab": "http://xmlns.com/foaf/0.1/" }, "@id": "http://example.com", "name": "Example"}' | rdfpipe -i json-ld -o turtle -
$ echo '{"@context": { "@vocab": "http://xmlns.com/foaf/0.1/" }, "@id": "http://example.com", "name": "Example"}' | rdfpipe -i json-ld -o turtle - @prefix : <http://xmlns.com/foaf/0.1/> . <http://example.com/> :name "Example" .
$ echo '{"@context": { "@vocab": "http://xmlns.com/foaf/0.1/" }, "@id": "http://example.com", "name": "Example"}' | rdfpipe -i json-ld -o turtle - Traceback (most recent call last): File "/home/iwana/.local/bin/rdfpipe", line 8, in <module> sys.exit(main()) File "/home/iwana/.local/lib/python3.8/site-packages/rdflib/tools/rdfpipe.py", line 183, in main parse_and_serialize(args, opts.input_format, opts.guess, File "/home/iwana/.local/lib/python3.8/site-packages/rdflib/tools/rdfpipe.py", line 51, in parse_and_serialize graph.parse(fpath, format=use_format, **kws) File "/home/iwana/.local/lib/python3.8/site-packages/rdflib/graph.py", line 1549, in parse context.parse(source, publicID=publicID, format=format, **args) File "/home/iwana/.local/lib/python3.8/site-packages/rdflib/graph.py", line 1078, in parse parser.parse(source, self, **args) File "/home/iwana/.local/lib/python3.8/site-packages/rdflib_jsonld/parser.py", line 83, in parse data = source_to_json(source) File "/home/iwana/.local/lib/python3.8/site-packages/rdflib_jsonld/util.py", line 28, in source_to_json return json.load(StringIO(stream.read().decode('utf-8'))) AttributeError: 'str' object has no attribute 'decode'
Specify /dev/stdin instead of -
/dev/stdin
$ echo '{"@context": { "@vocab": "http://xmlns.com/foaf/0.1/" }, "@id": "http://example.com", "name": "Example"}' | rdfpipe -i json-ld -o turtle /dev/stdin @prefix : <http://xmlns.com/foaf/0.1/> . <http://example.com/> :name "Example" .
Duplicate of #91
Thanks, closing this then.
JSON-LD does not correctly process stdin when supplied with
-
.Test case:
Expected result:
Actual result:
Workaround
Specify
/dev/stdin
instead of-