Class JsonLDReader

  • All Implemented Interfaces:
    ReaderRIOT

    public class JsonLDReader
    extends java.lang.Object
    implements ReaderRIOT
    One can pass a jsonld context using the (jena) Context mechanism, defining a (jena) Context (sorry for this clash of "contexts"), (cf. last argument in ReaderRIOT.read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context)) with:
     Context jenaContext = new Context()
     jenaCtx.set(JsonLdReader.JSONLD_CONTEXT, contextAsJsonString);
     
    where contextAsJsonString is a JSON string containing the value of the "@context". It is also possible to define the different options supported by JSONLD-java using the JSONLD_OPTIONS Symbol The JsonLDReadContext is a convenience class that extends Context and provides methods to set the values of these different Symbols that are used in controlling the writing of JSON-LD. Note: it is possible to override jsonld's "@context" value by providing one, using a Context, and setting the JSONLD_CONTEXT Symbol's value to the data expected by JSON-LD java API (a Map).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BLANK_NODE  
      static java.lang.String IRI  
      static Symbol JSONLD_CONTEXT
      Symbol to use to pass (in a Context object) the "@context" to be used when reading jsonld (overriding the actual @context in the jsonld) Expected value: the value of the "@context", as expected by the JSONLD-java API (a Map)
      static Symbol JSONLD_OPTIONS
      value: the option object expected by JsonLdProcessor (instance of JsonLdOptions)
      static java.lang.String LITERAL  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void read​(java.io.InputStream in, java.lang.String baseURI, ContentType ct, StreamRDF output, Context context)
      Read from an InputStream and output RDF on the StreamRDF.
      void read​(java.io.Reader reader, java.lang.String baseURI, ContentType ct, StreamRDF output, Context context)
      Read from an InputStream and output RDF on the StreamRDF.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JSONLD_CONTEXT

        public static final Symbol JSONLD_CONTEXT
        Symbol to use to pass (in a Context object) the "@context" to be used when reading jsonld (overriding the actual @context in the jsonld) Expected value: the value of the "@context", as expected by the JSONLD-java API (a Map)
      • JSONLD_OPTIONS

        public static final Symbol JSONLD_OPTIONS
        value: the option object expected by JsonLdProcessor (instance of JsonLdOptions)
      • LITERAL

        public static java.lang.String LITERAL
      • BLANK_NODE

        public static java.lang.String BLANK_NODE
      • IRI

        public static java.lang.String IRI
    • Method Detail

      • read

        public void read​(java.io.Reader reader,
                         java.lang.String baseURI,
                         ContentType ct,
                         StreamRDF output,
                         Context context)
        Description copied from interface: ReaderRIOT
        Read from an InputStream and output RDF on the StreamRDF.
        Specified by:
        read in interface ReaderRIOT
        Parameters:
        reader - Reader. InputStreams are preferred because Reader do not allow RIOT to set the character set.
        baseURI - Base URI (or null)
        ct - Content-Type if available. Routing to the right parser will have already been done so this only useful to get addition Content-Type information or if this ReaderRIOT can handle multiple media types.
        output - Destination for the parser output.
        context - Environment settings.
      • read

        public void read​(java.io.InputStream in,
                         java.lang.String baseURI,
                         ContentType ct,
                         StreamRDF output,
                         Context context)
        Description copied from interface: ReaderRIOT
        Read from an InputStream and output RDF on the StreamRDF.
        Specified by:
        read in interface ReaderRIOT
        Parameters:
        in - InputStream
        baseURI - Base URI (or null)
        ct - Content-Type if available. Routing to the right parser will have already been done so this only useful to get addition Content-Type information or if this ReaderRIOT can handle multiple media types.
        output - Destination for the parser output.
        context - Environment settings.