Package no.hasmac.jsonld.document
Class RdfDocument
- java.lang.Object
-
- no.hasmac.jsonld.document.RdfDocument
-
-
Field Summary
Fields Modifier and Type Field Description private MediaTypecontentTypeprivate java.net.URIcontentUrlprivate RdfDatasetdatasetprivate java.net.URIdocumentUrlprivate java.lang.Stringprofile
-
Constructor Summary
Constructors Modifier Constructor Description privateRdfDocument(MediaType type, java.lang.String profile, RdfDataset dataset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccepts(MediaType contentType)private static voidassertContentType(MediaType contentType)MediaTypegetContentType()The Content-Type of the loaded document, exclusive of any optional parameters.java.net.URIgetContextUrl()The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context.java.net.URIgetDocumentUrl()The finalURIof the loaded document.java.util.Optional<java.lang.String>getProfile()The value of anyprofileparameter retrieved as part of the originalDocument.getContentType().java.util.Optional<RdfDataset>getRdfContent()Get the document content as parsedRdfDataset.static RdfDocumentof(java.io.InputStream is)Create a new document from content provided byInputStream.static Documentof(java.io.Reader reader)Create a new document from content provided byReader.static RdfDocumentof(MediaType type, java.io.InputStream is)static Documentof(MediaType type, java.io.Reader reader)static Documentof(MediaType contentType, RdfDataset dataset)Create a new document fromRdfDataset.static Documentof(RdfDataset dataset)Create a new document fromRdfDataset.voidsetContextUrl(java.net.URI contextUrl)voidsetDocumentUrl(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_QUADSas the content type.- Parameters:
dataset- representing parsed RDF content- Returns:
Documentrepresenting RDF document
-
of
public static Document of(MediaType contentType, RdfDataset dataset)
Create a new document fromRdfDataset.- Parameters:
contentType- reflecting the providedRdfDataset, onlyMediaType.N_QUADSis supporteddataset- representing parsed RDF content- Returns:
Documentrepresenting RDF document
-
of
public static RdfDocument of(java.io.InputStream is) throws JsonLdError
Create a new document from content provided byInputStream. SetsMediaType.N_QUADSas the content type.- Parameters:
is- representing parsed RDF content- Returns:
Documentrepresenting 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_QUADSas the content type.- Parameters:
reader- providing RDF content- Returns:
Documentrepresenting 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:DocumentThe Content-Type of the loaded document, exclusive of any optional parameters.- Specified by:
getContentTypein interfaceDocument- Returns:
Content-Typeof the loaded document, nevernull
-
getContextUrl
public java.net.URI getContextUrl()
Description copied from interface:DocumentThe value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context.- Specified by:
getContextUrlin interfaceDocument- Returns:
- attached
URIreferencing document context ornullif not available
-
setContextUrl
public void setContextUrl(java.net.URI contextUrl)
- Specified by:
setContextUrlin interfaceDocument
-
getDocumentUrl
public java.net.URI getDocumentUrl()
Description copied from interface:DocumentThe finalURIof the loaded document.- Specified by:
getDocumentUrlin interfaceDocument- Returns:
URIof the loaded document ornullif not available
-
setDocumentUrl
public void setDocumentUrl(java.net.URI documentUrl)
- Specified by:
setDocumentUrlin interfaceDocument
-
getProfile
public java.util.Optional<java.lang.String> getProfile()
Description copied from interface:DocumentThe value of anyprofileparameter retrieved as part of the originalDocument.getContentType().- Specified by:
getProfilein interfaceDocument- Returns:
- document profile or
Optional.empty()
-
getRdfContent
public java.util.Optional<RdfDataset> getRdfContent()
Description copied from interface:DocumentGet the document content as parsedRdfDataset.- Specified by:
getRdfContentin interfaceDocument- Returns:
RdfDatasetorOptional.empty()if document content is not inapplication/n-quadsrepresentation
-
-