Package com.apicatalog.jsonld.api
Class ToRdfApi
- java.lang.Object
-
- com.apicatalog.jsonld.api.ToRdfApi
-
-
Field Summary
Fields Modifier and Type Field Description private Documentdocumentprivate java.net.URIdocumentUriprivate JsonLdOptionsoptions
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ToRdfApibase(java.net.URI baseUri)Set the baseIRI.ToRdfApicontext(Document context)A context that is used to initialize the active context.ToRdfApicontext(jakarta.json.JsonStructure context)A context that is used to initialize the active context.ToRdfApicontext(java.lang.String contextLocation)A context that is used to initialize the active context.ToRdfApicontext(java.net.URI contextUri)A context that is used to initialize the active context.RdfDatasetget()Deprecated.since 1.7.0 - Useprovide(RdfQuadConsumer)instead.ToRdfApiloader(DocumentLoader loader)Set the loader to be used to retrieve remote documents and contexts, implementing theDocumentLoader.ToRdfApimode(JsonLdVersion processingMode)SetJSON-LDprocessing mode.ToRdfApinumericId()Experimental: Accept numeric@id.ToRdfApioptions(JsonLdOptions options)Override an existing settings withJsonLdOptions.ToRdfApiordered(boolean enable)If set totrue, certain algorithm processing steps are ordered lexicographically.ToRdfApiproduceGeneralizedRdf()The JSON-LD processor may emit blank nodes for triple predicates.ToRdfApiproduceGeneralizedRdf(boolean enable)If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.voidprovide(com.apicatalog.rdf.api.RdfQuadConsumer consumer)Emit transformedJSON-LDas RDF quads.ToRdfApirdfDirection(JsonLdOptions.RdfDirection direction)Determines how value objects containing a base direction are transformed to and from RDF.
-
-
-
Field Detail
-
document
private final Document document
-
documentUri
private final java.net.URI documentUri
-
options
private JsonLdOptions options
-
-
Constructor Detail
-
ToRdfApi
public ToRdfApi(java.net.URI documentUri)
-
ToRdfApi
public ToRdfApi(Document document)
-
-
Method Detail
-
options
public ToRdfApi options(JsonLdOptions options)
Description copied from interface:CommonApiOverride an existing settings withJsonLdOptions.- Specified by:
optionsin interfaceCommonApi<ToRdfApi>- Parameters:
options-JsonLdOptions- Returns:
- builder instance
-
context
public ToRdfApi context(java.net.URI contextUri)
Description copied from interface:ContextApiA context that is used to initialize the active context.- Specified by:
contextin interfaceContextApi<ToRdfApi>- Parameters:
contextUri-URIreferring to a context- Returns:
- builder instance
-
context
public ToRdfApi context(java.lang.String contextLocation)
Description copied from interface:ContextApiA context that is used to initialize the active context.- Specified by:
contextin interfaceContextApi<ToRdfApi>- Parameters:
contextLocation-IRIreferring to a context- Returns:
- builder instance
-
context
public ToRdfApi context(jakarta.json.JsonStructure context)
Description copied from interface:ContextApiA context that is used to initialize the active context.- Specified by:
contextin interfaceContextApi<ToRdfApi>- Parameters:
context-JsonObject, a sequence ofJsonObject, or aJsonStringrepresenting anIRI- Returns:
- builder instance
-
context
public ToRdfApi context(Document context)
Description copied from interface:ContextApiA context that is used to initialize the active context.- Specified by:
contextin interfaceContextApi<ToRdfApi>- Parameters:
context-Documentrepresenting a context- Returns:
- builder instance
-
produceGeneralizedRdf
public ToRdfApi produceGeneralizedRdf(boolean enable)
If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.- Parameters:
enable-trueto produce generalized RDF- Returns:
- builder instance
-
produceGeneralizedRdf
public ToRdfApi produceGeneralizedRdf()
The JSON-LD processor may emit blank nodes for triple predicates.- Returns:
- builder instance
-
rdfDirection
public ToRdfApi rdfDirection(JsonLdOptions.RdfDirection direction)
Determines how value objects containing a base direction are transformed to and from RDF.- Parameters:
direction- determines how to process directed language-tagged literals- Returns:
- builder instance
-
mode
public ToRdfApi mode(JsonLdVersion processingMode)
Description copied from interface:CommonApiSetJSON-LDprocessing mode. JSON-LD 1.1 is set by default.
-
base
public ToRdfApi base(java.net.URI baseUri)
Description copied from interface:CommonApiSet the baseIRI. If set, this overrides the input document's IRI.
-
loader
public ToRdfApi 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<ToRdfApi>- Parameters:
loader- theDocumentLoaderinstance, nevernull.- Returns:
- builder instance
-
ordered
public ToRdfApi ordered(boolean enable)
Description copied from interface:CommonApiIf set totrue, certain algorithm processing steps are ordered lexicographically. Iffalse, order is not considered in processing.
-
get
@Deprecated public RdfDataset get() throws JsonLdError
Deprecated.since 1.7.0 - Useprovide(RdfQuadConsumer)instead.Transforms the providedJSON-LDdocument into anRdfDataset.This method converts a JSON-LD document into an RDF dataset representation. It has been deprecated in favor of
provide(RdfQuadConsumer).- Returns:
- an
RdfDatasetrepresenting the providedJSON-LDdocument - Throws:
JsonLdError- if the transformation fails
-
provide
public void provide(com.apicatalog.rdf.api.RdfQuadConsumer consumer) throws JsonLdErrorEmit transformedJSON-LDas RDF quads.Note: toRdf() method adopts the
RdfQuadConsumerinterface, allowing integration with Jena, Jelly, RDF4J, and other RDF libraries.- Parameters:
consumer- that accepts emitted RDF statements- Throws:
JsonLdError- if the document transformation fails- Since:
- 1.6.0
-
numericId
public ToRdfApi numericId()
Experimental: Accept numeric@id. Disabled by default.- Returns:
- builder instance
-
-