Package no.hasmac.jsonld.document
Class RdfDocument
- java.lang.Object
-
- no.hasmac.jsonld.document.RdfDocument
-
-
Field Summary
Fields Modifier and Type Field Description private MediaType
contentType
private java.net.URI
contentUrl
private RdfDataset
dataset
private java.net.URI
documentUrl
private java.lang.String
profile
-
Constructor Summary
Constructors Modifier Constructor Description private
RdfDocument(MediaType type, java.lang.String profile, RdfDataset dataset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
accepts(MediaType contentType)
private static void
assertContentType(MediaType contentType)
MediaType
getContentType()
The Content-Type of the loaded document, exclusive of any optional parameters.java.net.URI
getContextUrl()
The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context
.java.net.URI
getDocumentUrl()
The finalURI
of the loaded document.java.util.Optional<java.lang.String>
getProfile()
The value of anyprofile
parameter retrieved as part of the originalDocument.getContentType()
.java.util.Optional<RdfDataset>
getRdfContent()
Get the document content as parsedRdfDataset
.static RdfDocument
of(java.io.InputStream is)
Create a new document from content provided byInputStream
.static Document
of(java.io.Reader reader)
Create a new document from content provided byReader
.static RdfDocument
of(MediaType type, java.io.InputStream is)
static Document
of(MediaType type, java.io.Reader reader)
static Document
of(MediaType contentType, RdfDataset dataset)
Create a new document fromRdfDataset
.static Document
of(RdfDataset dataset)
Create a new document fromRdfDataset
.void
setContextUrl(java.net.URI contextUrl)
void
setDocumentUrl(java.net.URI documentUrl)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface no.hasmac.jsonld.document.Document
getJsonContent
-
-
-
-
Field Detail
-
contentType
private final MediaType contentType
-
dataset
private final RdfDataset dataset
-
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 Document of(RdfDataset dataset)
Create a new document fromRdfDataset
. SetsMediaType.N_QUADS
as the content type.- Parameters:
dataset
- representing parsed RDF content- Returns:
Document
representing RDF document
-
of
public static Document of(MediaType contentType, RdfDataset dataset)
Create a new document fromRdfDataset
.- Parameters:
contentType
- reflecting the providedRdfDataset
, onlyMediaType.N_QUADS
is supporteddataset
- representing parsed RDF content- Returns:
Document
representing RDF document
-
of
public static RdfDocument of(java.io.InputStream is) throws JsonLdError
Create a new document from content provided byInputStream
. SetsMediaType.N_QUADS
as the content type.- Parameters:
is
- representing parsed RDF content- Returns:
Document
representing RDF document- Throws:
JsonLdError
-
of
public static RdfDocument of(MediaType type, java.io.InputStream is) throws JsonLdError
- Throws:
JsonLdError
-
of
public static Document of(java.io.Reader reader) throws JsonLdError
Create a new document from content provided byReader
. SetsMediaType.N_QUADS
as the content type.- Parameters:
reader
- providing RDF content- Returns:
Document
representing RDF document- Throws:
JsonLdError
-
of
public static Document of(MediaType type, java.io.Reader reader) throws JsonLdError
- 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 interfaceDocument
- Returns:
Content-Type
of the loaded document, nevernull
-
getContextUrl
public java.net.URI getContextUrl()
Description copied from interface:Document
The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context
.- Specified by:
getContextUrl
in interfaceDocument
- Returns:
- attached
URI
referencing document context ornull
if not available
-
setContextUrl
public void setContextUrl(java.net.URI contextUrl)
- Specified by:
setContextUrl
in interfaceDocument
-
getDocumentUrl
public java.net.URI getDocumentUrl()
Description copied from interface:Document
The finalURI
of the loaded document.- Specified by:
getDocumentUrl
in interfaceDocument
- Returns:
URI
of the loaded document ornull
if not available
-
setDocumentUrl
public void setDocumentUrl(java.net.URI documentUrl)
- Specified by:
setDocumentUrl
in interfaceDocument
-
getProfile
public java.util.Optional<java.lang.String> getProfile()
Description copied from interface:Document
The value of anyprofile
parameter retrieved as part of the originalDocument.getContentType()
.- Specified by:
getProfile
in interfaceDocument
- Returns:
- document profile or
Optional.empty()
-
getRdfContent
public java.util.Optional<RdfDataset> getRdfContent()
Description copied from interface:Document
Get the document content as parsedRdfDataset
.- Specified by:
getRdfContent
in interfaceDocument
- Returns:
RdfDataset
orOptional.empty()
if document content is not inapplication/n-quads
representation
-
-