Class 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
    • Constructor Detail

      • RDFJSONModReader

        public RDFJSONModReader()
    • 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 parse
        model - 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 parse
        model - 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)