atomgraph / json2rdf Goto Github PK
View Code? Open in Web Editor NEWStreaming generic JSON to RDF converter
Home Page: https://hub.docker.com/r/atomgraph/json2rdf
License: Apache License 2.0
Streaming generic JSON to RDF converter
Home Page: https://hub.docker.com/r/atomgraph/json2rdf
License: Apache License 2.0
From the README: "Property namespace is constructed by adding # to the base URI."
If the base URI ends in a forward slash (/), a pound/number sign (#) should not be added to the base URI.
Reading JSONL files (.ndjson
) would be useful.
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?
I noticed that beyond the first 1.0.1 tag, no Github releases have been created for subsequent tagged commits (1.0.2 etc) - is that intentional?
Hi! Would it make sense to have a small addition that makes the library usable in Apache Spark? Something along the lines of
package com.atomgraph.etl.json;
import org.apache.spark.sql.api.java.UDF1;
import org.apache.jena.rdf.model.Model;
public class Json2rdfUDF implements UDF1<String, String> {
private static final long serialVersionUID = 1L;
@Override
public StreamRDF call(String jsonString) throws Exception {
InputStream bis = new ByteArrayInputStream(jsonString.getBytes());
Reader reader = new BufferedReader(bis);
StreamRDF rdfStream = new CollectorStreamRDF();
new JsonStreamRDFWriter(reader, rdfStream, baseURI.toString()).convert();
return rdfStream;
}
}
When running JSON2RDF in the Docker container is shown in the readme, I get this error message:
xxxx [~/dev/workspaces/graphstuff/JSON2RDF]> echo "{'label':'Hello'}" | head -100 | docker run -i -a stdin -a stdout -a stderr atomgraph/json2rdf urn:test:
Error: Unable to access jarfile target/json2rdf-1.0.0-SNAPSHOT-jar-with-dependencies.jar
The version number in the Dockerfile wasn't adjusted when bumping the version to 1.0.1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.