Class JsonLdOptions

    • Field Detail

      • base

        private java.net.URI base
        The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.
      • compactArrays

        private boolean compactArrays
        If set to true, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.
      • compactToRelative

        private boolean compactToRelative
        Determines if IRIs are compacted relative to the base option or document location when compacting.
      • documentLoader

        private DocumentLoader documentLoader
        The callback of the loader to be used to retrieve remote documents and contexts, implementing the LoadDocumentCallback. If specified, it is used to retrieve remote documents and contexts; otherwise, if not specified, the processor's built-in loader is used.
      • expandContext

        private Document expandContext
        A context that is used to initialize the active context when expanding a document.
      • extractAllScripts

        private boolean extractAllScripts
      • ordered

        private boolean ordered
      • produceGeneralizedRdf

        private boolean produceGeneralizedRdf
      • useNativeTypes

        private boolean useNativeTypes
      • useRdfType

        private boolean useRdfType
      • explicit

        private boolean explicit
      • omitDefault

        private boolean omitDefault
      • omitGraph

        private java.lang.Boolean omitGraph
      • requiredAll

        private boolean requiredAll
      • rdfStar

        private boolean rdfStar
      • numericId

        private boolean numericId
      • contextCache

        private Cache<java.lang.String,​jakarta.json.JsonValue> contextCache
      • documentCache

        private Cache<java.lang.String,​Document> documentCache
      • timeout

        private java.time.Duration timeout
    • Constructor Detail

      • JsonLdOptions

        public JsonLdOptions()
    • Method Detail

      • getBase

        public java.net.URI getBase()
        The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.
        Returns:
        the base URI or null
      • isCompactArrays

        public boolean isCompactArrays()
        If set to true, the processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.
        Returns:
        true if array compaction is enabled
      • isCompactToRelative

        public boolean isCompactToRelative()
        Determines if IRIs are compacted relative to the getBase() option or document location when compacting.
        Returns:
        true if IRI relativization is enabled
      • getDocumentLoader

        public DocumentLoader getDocumentLoader()
        The callback of the loader to be used to retrieve remote documents and contexts, implementing the DocumentLoader. If specified, it is used to retrieve remote documents and contexts; otherwise, if not specified, the processor's built-in loader is used.
        Returns:
        the loader or null is is not set
      • isOrdered

        public boolean isOrdered()
        If set to true, certain algorithm processing steps where indicated are ordered lexicographically. If false, order is not considered in processing.
        Returns:
        true if array sorting is enabled
      • isProduceGeneralizedRdf

        public boolean isProduceGeneralizedRdf()
      • isUseNativeTypes

        public boolean isUseNativeTypes()
      • isUseRdfType

        public boolean isUseRdfType()
      • getExpandContext

        public Document getExpandContext()
      • setBase

        public void setBase​(java.net.URI baseUri)
      • setCompactArrays

        public void setCompactArrays​(boolean compactArrays)
      • setCompactToRelative

        public void setCompactToRelative​(boolean compactToRelative)
      • setDocumentLoader

        public void setDocumentLoader​(DocumentLoader documentLoader)
      • setExtractAllScripts

        public void setExtractAllScripts​(boolean extractAllScripts)
      • setOrdered

        public void setOrdered​(boolean ordered)
      • setProcessingMode

        public void setProcessingMode​(JsonLdVersion processingMode)
      • setProduceGeneralizedRdf

        public void setProduceGeneralizedRdf​(boolean produceGeneralizedRdf)
      • setUseNativeTypes

        public void setUseNativeTypes​(boolean useNativeTypes)
      • setUseRdfType

        public void setUseRdfType​(boolean useRdfType)
      • setExpandContext

        public void setExpandContext​(java.lang.String contextLocation)
      • setExpandContext

        public void setExpandContext​(java.net.URI contextUri)
      • setExpandContext

        public void setExpandContext​(jakarta.json.JsonObject context)
      • setExpandContext

        public void setExpandContext​(Document context)
      • setEmbed

        public void setEmbed​(JsonLdEmbed embed)
      • isExplicit

        public boolean isExplicit()
      • setExplicit

        public void setExplicit​(boolean explicit)
      • isOmitDefault

        public boolean isOmitDefault()
      • setOmitDefault

        public void setOmitDefault​(boolean omitDefault)
      • isOmitGraph

        public java.lang.Boolean isOmitGraph()
      • setOmitGraph

        public void setOmitGraph​(java.lang.Boolean omitGraph)
      • isRequiredAll

        public boolean isRequiredAll()
      • setRequiredAll

        public void setRequiredAll​(boolean requiredAll)
      • setNumericId

        public void setNumericId​(boolean enable)
        Experimental: Enables/Disables numeric @id support.
        Parameters:
        enable - numeric @id support
      • isNumericId

        public boolean isNumericId()
        Experimental: Numeric @id support state. Disabled by default.
        Returns:
        true if numeric @id support is enabled
      • getContextCache

        public Cache<java.lang.String,​jakarta.json.JsonValue> getContextCache()
      • setContextCache

        public void setContextCache​(Cache<java.lang.String,​jakarta.json.JsonValue> contextCache)
      • getDocumentCache

        public Cache<java.lang.String,​Document> getDocumentCache()
      • setDocumentCache

        public void setDocumentCache​(Cache<java.lang.String,​Document> documentCache)
      • isRdfStar

        public boolean isRdfStar()
      • setRdfStar

        public void setRdfStar​(boolean rdfStar)
        Experimental: Enables JSON-LD-STAR extension. Only expansion is supported. Disabled by default.
        See Also:
        JSON-LD-STAR Draft
      • isUriValidation

        @Deprecated
        public boolean isUriValidation()
        Deprecated.
        use JsonLdOptions#getUriValidation
        if disabled only URIs required for processing are parsed and validated. Disabling URI validation might improve performance depending on the number of processed URIs.

        Warning: Disabled validation could cause an invalid output.

        Enabled by default.

        Returns:
        true if full validation is enabled
      • setUriValidation

        @Deprecated
        public void setUriValidation​(boolean enabled)
        Deprecated.
        since 1.5.0, use JsonLdOptions#setUriValidation(com.apicatalog.jsonld.uri.UriValidationPolicy)
        if disabled only URIs required for processing are parsed and validated. Disabling URI validation might improve performance depending on the number of processed URIs.

        Warning: Disabled validation could cause an invalid output.

        Enabled by default.

        Parameters:
        enabled - set true to enable validation
      • setUriValidation

        public void setUriValidation​(UriValidationPolicy uriValidation)
        Sets the URI validation policy. By default, the policy is set to Full.

        Note: Changing this policy may produce unexpected or non-compliant results, depending on the specified validation rules.

        Parameters:
        uriValidation - the desired URI validation policy
        Since:
        1.5.0
      • getTimeout

        public java.time.Duration getTimeout()
        A processing timeout. An exception is thrown when a processing time exceeds the duration, if set. There is no currency that processing gets terminated immediately, but eventually. Please note, the timeout does not include time consumed by DocumentLoader.
        Returns:
        a duration after which a processing is prematurely terminated.
      • setTimeout

        public void setTimeout​(java.time.Duration timeout)
        Set a pressing timeout. A processing is eventually terminated after the specified duration. Set null for no timeout. Please note, the timeout does not include time consumed by DocumentLoader.
        Parameters:
        timeout - to limit processing time
      • getUndefinedTermsPolicy

        public JsonLdOptions.ProcessingPolicy getUndefinedTermsPolicy()
        A processing policy on how proceed with an undefined term during expansion.
        Returns:
        the processing policy, never null
      • setUndefinedTermsPolicy

        public void setUndefinedTermsPolicy​(JsonLdOptions.ProcessingPolicy undefinedTerms)
        Set processing policy on how proceed with an undefined term during expansion. Ignore by default.
        Parameters:
        undefinedTerms - the processing policy, never null