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 Object
implements CommonApi<CompactionApi>, LoaderApi<CompactionApi>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Document
private final URI
private final Document
private final URI
private JsonLdOptions
-
Constructor Summary
ConstructorsConstructorDescriptionCompactionApi
(URI documentUri, URI contextUri) CompactionApi
(URI documentUri, Document context) CompactionApi
(Document document, URI contextUri) CompactionApi
(Document document, Document context) -
Method Summary
Modifier and TypeMethodDescriptionSet the baseIRI
.The processor replaces arrays with just one element.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.IRIs are compacted relative to thebase(URI)
or document location.compactToRelative
(boolean enable) Determines if IRIs are compacted relative to thebase(URI)
or document location .jakarta.json.JsonObject
get()
Get the result of compaction.loader
(DocumentLoader loader) Set the loader to be used to retrieve remote documents and contexts, implementing theDocumentLoader
.mode
(JsonLdVersion processingMode) SetJSON-LD
processing mode.options
(JsonLdOptions options) Override an existing settings withJsonLdOptions
.ordered
(boolean enable) If set totrue
, certain algorithm processing steps are ordered lexicographically.rdfStar()
Experimental: Enables JSON-LD-STAR extension.
-
Field Details
-
document
-
documentUri
-
context
-
contextUri
-
options
-
-
Constructor Details
-
CompactionApi
-
CompactionApi
-
CompactionApi
-
CompactionApi
-
-
Method Details
-
options
Description copied from interface:CommonApi
Override an existing settings withJsonLdOptions
.- Specified by:
options
in interfaceCommonApi<CompactionApi>
- Parameters:
options
-JsonLdOptions
- Returns:
- builder instance
-
mode
Description copied from interface:CommonApi
SetJSON-LD
processing mode. JSON-LD 1.1 is set by default.- Specified by:
mode
in interfaceCommonApi<CompactionApi>
- Parameters:
processingMode
- to set- Returns:
- builder instance
-
base
Description copied from interface:CommonApi
Set the baseIRI
. If set, this overrides the input document's IRI.- Specified by:
base
in interfaceCommonApi<CompactionApi>
- Parameters:
baseUri
-- Returns:
- builder instance
-
compactArrays
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.true
by default.- Parameters:
enable
-- Returns:
- builder instance
-
compactArrays
The processor replaces arrays with just one element.- Returns:
CompactionApi
instance
-
compactToRelative
Determines if IRIs are compacted relative to thebase(URI)
or document location .true
by default.- Parameters:
enable
-- Returns:
- builder instance
-
compactToRelative
IRIs are compacted relative to thebase(URI)
or document location.- Returns:
- builder instance
-
loader
Description copied from interface:LoaderApi
Set 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:
loader
in interfaceLoaderApi<CompactionApi>
- Parameters:
loader
-- Returns:
- builder instance
-
ordered
Description copied from interface:CommonApi
If set totrue
, certain algorithm processing steps are ordered lexicographically. Iffalse
, order is not considered in processing.- Specified by:
ordered
in interfaceCommonApi<CompactionApi>
- Parameters:
enable
-- Returns:
- builder instance
-
rdfStar
Experimental: Enables JSON-LD-STAR extension. Disabled by default.- Returns:
- builder instance
- See Also:
-
get
Get the result of compaction.- Returns:
JsonObject
representing compacted document- Throws:
JsonLdError
-