Constructor and Description |
---|
JsonLdRDF() |
Modifier and Type | Method and Description |
---|---|
JsonLdDataset |
asDataset(com.github.jsonldjava.core.RDFDataset rdfDataSet)
Adapt a JsonLd
RDFDataset as a Commons RDF Dataset . |
JsonLdGraph |
asGraph(com.github.jsonldjava.core.RDFDataset rdfDataSet)
Adapt a JsonLd
RDFDataset as a Commons RDF Graph . |
com.github.jsonldjava.core.RDFDataset.Node |
asJsonLdNode(RDFTerm term) |
com.github.jsonldjava.core.RDFDataset.Quad |
asJsonLdQuad(Quad quad)
Adapt a Commons RDF
Quad as a JsonLd
RDFDataset.Quad . |
com.github.jsonldjava.core.RDFDataset.Quad |
asJsonLdQuad(Triple triple)
Adapt a Commons RDF
Triple as a JsonLd
RDFDataset.Quad . |
JsonLdQuad |
asQuad(com.github.jsonldjava.core.RDFDataset.Quad quad)
Adapt a JsonLd
RDFDataset.Quad as a
Commons RDF Quad . |
JsonLdTerm |
asRDFTerm(com.github.jsonldjava.core.RDFDataset.Node node)
Adapt a JsonLd
RDFDataset.Node as a Commons RDF RDFTerm . |
JsonLdTriple |
asTriple(com.github.jsonldjava.core.RDFDataset.Quad quad)
Adapt a JsonLd
RDFDataset.Quad as a
Commons RDF Triple . |
JsonLdUnionGraph |
asUnionGraph(com.github.jsonldjava.core.RDFDataset rdfDataSet)
Adapt a JsonLd
RDFDataset as a Commons RDF Graph . |
JsonLdBlankNode |
createBlankNode()
Create a new blank node.
|
JsonLdBlankNode |
createBlankNode(String name)
Create a blank node based on the given name.
|
JsonLdDataset |
createDataset()
Create a new dataset.
|
JsonLdGraph |
createGraph()
Create a new graph.
|
JsonLdIRI |
createIRI(String iri)
Create an IRI from a (possibly escaped) String.
|
JsonLdLiteral |
createLiteral(String literal)
Create a simple literal.
|
JsonLdLiteral |
createLiteral(String literal,
IRI dataType)
Create a literal with the specified data type.
|
JsonLdLiteral |
createLiteral(String literal,
String language)
Create a language-tagged literal.
|
JsonLdQuad |
createQuad(BlankNodeOrIRI graphName,
BlankNodeOrIRI subject,
IRI predicate,
RDFTerm object)
Create a quad.
|
JsonLdTriple |
createTriple(BlankNodeOrIRI subject,
IRI predicate,
RDFTerm object)
Create a triple.
|
public JsonLdRDF()
public JsonLdDataset asDataset(com.github.jsonldjava.core.RDFDataset rdfDataSet)
RDFDataset
as a Commons RDF Dataset
.
Changes to the Commons RDF Dataset
are reflected in the JsonLd
RDFDataset
and vice versa.
rdfDataSet
- JsonLd RDFDataset
to adaptDataset
asGraph(RDFDataset)
public JsonLdGraph asGraph(com.github.jsonldjava.core.RDFDataset rdfDataSet)
RDFDataset
as a Commons RDF Graph
.
Only triples in the default graph are included. To retrieve any
other graph, asDataset(RDFDataset)
together with
Dataset.getGraph(BlankNodeOrIRI)
.
Changes to the Commons RDF Graph
are reflected in the JsonLd
RDFDataset
and vice versa.
rdfDataSet
- JsonLd RDFDataset
to adaptGraph
covering the default graphasDataset(RDFDataset)
,
asUnionGraph(RDFDataset)
public com.github.jsonldjava.core.RDFDataset.Node asJsonLdNode(RDFTerm term)
public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad(Quad quad)
Quad
as a JsonLd
RDFDataset.Quad
.quad
- Commons RDF Quad
to adaptRDFDataset.Quad
public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad(Triple triple)
Triple
as a JsonLd
RDFDataset.Quad
.triple
- Commons RDF Triple
to adaptRDFDataset.Quad
public JsonLdQuad asQuad(com.github.jsonldjava.core.RDFDataset.Quad quad)
RDFDataset.Quad
as a
Commons RDF Quad
.
The underlying JsonLd quad can be retrieved with
JsonLdTripleLike.asJsonLdQuad()
.
quad
- A JsonLd RDFDataset.Quad
to
adaptJsonLdQuad
public JsonLdTerm asRDFTerm(com.github.jsonldjava.core.RDFDataset.Node node)
RDFDataset.Node
as a Commons RDF RDFTerm
.
The underlying node can be retrieved with
JsonLdTerm.asJsonLdNode()
.
node
- A JsonLd RDFDataset.Node
to adaptJsonLdTerm
public JsonLdTriple asTriple(com.github.jsonldjava.core.RDFDataset.Quad quad)
RDFDataset.Quad
as a
Commons RDF Triple
.
The underlying JsonLd quad can be retrieved with
JsonLdTripleLike.asJsonLdQuad()
.
quad
- A JsonLd RDFDataset.Quad
to
adaptJsonLdTriple
public JsonLdUnionGraph asUnionGraph(com.github.jsonldjava.core.RDFDataset rdfDataSet)
RDFDataset
as a Commons RDF Graph
.
The graph can be seen as a union graph as it will contains all
the triples across all the graphs of the underlying RDFDataset
.
Note that some triple operations on a union graph can be inefficient as they need to remove any duplicate triples across the graphs.
Changes to the Commons RDF Graph
are reflected in the JsonLd
RDFDataset
and vice versa. Triples removed from the graph are
removed from all graphs, while triples added are added
to the default graph.
rdfDataSet
- JsonLd RDFDataset
to adaptDataset
public JsonLdBlankNode createBlankNode()
RDF
The returned blank node MUST NOT be equal to any existing
BlankNode
instances according to
BlankNode.equals(Object)
.
createBlankNode
in interface RDF
BlankNode
public JsonLdBlankNode createBlankNode(String name)
RDF
All BlankNode
s created with the given name
on a
particular instance of RDF
MUST be equivalent according
to BlankNode.equals(Object)
,
The returned BlankNode MUST NOT be equal to BlankNode
instances returned for any other name
or those returned from
RDF.createBlankNode()
.
The returned BlankNode SHOULD NOT be equivalent to any BlankNodes created
on a different RDF
instance, e.g. different
instances of RDF
should produce different blank nodes for
the same name
unless they purposely are intending to create
equivalent BlankNode
instances (e.g. a reinstated
Serializable
factory).
createBlankNode
in interface RDF
name
- A non-empty, non-null, String that is unique to this blank
node in the context of this RDF
.public JsonLdDataset createDataset()
RDF
createDataset
in interface RDF
public JsonLdGraph createGraph()
RDF
createGraph
in interface RDF
public JsonLdIRI createIRI(String iri)
RDF
public JsonLdLiteral createLiteral(String literal)
RDF
Literal.getLexicalForm()
that is
equal to the provided lexical form, MUST NOT have a
Literal.getLanguageTag()
present, and SHOULD return a
Literal.getDatatype()
that is equal to the IRI
http://www.w3.org/2001/XMLSchema#string
.createLiteral
in interface RDF
literal
- The literal value in plain textpublic JsonLdLiteral createLiteral(String literal, IRI dataType)
RDF
Literal.getLexicalForm()
that
is equal to the provided lexicalForm, MUST NOT have a
Literal.getLanguageTag()
present, and MUST return a
Literal.getDatatype()
that is equivalent to the provided dataType
IRI.createLiteral
in interface RDF
literal
- The literal valuedataType
- The data type IRI for the literal value, e.g.
http://www.w3.org/2001/XMLSchema#integer
public JsonLdLiteral createLiteral(String literal, String language)
RDF
en
.
The provided language tag
MAY be converted to lower case.
The returned Literal SHOULD have a Literal.getLexicalForm()
which
is equal to the provided lexicalForm, MUST return a
Literal.getDatatype()
that is equal to the IRI
http://www.w3.org/1999/02/22-rdf-syntax-ns#langString
, and
MUST have a Literal.getLanguageTag()
present which SHOULD be
equal to the provided language tag (compared as
String.toLowerCase(Locale)
using Locale.ENGLISH
).createLiteral
in interface RDF
literal
- The literal valuelanguage
- The non-empty language tag as defined by
BCP47public JsonLdQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) throws IllegalArgumentException, UnsupportedOperationException
RDF
The returned Quad SHOULD have a Quad.getGraphName()
that is equal
to the provided graphName, a Quad.getSubject()
that is equal to
the provided subject, a Quad.getPredicate()
that is equal to the
provided predicate, and a Quad.getObject()
that is equal to the
provided object.
createQuad
in interface RDF
graphName
- The IRI or BlankNode that this quad belongs to, or
null
for the public graphsubject
- The IRI or BlankNode that is the subject of the quadpredicate
- The IRI that is the predicate of the quadobject
- The IRI, BlankNode or Literal that is the object of the quadIllegalArgumentException
- If any of the provided arguments are not acceptable, e.g.
because a Literal has a lexicalForm that is too large for an
underlying storage.UnsupportedOperationException
public JsonLdTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
RDF
Triple.getSubject()
that is
equal to the provided subject, a Triple.getPredicate()
that is
equal to the provided predicate, and a Triple.getObject()
that is
equal to the provided object.createTriple
in interface RDF
subject
- The IRI or BlankNode that is the subject of the triplepredicate
- The IRI that is the predicate of the tripleobject
- The IRI, BlankNode or Literal that is the object of the tripleCopyright © 2015–2018 The Apache Software Foundation. All rights reserved.