Package no.hasmac.jsonld.api
Class ToRdfApi
- java.lang.Object
-
- no.hasmac.jsonld.api.ToRdfApi
-
-
Field Summary
Fields Modifier and Type Field Description private Document
document
private java.net.URI
documentUri
private JsonLdOptions
options
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ToRdfApi
base(java.net.URI baseUri)
Set the baseIRI
.ToRdfApi
context(jakarta.json.JsonStructure context)
A context that is used to initialize the active context.ToRdfApi
context(java.lang.String contextLocation)
A context that is used to initialize the active context.ToRdfApi
context(java.net.URI contextUri)
A context that is used to initialize the active context.ToRdfApi
context(Document context)
A context that is used to initialize the active context.RdfDataset
get()
Transform providedJSON-LD
document intoRdfDataset
.<Triple,Quad,Iri extends Resource,Bnode extends Resource,Resource extends Value,Literal extends Value,Value>
voidget(RdfConsumer<Triple,Quad> rdfConsumer, RdfValueFactory<Triple,Quad,Iri,Bnode,Resource,Literal,Value> rdfValueFactory)
Transform providedJSON-LD
document intoRdfDataset
.ToRdfApi
loader(DocumentLoader loader)
Set the loader to be used to retrieve remote documents and contexts, implementing theDocumentLoader
.ToRdfApi
mode(JsonLdVersion processingMode)
SetJSON-LD
processing mode.ToRdfApi
numericId()
Experimental: Accept numeric @id.ToRdfApi
options(JsonLdOptions options)
Override an existing settings withJsonLdOptions
.ToRdfApi
ordered(boolean enable)
If set totrue
, certain algorithm processing steps are ordered lexicographically.ToRdfApi
produceGeneralizedRdf()
The JSON-LD processor may emit blank nodes for triple predicates.ToRdfApi
produceGeneralizedRdf(boolean enable)
If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.ToRdfApi
rdfDirection(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:CommonApi
Override an existing settings withJsonLdOptions
.- Specified by:
options
in interfaceCommonApi<ToRdfApi>
- Parameters:
options
-JsonLdOptions
- Returns:
- builder instance
-
context
public ToRdfApi context(java.net.URI contextUri)
Description copied from interface:ContextApi
A context that is used to initialize the active context.- Specified by:
context
in interfaceContextApi<ToRdfApi>
- Parameters:
contextUri
-URI
referring to a context- Returns:
- builder instance
-
context
public ToRdfApi context(java.lang.String contextLocation)
Description copied from interface:ContextApi
A context that is used to initialize the active context.- Specified by:
context
in interfaceContextApi<ToRdfApi>
- Parameters:
contextLocation
-IRI
referring to a context- Returns:
- builder instance
-
context
public ToRdfApi context(jakarta.json.JsonStructure context)
Description copied from interface:ContextApi
A context that is used to initialize the active context.- Specified by:
context
in interfaceContextApi<ToRdfApi>
- Parameters:
context
-JsonObject
, a sequence ofJsonObject
, or aJsonString
representing anIRI
- Returns:
- builder instance
-
context
public ToRdfApi context(Document context)
Description copied from interface:ContextApi
A context that is used to initialize the active context.- Specified by:
context
in interfaceContextApi<ToRdfApi>
- Parameters:
context
-Document
representing 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
-- 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
-- Returns:
- builder instance
-
mode
public ToRdfApi mode(JsonLdVersion processingMode)
Description copied from interface:CommonApi
SetJSON-LD
processing mode. JSON-LD 1.1 is set by default.
-
base
public ToRdfApi base(java.net.URI baseUri)
Description copied from interface:CommonApi
Set the baseIRI
. If set, this overrides the input document's IRI.
-
loader
public ToRdfApi loader(DocumentLoader 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.
-
ordered
public ToRdfApi ordered(boolean enable)
Description copied from interface:CommonApi
If set totrue
, certain algorithm processing steps are ordered lexicographically. Iffalse
, order is not considered in processing.
-
get
public RdfDataset get() throws JsonLdError
Transform providedJSON-LD
document intoRdfDataset
.- Returns:
RdfDataset
representing providedJSON-LD
document- Throws:
JsonLdError
-
get
public <Triple,Quad,Iri extends Resource,Bnode extends Resource,Resource extends Value,Literal extends Value,Value> void get(RdfConsumer<Triple,Quad> rdfConsumer, RdfValueFactory<Triple,Quad,Iri,Bnode,Resource,Literal,Value> rdfValueFactory) throws JsonLdError
Transform providedJSON-LD
document intoRdfDataset
.- Throws:
JsonLdError
-
numericId
public ToRdfApi numericId()
Experimental: Accept numeric @id. Disabled by default.- Returns:
- builder instance
-
-