Class JSONLDWriter

    • Field Detail

      • model

        private final Model model
      • baseURI

        private final java.lang.String baseURI
      • writer

        private final java.io.Writer writer
    • Constructor Detail

      • JSONLDWriter

        public JSONLDWriter​(java.io.OutputStream outputStream)
        Create a JSONLDWriter using a OutputStream
        Parameters:
        outputStream - The OutputStream to write to.
      • JSONLDWriter

        public JSONLDWriter​(java.io.OutputStream outputStream,
                            java.lang.String baseURI)
        Create a JSONLDWriter using a OutputStream
        Parameters:
        outputStream - The OutputStream to write to.
        baseURI - base URI
      • JSONLDWriter

        public JSONLDWriter​(java.io.Writer writer)
        Create a JSONLDWriter using a Writer
        Parameters:
        writer - The Writer to write to.
      • JSONLDWriter

        public JSONLDWriter​(java.io.Writer writer,
                            java.lang.String baseURI)
        Create a JSONLDWriter using a Writer
        Parameters:
        writer - The Writer to write to.
        baseURI - base URI
    • Method Detail

      • getWriter

        public java.io.Writer getWriter()
        Description copied from interface: CharSink
        get the Writer used by this CharSink.
        Specified by:
        getWriter in interface CharSink
        Returns:
        an Writer
      • handleNamespace

        public void handleNamespace​(java.lang.String prefix,
                                    java.lang.String uri)
                             throws RDFHandlerException
        Description copied from interface: RDFHandler
        Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.
        Specified by:
        handleNamespace in interface RDFHandler
        Overrides:
        handleNamespace in class AbstractRDFWriter
        Parameters:
        prefix - The prefix for the namespace, or an empty string in case of a default namespace.
        uri - The URI that the prefix maps to.
        Throws:
        RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
      • endRDF

        public void endRDF()
                    throws RDFHandlerException
        Description copied from interface: RDFHandler
        Signals the end of the RDF data. This method is called when all data has been reported.
        Specified by:
        endRDF in interface RDFHandler
        Throws:
        RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
      • addPrefixes

        private static void addPrefixes​(java.util.Map<java.lang.String,​java.lang.Object> ctx,
                                        java.util.Set<Namespace> namespaces)
        Add name space prefixes to JSON-LD context, empty prefix gets the '@vocab' prefix
        Parameters:
        ctx - context
        namespaces - set of RDF name spaces