Package com.apicatalog.jsonld.document
Class RdfDocument
- java.lang.Object
-
- com.apicatalog.jsonld.document.RdfDocument
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccepts(MediaType contentType)MediaTypegetContentType()The Content-Type of the loaded document, exclusive of any optional parameters.URIgetContextUrl()The value of the HTTP Link header when profile attribute matcheshttp://www.w3.org/ns/json-ld#context.URIgetDocumentUrl()The finalURIof the loaded document.Optional<String>getProfile()The value of anyprofileparameter retrieved as part of the originalDocument.getContentType().Optional<RdfDataset>getRdfContent()Get the document content as parsedRdfDataset.static Documentof(MediaType contentType, RdfDataset dataset)Create a new document fromRdfDataset.static RdfDocumentof(MediaType type, InputStream is)static Documentof(MediaType type, Reader reader)static Documentof(RdfDataset dataset)Create a new document fromRdfDataset.static RdfDocumentof(InputStream is)Create a new document from content provided byInputStream.static Documentof(Reader reader)Create a new document from content provided byReader.voidsetContextUrl(URI contextUrl)voidsetDocumentUrl(URI documentUrl)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apicatalog.jsonld.document.Document
getJsonContent
-
-
-
-
Method Detail
-
of
public static final 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 final 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 final RdfDocument of(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 final RdfDocument of(MediaType type, InputStream is) throws JsonLdError
- Throws:
JsonLdError
-
of
public static final Document of(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 final Document of(MediaType type, Reader reader) throws JsonLdError
- Throws:
JsonLdError
-
accepts
public static final boolean accepts(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 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(URI contextUrl)
- Specified by:
setContextUrlin interfaceDocument
-
getDocumentUrl
public 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(URI documentUrl)
- Specified by:
setDocumentUrlin interfaceDocument
-
getProfile
public Optional<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 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
-
-