Package com.epimorphics.json
Class RDFJSONModReader
- java.lang.Object
-
- com.epimorphics.json.RDFJSONModReader
-
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.
- Author:
- Dave Reynolds
-
-
Field Summary
Fields Modifier and Type Field Description static StringBNODE_TYPEprotected Map<String,org.apache.jena.graph.Node>bNodeTablestatic StringDATATYPE_KEYstatic StringLANG_KEYstatic StringLIST_TYPEstatic StringLITERAL_TYPEstatic StringTYPE_KEYstatic StringURI_TYPEstatic StringVALUE_KEY
-
Constructor Summary
Constructors Constructor Description RDFJSONModReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.jena.graph.NodebNodeFor(String id)protected org.apache.jena.atlas.json.JsonValuegetRequiredKey(org.apache.jena.atlas.json.JsonObject obj, String key)protected StringgetValueAsString(org.apache.jena.atlas.json.JsonObject obj)protected StringgetValueAsString(org.apache.jena.atlas.json.JsonObject obj, String key)org.apache.jena.rdf.model.ModelmodelFromJson(org.apache.jena.atlas.json.JsonObject json)Parse a JSON structure into a newly-allocated RDF model.org.apache.jena.rdf.model.Modelparse(InputStream in)Parse a JSON format stream into an RDF model.org.apache.jena.rdf.model.Modelparse(String in)Parse a JSON format String into an RDF model.voidparseJson(org.apache.jena.atlas.json.JsonObject json, org.apache.jena.graph.Graph graph)Parse a JSON structure into an RDF graph..voidparseJson(org.apache.jena.atlas.json.JsonObject json, org.apache.jena.rdf.model.Model model)Parse a JSON structure into an RDF model.protected org.apache.jena.graph.NodeparseValue(org.apache.jena.atlas.json.JsonValue value, org.apache.jena.graph.Graph graph)
-
-
-
Field Detail
-
TYPE_KEY
public static final String TYPE_KEY
- See Also:
- Constant Field Values
-
URI_TYPE
public static final String URI_TYPE
- See Also:
- Constant Field Values
-
BNODE_TYPE
public static final String BNODE_TYPE
- See Also:
- Constant Field Values
-
LIST_TYPE
public static final String LIST_TYPE
- See Also:
- Constant Field Values
-
LITERAL_TYPE
public static final String LITERAL_TYPE
- See Also:
- Constant Field Values
-
DATATYPE_KEY
public static final String DATATYPE_KEY
- See Also:
- Constant Field Values
-
LANG_KEY
public static final String LANG_KEY
- See Also:
- Constant Field Values
-
VALUE_KEY
public static final String VALUE_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public org.apache.jena.rdf.model.Model parse(InputStream in)
Parse a JSON format stream into an RDF model.
-
parse
public org.apache.jena.rdf.model.Model parse(String in)
Parse a JSON format String into an RDF model.
-
modelFromJson
public org.apache.jena.rdf.model.Model modelFromJson(org.apache.jena.atlas.json.JsonObject json)
Parse a JSON structure into a newly-allocated RDF model.- Parameters:
json- the JSON structure to parse
-
parseJson
public void parseJson(org.apache.jena.atlas.json.JsonObject json, org.apache.jena.rdf.model.Model model)Parse a JSON structure into an RDF model.- Parameters:
json- the JSON structure to parsemodel- the model into which to place the results
-
parseJson
public void parseJson(org.apache.jena.atlas.json.JsonObject json, org.apache.jena.graph.Graph graph)Parse a JSON structure into an RDF graph..- Parameters:
json- the JSON structure to parsemodel- the model into which to place the results
-
parseValue
protected org.apache.jena.graph.Node parseValue(org.apache.jena.atlas.json.JsonValue value, org.apache.jena.graph.Graph graph)
-
getRequiredKey
protected org.apache.jena.atlas.json.JsonValue getRequiredKey(org.apache.jena.atlas.json.JsonObject obj, String key)
-
getValueAsString
protected String getValueAsString(org.apache.jena.atlas.json.JsonObject obj)
-
getValueAsString
protected String getValueAsString(org.apache.jena.atlas.json.JsonObject obj, String key)
-
bNodeFor
protected org.apache.jena.graph.Node bNodeFor(String id)
-
-