Class RdfDocument

  • All Implemented Interfaces:
    Document

    public final class RdfDocument
    extends java.lang.Object
    implements Document
    • Field Detail

      • contentType

        private final MediaType contentType
      • profile

        private final java.lang.String profile
      • documentUrl

        private java.net.URI documentUrl
      • contentUrl

        private java.net.URI contentUrl
    • Constructor Detail

      • RdfDocument

        private RdfDocument​(MediaType type,
                            java.lang.String profile,
                            RdfDataset dataset)
    • Method Detail

      • of

        public static RdfDocument of​(java.io.InputStream is)
                              throws JsonLdError
        Create a new document from content provided by InputStream. Sets MediaType.N_QUADS as the content type.
        Parameters:
        is - representing parsed RDF content
        Returns:
        Document representing RDF document
        Throws:
        JsonLdError
      • of

        public static Document of​(java.io.Reader reader)
                           throws JsonLdError
        Create a new document from content provided by Reader. Sets MediaType.N_QUADS as the content type.
        Parameters:
        reader - providing RDF content
        Returns:
        Document representing RDF document
        Throws:
        JsonLdError
      • accepts

        public static boolean accepts​(MediaType contentType)
      • assertContentType

        private static void assertContentType​(MediaType contentType)
      • getContentType

        public MediaType getContentType()
        Description copied from interface: Document
        The Content-Type of the loaded document, exclusive of any optional parameters.
        Specified by:
        getContentType in interface Document
        Returns:
        Content-Type of the loaded document, never null
      • getContextUrl

        public java.net.URI getContextUrl()
        Description copied from interface: Document
        The value of the HTTP Link header when profile attribute matches http://www.w3.org/ns/json-ld#context.
        Specified by:
        getContextUrl in interface Document
        Returns:
        attached URI referencing document context or null if not available
      • setContextUrl

        public void setContextUrl​(java.net.URI contextUrl)
        Specified by:
        setContextUrl in interface Document
      • getDocumentUrl

        public java.net.URI getDocumentUrl()
        Description copied from interface: Document
        The final URI of the loaded document.
        Specified by:
        getDocumentUrl in interface Document
        Returns:
        URI of the loaded document or null if not available
      • setDocumentUrl

        public void setDocumentUrl​(java.net.URI documentUrl)
        Specified by:
        setDocumentUrl in interface Document
      • getProfile

        public java.util.Optional<java.lang.String> getProfile()
        Description copied from interface: Document
        The value of any profile parameter retrieved as part of the original Document.getContentType().
        Specified by:
        getProfile in interface Document
        Returns:
        document profile or Optional.empty()
      • getRdfContent

        public java.util.Optional<RdfDataset> getRdfContent()
        Description copied from interface: Document
        Get the document content as parsed RdfDataset.
        Specified by:
        getRdfContent in interface Document
        Returns:
        RdfDataset or Optional.empty() if document content is not in application/n-quads representation