Class JsonLDWriter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Symbol JSONLD_ADD_ALL_PREFIXES_TO_CONTEXT
      if creating a (jsonld) context from dataset, should we include all the prefixes defined in graph's prefix mappings value: a Boolean (default: true)
      static Symbol JSONLD_CONTEXT
      Expected value: the value of the "@context" (a JSON String, or the object expected by the JSONLD-java API)
      static Symbol JSONLD_CONTEXT_SUBSTITUTION
      Expected value: the value of the "@context" to be put in final output (a JSON String) This is NOT the context used to produce the output (given by JSONLD_CONTEXT, or computed from the input RDF.
      static Symbol JSONLD_FRAME
      value: a JSON String, or the frame object expected by JsonLdProcessor.frame
      static Symbol JSONLD_OPTIONS
      value: the option object expected by JsonLdProcessor (instance of JsonLdOptions)
    • Field Detail

      • JSONLD_CONTEXT

        public static final Symbol JSONLD_CONTEXT
        Expected value: the value of the "@context" (a JSON String, or the object expected by the JSONLD-java API)
      • JSONLD_CONTEXT_SUBSTITUTION

        public static final Symbol JSONLD_CONTEXT_SUBSTITUTION
        Expected value: the value of the "@context" to be put in final output (a JSON String) This is NOT the context used to produce the output (given by JSONLD_CONTEXT, or computed from the input RDF. It is something that will replace the @context content. This is useful
        1. for the cases you want to have a URI as value of @context, without having JSON-LD java to download it and
        2. as a trick to change the URIs in your result.
        Only for compact and flatten formats. Note that it is supposed to be a JSON String: to set the value of @context to a URI, the String must be quoted.
      • JSONLD_FRAME

        public static final Symbol JSONLD_FRAME
        value: a JSON String, or the frame object expected by JsonLdProcessor.frame
      • JSONLD_OPTIONS

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

        public static final Symbol JSONLD_ADD_ALL_PREFIXES_TO_CONTEXT
        if creating a (jsonld) context from dataset, should we include all the prefixes defined in graph's prefix mappings value: a Boolean (default: true)
    • Constructor Detail

      • JsonLDWriter

        public JsonLDWriter​(RDFFormat syntaxForm)
    • Method Detail

      • getLang

        public Lang getLang()
      • write

        public void write​(java.io.Writer out,
                          DatasetGraph dataset,
                          PrefixMap prefixMap,
                          java.lang.String baseURI,
                          Context context)
        Description copied from interface: WriterDatasetRIOT
        Use of Writer is discouraged - let the serializer manage character sets in accordance with the format
        Specified by:
        write in interface WriterDatasetRIOT
        Specified by:
        write in class WriterDatasetRIOTBase
        Parameters:
        out - Writer
        dataset - DatasetGraph to be written
        prefixMap - PrefixMap - maybe null (default should be to use the prefix mapping from the Graph)
        baseURI - base URI - may be null for "none"
        context - Context (see specific implementation for details)
      • write

        public void write​(java.io.OutputStream out,
                          DatasetGraph dataset,
                          PrefixMap prefixMap,
                          java.lang.String baseURI,
                          Context context)
        Specified by:
        write in interface WriterDatasetRIOT
        Specified by:
        write in class WriterDatasetRIOTBase
        Parameters:
        out - OutputStream
        dataset - DatasetGraph to be written
        prefixMap - PrefixMap - maybe null (default should be to use the prefix mapping from the Graph)
        baseURI - base URI - may be null for "none"
        context - Context (see specific implementation for details)
      • toJsonLDJavaAPI

        public static java.lang.Object toJsonLDJavaAPI​(RDFFormat.JSONLDVariant variant,
                                                       DatasetGraph dataset,
                                                       PrefixMap prefixMap,
                                                       java.lang.String baseURI,
                                                       Context jenaContext)
                                                throws com.github.jsonldjava.core.JsonLdError,
                                                       com.fasterxml.jackson.core.JsonParseException,
                                                       java.io.IOException
        the JsonLD-java API object corresponding to a dataset and a JsonLD format.
        Throws:
        com.github.jsonldjava.core.JsonLdError
        com.fasterxml.jackson.core.JsonParseException
        java.io.IOException