public class JsonLdProcessor extends Object
Constructor and Description |
---|
JsonLdProcessor() |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
compact(Object input,
Object context,
JsonLdOptions opts)
Compacts the given input using the context according to the steps in the
Compaction algorithm.
|
static List<Object> |
expand(Object input)
Expands the given input according to the steps in the Expansion
algorithm, using the default
JsonLdOptions . |
static List<Object> |
expand(Object input,
JsonLdOptions opts)
Expands the given input according to the steps in the Expansion
algorithm.
|
static Object |
flatten(Object input,
JsonLdOptions opts)
Flattens the given input and compacts it using the passed context
according to the steps in the Flattening
algorithm:
|
static Object |
flatten(Object input,
Object context,
JsonLdOptions opts) |
static Map<String,Object> |
frame(Object input,
Object frame,
JsonLdOptions opts)
Frames the given input using the frame according to the steps in the
Framing Algorithm.
|
static Object |
fromRDF(Object dataset)
Converts an RDF dataset to JSON-LD, using the default
JsonLdOptions . |
static Object |
fromRDF(Object dataset,
JsonLdOptions options)
Converts an RDF dataset to JSON-LD.
|
static Object |
fromRDF(Object input,
JsonLdOptions options,
RDFParser parser)
Converts an RDF dataset to JSON-LD, using a specific instance of
RDFParser . |
static Object |
fromRDF(Object input,
RDFParser parser)
Converts an RDF dataset to JSON-LD, using a specific instance of
RDFParser , and the default JsonLdOptions . |
static Object |
normalize(Object input)
Performs RDF dataset normalization on the given JSON-LD input.
|
static Object |
normalize(Object input,
JsonLdOptions options)
Performs RDF dataset normalization on the given JSON-LD input.
|
static void |
registerRDFParser(String format,
RDFParser parser) |
static void |
removeRDFParser(String format) |
static Object |
toRDF(Object input)
Outputs the RDF dataset found in the given JSON-LD object, using the
default
JsonLdOptions . |
static Object |
toRDF(Object input,
JsonLdOptions options)
Outputs the RDF dataset found in the given JSON-LD object.
|
static Object |
toRDF(Object input,
JsonLdTripleCallback callback)
Outputs the RDF dataset found in the given JSON-LD object, using the
default
JsonLdOptions . |
static Object |
toRDF(Object input,
JsonLdTripleCallback callback,
JsonLdOptions options)
Outputs the RDF dataset found in the given JSON-LD object.
|
public static Map<String,Object> compact(Object input, Object context, JsonLdOptions opts) throws JsonLdError
input
- The input JSON-LD object.context
- The context object to use for the compaction algorithm.opts
- The JsonLdOptions
that are to be sent to the
compaction algorithm.JsonLdError
- If there is an error while compacting.public static List<Object> expand(Object input, JsonLdOptions opts) throws JsonLdError
input
- The input JSON-LD object.opts
- The JsonLdOptions
that are to be sent to the expansion
algorithm.JsonLdError
- If there is an error while expanding.public static List<Object> expand(Object input) throws JsonLdError
JsonLdOptions
.input
- The input JSON-LD object.JsonLdError
- If there is an error while expanding.public static Object flatten(Object input, Object context, JsonLdOptions opts) throws JsonLdError
JsonLdError
public static Object flatten(Object input, JsonLdOptions opts) throws JsonLdError
input
- The input JSON-LD object.opts
- The JsonLdOptions
that are to be sent to the
flattening algorithm.JsonLdError
- If there is an error while flattening.public static Map<String,Object> frame(Object input, Object frame, JsonLdOptions opts) throws JsonLdError
input
- The input JSON-LD object.frame
- The frame to use when re-arranging the data of input; either
in the form of an JSON object or as IRI.opts
- The JsonLdOptions
that are to be sent to the framing
algorithm.JsonLdError
- If there is an error while framing.public static void removeRDFParser(String format)
public static Object fromRDF(Object dataset, JsonLdOptions options) throws JsonLdError
dataset
- a serialized string of RDF in a format specified by the format
option or an RDF dataset to convert.options
- the options to use: [format] the format if input is not an
array: 'application/nquads' for N-Quads (default).
[useRdfType] true to use rdf:type, false to use @type
(default: false). [useNativeTypes] true to convert XSD types
into native types (boolean, integer, double), false not to
(default: true).JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object fromRDF(Object dataset) throws JsonLdError
JsonLdOptions
.dataset
- a serialized string of RDF in a format specified by the format
option or an RDF dataset to convert.JsonLdError
- If there was an error converting from RDF to JSON-LDpublic static Object fromRDF(Object input, JsonLdOptions options, RDFParser parser) throws JsonLdError
RDFParser
.input
- a serialized string of RDF in a format specified by the format
option or an RDF dataset to convert.options
- the options to use: [format] the format if input is not an
array: 'application/nquads' for N-Quads (default).
[useRdfType] true to use rdf:type, false to use @type
(default: false). [useNativeTypes] true to convert XSD types
into native types (boolean, integer, double), false not to
(default: true).parser
- A specific instance of RDFParser
to use for the
conversion.JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object fromRDF(Object input, RDFParser parser) throws JsonLdError
RDFParser
, and the default JsonLdOptions
.input
- a serialized string of RDF in a format specified by the format
option or an RDF dataset to convert.parser
- A specific instance of RDFParser
to use for the
conversion.JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object toRDF(Object input, JsonLdTripleCallback callback, JsonLdOptions options) throws JsonLdError
input
- the JSON-LD input.callback
- A callback that is called when the input has been converted to
Quads (null to use options.format instead).options
- the options to use: [base] the base IRI to use. [format] the
format to use to output a string: 'application/nquads' for
N-Quads (default). [loadContext(url, callback(err, url,
result))] the context loader.JsonLdTripleCallback.call(RDFDataset)
on the results, or
if JsonLdOptions.format
is not null, a result in that
format if it is found, or otherwise the raw RDFDataset
.JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object toRDF(Object input, JsonLdOptions options) throws JsonLdError
input
- the JSON-LD input.options
- the options to use: [base] the base IRI to use. [format] the
format to use to output a string: 'application/nquads' for
N-Quads (default). [loadContext(url, callback(err, url,
result))] the context loader.JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object toRDF(Object input, JsonLdTripleCallback callback) throws JsonLdError
JsonLdOptions
.input
- the JSON-LD input.callback
- A callback that is called when the input has been converted to
Quads (null to use options.format instead).JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object toRDF(Object input) throws JsonLdError
JsonLdOptions
.input
- the JSON-LD input.JsonLdError
- If there is an error converting the dataset to JSON-LD.public static Object normalize(Object input, JsonLdOptions options) throws JsonLdError
input
- the JSON-LD input to normalize.options
- the options to use: [base] the base IRI to use. [format] the
format if output is a string: 'application/nquads' for
N-Quads. [loadContext(url, callback(err, url, result))] the
context loader.JsonLdError
- If there is an error normalizing the dataset.public static Object normalize(Object input) throws JsonLdError
JsonLdOptions
.input
- the JSON-LD input to normalize.JsonLdError
- If there is an error normalizing the dataset.Copyright © 2018. All rights reserved.