Package no.hasmac.jsonld.document
Class RdfDocument
java.lang.Object
no.hasmac.jsonld.document.RdfDocument
- All Implemented Interfaces:
Document
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MediaType
private URI
private final RdfDataset
private URI
private final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
RdfDocument
(MediaType type, String profile, RdfDataset dataset) -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
private static void
assertContentType
(MediaType contentType) The Content-Type of the loaded document, exclusive of any optional parameters.The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context
.The finalURI
of the loaded document.The value of anyprofile
parameter retrieved as part of the originalDocument.getContentType()
.Get the document content as parsedRdfDataset
.static RdfDocument
of
(InputStream is) Create a new document from content provided byInputStream
.static Document
Create a new document from content provided byReader
.static RdfDocument
of
(MediaType type, InputStream is) static Document
static Document
of
(MediaType contentType, RdfDataset dataset) Create a new document fromRdfDataset
.static Document
of
(RdfDataset dataset) Create a new document fromRdfDataset
.void
setContextUrl
(URI contextUrl) void
setDocumentUrl
(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 Details
-
contentType
-
dataset
-
profile
-
documentUrl
-
contentUrl
-
-
Constructor Details
-
RdfDocument
-
-
Method Details
-
of
Create a new document fromRdfDataset
. SetsMediaType.N_QUADS
as the content type.- Parameters:
dataset
- representing parsed RDF content- Returns:
Document
representing RDF document
-
of
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
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
- Throws:
JsonLdError
-
of
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
- Throws:
JsonLdError
-
accepts
-
assertContentType
-
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
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
- Specified by:
setContextUrl
in interfaceDocument
-
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
- Specified by:
setDocumentUrl
in interfaceDocument
-
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
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
-