public class RDFJSONModReader extends Object
Read a graph serialized using the modified JSON format. This implementation is primarily for testing purposes, a more efficient and debug-friendly streaming solution such as the RIOT would be possible.
Not thread safe, the parse contains state, allocate a new reader for each use.
In lieu of the W3C standard we are mostly following the Talis format. Unfortunately that doesn't cater for lists in a usable fashion and our primary use case is outputting lists of results. So we extend the Talis format with a value type "list" which is rendered in JSON as an array.
| Modifier and Type | Field and Description |
|---|---|
static String |
BNODE_TYPE |
protected Map<String,com.hp.hpl.jena.graph.Node> |
bNodeTable |
static String |
DATATYPE_KEY |
static String |
LANG_KEY |
static String |
LIST_TYPE |
static String |
LITERAL_TYPE |
static String |
TYPE_KEY |
static String |
URI_TYPE |
static String |
VALUE_KEY |
| Constructor and Description |
|---|
RDFJSONModReader() |
| Modifier and Type | Method and Description |
|---|---|
protected com.hp.hpl.jena.graph.Node |
bNodeFor(String id) |
protected org.apache.jena.atlas.json.JsonValue |
getRequiredKey(org.apache.jena.atlas.json.JsonObject obj,
String key) |
protected String |
getValueAsString(org.apache.jena.atlas.json.JsonObject obj) |
protected String |
getValueAsString(org.apache.jena.atlas.json.JsonObject obj,
String key) |
com.hp.hpl.jena.rdf.model.Model |
modelFromJson(org.apache.jena.atlas.json.JsonObject json)
Parse a JSON structure into a newly-allocated RDF model.
|
com.hp.hpl.jena.rdf.model.Model |
parse(InputStream in)
Parse a JSON format stream into an RDF model.
|
com.hp.hpl.jena.rdf.model.Model |
parse(String in)
Parse a JSON format String into an RDF model.
|
void |
parseJson(org.apache.jena.atlas.json.JsonObject json,
com.hp.hpl.jena.graph.Graph graph)
Parse a JSON structure into an RDF graph..
|
void |
parseJson(org.apache.jena.atlas.json.JsonObject json,
com.hp.hpl.jena.rdf.model.Model model)
Parse a JSON structure into an RDF model.
|
protected com.hp.hpl.jena.graph.Node |
parseValue(org.apache.jena.atlas.json.JsonValue value,
com.hp.hpl.jena.graph.Graph graph) |
public static final String TYPE_KEY
public static final String URI_TYPE
public static final String BNODE_TYPE
public static final String LIST_TYPE
public static final String LITERAL_TYPE
public static final String DATATYPE_KEY
public static final String LANG_KEY
public static final String VALUE_KEY
public com.hp.hpl.jena.rdf.model.Model parse(InputStream in)
public com.hp.hpl.jena.rdf.model.Model parse(String in)
public com.hp.hpl.jena.rdf.model.Model modelFromJson(org.apache.jena.atlas.json.JsonObject json)
json - the JSON structure to parsepublic void parseJson(org.apache.jena.atlas.json.JsonObject json,
com.hp.hpl.jena.rdf.model.Model model)
json - the JSON structure to parsemodel - the model into which to place the resultspublic void parseJson(org.apache.jena.atlas.json.JsonObject json,
com.hp.hpl.jena.graph.Graph graph)
json - the JSON structure to parsemodel - the model into which to place the resultsprotected com.hp.hpl.jena.graph.Node parseValue(org.apache.jena.atlas.json.JsonValue value,
com.hp.hpl.jena.graph.Graph graph)
protected org.apache.jena.atlas.json.JsonValue getRequiredKey(org.apache.jena.atlas.json.JsonObject obj,
String key)
protected String getValueAsString(org.apache.jena.atlas.json.JsonObject obj)
protected String getValueAsString(org.apache.jena.atlas.json.JsonObject obj, String key)
protected com.hp.hpl.jena.graph.Node bNodeFor(String id)
Copyright © 2015. All rights reserved.