Package no.hasmac.jsonld.api
Class CompactionApi
- java.lang.Object
-
- no.hasmac.jsonld.api.CompactionApi
-
- All Implemented Interfaces:
CommonApi<CompactionApi>,LoaderApi<CompactionApi>
public final class CompactionApi extends java.lang.Object implements CommonApi<CompactionApi>, LoaderApi<CompactionApi>
-
-
Field Summary
Fields Modifier and Type Field Description private Documentcontextprivate java.net.URIcontextUriprivate Documentdocumentprivate java.net.URIdocumentUriprivate JsonLdOptionsoptions
-
Constructor Summary
Constructors Constructor Description CompactionApi(java.net.URI documentUri, java.net.URI contextUri)CompactionApi(java.net.URI documentUri, Document context)CompactionApi(Document document, java.net.URI contextUri)CompactionApi(Document document, Document context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompactionApibase(java.net.URI baseUri)Set the baseIRI.CompactionApicompactArrays()The processor replaces arrays with just one element.CompactionApicompactArrays(boolean enable)If set totrue, the processor replaces arrays with just one element If set to false, all arrays will remain arrays even if they have just one element.CompactionApicompactToRelative()IRIs are compacted relative to thebase(URI)or document location.CompactionApicompactToRelative(boolean enable)Determines if IRIs are compacted relative to thebase(URI)or document location .jakarta.json.JsonObjectget()Get the result of compaction.CompactionApiloader(DocumentLoader loader)Set the loader to be used to retrieve remote documents and contexts, implementing theDocumentLoader.CompactionApimode(JsonLdVersion processingMode)SetJSON-LDprocessing mode.CompactionApioptions(JsonLdOptions options)Override an existing settings withJsonLdOptions.CompactionApiordered(boolean enable)If set totrue, certain algorithm processing steps are ordered lexicographically.CompactionApirdfStar()Experimental: Enables JSON-LD-STAR extension.
-
-
-
Field Detail
-
document
private final Document document
-
documentUri
private final java.net.URI documentUri
-
context
private final Document context
-
contextUri
private final java.net.URI contextUri
-
options
private JsonLdOptions options
-
-
Method Detail
-
options
public CompactionApi options(JsonLdOptions options)
Description copied from interface:CommonApiOverride an existing settings withJsonLdOptions.- Specified by:
optionsin interfaceCommonApi<CompactionApi>- Parameters:
options-JsonLdOptions- Returns:
- builder instance
-
mode
public CompactionApi mode(JsonLdVersion processingMode)
Description copied from interface:CommonApiSetJSON-LDprocessing mode. JSON-LD 1.1 is set by default.- Specified by:
modein interfaceCommonApi<CompactionApi>- Parameters:
processingMode- to set- Returns:
- builder instance
-
base
public CompactionApi base(java.net.URI baseUri)
Description copied from interface:CommonApiSet the baseIRI. If set, this overrides the input document's IRI.- Specified by:
basein interfaceCommonApi<CompactionApi>- Returns:
- builder instance
-
compactArrays
public CompactionApi compactArrays(boolean enable)
If set totrue, the processor replaces arrays with just one element If set to false, all arrays will remain arrays even if they have just one element.trueby default.- Parameters:
enable-- Returns:
- builder instance
-
compactArrays
public CompactionApi compactArrays()
The processor replaces arrays with just one element.- Returns:
CompactionApiinstance
-
compactToRelative
public CompactionApi compactToRelative(boolean enable)
Determines if IRIs are compacted relative to thebase(URI)or document location .trueby default.- Parameters:
enable-- Returns:
- builder instance
-
compactToRelative
public CompactionApi compactToRelative()
IRIs are compacted relative to thebase(URI)or document location.- Returns:
- builder instance
-
loader
public CompactionApi loader(DocumentLoader loader)
Description copied from interface:LoaderApiSet the loader to be used to retrieve remote documents and contexts, implementing theDocumentLoader. If specified, it is used to retrieve remote documents and contexts; otherwise, if not specified, the processor's built-in loader is used.- Specified by:
loaderin interfaceLoaderApi<CompactionApi>- Returns:
- builder instance
-
ordered
public CompactionApi ordered(boolean enable)
Description copied from interface:CommonApiIf set totrue, certain algorithm processing steps are ordered lexicographically. Iffalse, order is not considered in processing.- Specified by:
orderedin interfaceCommonApi<CompactionApi>- Returns:
- builder instance
-
rdfStar
public CompactionApi rdfStar()
Experimental: Enables JSON-LD-STAR extension. Disabled by default.- Returns:
- builder instance
- See Also:
- JSON-LD-STAR Draft
-
get
public jakarta.json.JsonObject get() throws JsonLdErrorGet the result of compaction.- Returns:
JsonObjectrepresenting compacted document- Throws:
JsonLdError
-
-