AtomGraph / JSON2RDF

Streaming generic JSON to RDF converter

Home Page:https://hub.docker.com/r/atomgraph/json2rdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

whitespace in json keys

justin2004 opened this issue · comments

characters.json:

{
  "characters": [
    {
      "first name": "Ash",
      "lastname":"Ketchum"}
      ]
    }


is valid json.

but:

cat characters.json | docker run --rm -i atomgraph/json2rdf 'http://tmp.com/
Exception in thread "main" org.apache.jena.riot.RiotException: <http://tmp.com/#first name> Code: 17/WHITESPACE in FRAGMENT: A single whitespace character. These match no grammar rules of URIs/IRIs. These characters are permitted in RDF URI References, XML system identifiers, and XML Schema anyURIs.
        at org.apache.jena.riot.system.IRIResolver.exceptions(IRIResolver.java:384)
        at org.apache.jena.riot.system.IRIResolver.resolve(IRIResolver.java:341)
        at org.apache.jena.riot.system.IRIResolver.resolveToString(IRIResolver.java:358)
        at com.atomgraph.etl.json.JsonStreamRDFWriter.write(JsonStreamRDFWriter.java:107)
        at com.atomgraph.etl.json.JsonStreamRDFWriter.convert(JsonStreamRDFWriter.java:66)
        at com.atomgraph.etl.json.JSON2RDF.convert(JSON2RDF.java:82)
        at com.atomgraph.etl.json.JSON2RDF.main(JSON2RDF.java:60)

should json2rdf just make the decision to delete non URI safe characters or maybe percent encode them?

if anyone is looking for a solution for this sparql-anything url encodes spaces in json keys:

xyz:characters  [ rdf:_1  [ <http://sparql.xyz/facade-x/data/first%20name>