public class Statements extends Object
Statement
objects, including conversion to/from RDF-star
triple objects
.Modifier and Type | Field and Description |
---|---|
static java.util.function.Function<Triple,Resource> |
TRIPLE_BNODE_MAPPER
|
Constructor and Description |
---|
Statements() |
Modifier and Type | Method and Description |
---|---|
static void |
consume(ValueFactory vf,
Resource subject,
IRI predicate,
Value object,
java.util.function.Consumer<Statement> consumer,
Resource... contexts)
|
static void |
convertRDFStarToReification(Statement st,
java.util.function.Consumer<Statement> consumer)
Converts the supplied RDF-star statement to RDF reification statements, and sends the resultant statements to the
supplied consumer.
|
static void |
convertRDFStarToReification(ValueFactory vf,
java.util.function.Function<Triple,Resource> reifiedIdMapper,
Statement st,
java.util.function.Consumer<Statement> consumer)
Converts the supplied RDF-star statement to RDF reification statements, and sends the resultant statements to the
supplied consumer.
|
static void |
convertRDFStarToReification(ValueFactory vf,
Statement st,
java.util.function.Consumer<Statement> consumer)
Converts the supplied RDF-star statement to RDF reification statements, and sends the resultant statements to the
supplied consumer.
|
static <C extends Collection<Statement>> |
create(ValueFactory vf,
Resource subject,
IRI predicate,
Value object,
C collection,
Resource... contexts)
Creates one or more
Statement objects with the given subject, predicate and object, one for each given
context. |
static boolean |
isSameTriple(Statement st1,
Statement st2)
Checks if the two statements represent the same triple (that is, they have equal subject, predicate, and object).
|
static Statement |
statement(Resource subject,
IRI predicate,
Value object,
Resource context)
Create a
Statement from the supplied subject, predicate, object and context. |
static Statement |
statement(Triple triple)
Create a
Statement from the supplied { @link Triple RDF-star triple} |
static Statement |
statement(Triple triple,
Resource context)
Create a
Statement from the supplied { @link Triple RDF-star triple} and context. |
static Statement |
statement(ValueFactory vf,
Resource subject,
IRI predicate,
Value object,
Resource context)
Create a
Statement from the supplied subject, predicate, object and context. |
static Statement |
statement(ValueFactory vf,
Triple triple,
Resource context)
Create a
Statement from the supplied { @link Triple RDF-star triple} and context. |
static Statement |
stripContext(Statement statement)
Strips the context (if any) from the supplied statement and returns a statement with the same subject, predicate
and object, but with no assigned context.
|
static Statement |
stripContext(ValueFactory vf,
Statement statement)
Strips the context (if any) from the supplied statement and returns a statement with the same subject, predicate
and object, but with no assigned context.
|
static Statement |
toStatement(Triple triple)
Deprecated.
Use
statement(Triple) instead |
static Statement |
toStatement(Triple triple,
Resource context)
Deprecated.
since 3.7.0 - use
statement(Triple, Resource) instead |
static Statement |
toStatement(ValueFactory vf,
Triple triple,
Resource context)
Deprecated.
Use
statement(ValueFactory,Triple,Resource) instead |
static Triple |
toTriple(Statement statement)
Deprecated.
since 3.5.0 - use
Values.triple(Statement) instead |
static Triple |
toTriple(ValueFactory vf,
Statement statement)
Deprecated.
since 3.5.0 - use
Values.triple(ValueFactory, Statement) instead |
@Experimental public static java.util.function.Function<Triple,Resource> TRIPLE_BNODE_MAPPER
public static void consume(ValueFactory vf, Resource subject, IRI predicate, Value object, java.util.function.Consumer<Statement> consumer, Resource... contexts)
Statement
objects with the given subject, predicate and object, one for each given
context, and sends each created statement to the supplied Consumer
. If no context is supplied, only a
single statement (without any assigned context) is created.vf
- the ValueFactory
to use for creating statements.subject
- the subject of each statement. May not be null.predicate
- the predicate of each statement. May not be null.object
- the object of each statement. May not be null.consumer
- the Consumer
function for the produced statements.contexts
- the context(s) for which to produce statements. This argument is an optional vararg: leave it
out completely to produce a single statement without context.public static <C extends Collection<Statement>> C create(ValueFactory vf, Resource subject, IRI predicate, Value object, C collection, Resource... contexts)
Statement
objects with the given subject, predicate and object, one for each given
context. If no context is supplied, only a single statement (without any assigned context) is created.vf
- the ValueFactory
to use for creating statements.subject
- the subject of each statement. May not be null.predicate
- the predicate of each statement. May not be null.object
- the object of each statement. May not be null.collection
- the collection of Statements to which the newly created Statements will be added. May not be
null.contexts
- the context(s) for which to produce statements. This argument is an optional vararg: leave it out
completely to produce a single statement without context.public static Statement stripContext(Statement statement)
statement
- the statement to strip the context frompublic static Statement stripContext(ValueFactory vf, Statement statement)
vf
- the ValueFactory
to use for creating a new Statement
.statement
- the statement to strip the context from.@Deprecated public static Triple toTriple(Statement statement)
Values.triple(Statement)
insteadRDF-star triple
from the supplied Statement
statement
- a statement to convert to an RDF-star tripleRDF-star triple
with the same subject, predicate and object as the input statement.@Deprecated public static Triple toTriple(ValueFactory vf, Statement statement)
Values.triple(ValueFactory, Statement)
insteadRDF-star triple
from the supplied Statement
vf
- the ValueFactory
to use for creating the Triple
object.statement
- a statement to convert to an RDF-star tripleRDF-star triple
with the same subject, predicate and object as the input statement.public static Statement toStatement(Triple triple)
statement(Triple)
insteadStatement
from the supplied { @link Triple RDF-star triple}public static Statement statement(Triple triple)
Statement
from the supplied { @link Triple RDF-star triple}public static Statement statement(Triple triple, Resource context)
Statement
from the supplied { @link Triple RDF-star triple} and context.public static Statement toStatement(Triple triple, Resource context)
statement(Triple, Resource)
insteadStatement
from the supplied { @link Triple RDF-star triple} and context.public static Statement toStatement(ValueFactory vf, Triple triple, Resource context)
statement(ValueFactory,Triple,Resource)
insteadStatement
from the supplied { @link Triple RDF-star triple} and context.vf
- the ValueFactory
to use for creating the Statement
object.triple
- an RDF-star triple to convert to a Statement
.context
- the context to assign to the Statement
. May be null to indicate no context.Statement
with the same subject, predicate and object as the input triple, and having the
supplied context.public static Statement statement(ValueFactory vf, Triple triple, Resource context)
Statement
from the supplied { @link Triple RDF-star triple} and context.vf
- the ValueFactory
to use for creating the Statement
object.triple
- an RDF-star triple to convert to a Statement
.context
- the context to assign to the Statement
. May be null to indicate no context.Statement
with the same subject, predicate and object as the input triple, and having the
supplied context.public static Statement statement(Resource subject, IRI predicate, Value object, Resource context)
Statement
from the supplied subject, predicate, object and context.subject
- the statement subjectpredicate
- the statement predicateobject
- the statement objectcontext
- the context to assign to the Statement
. May be null to indicate no context.Statement
with the same subject, predicate and object as the input triple, and having the
supplied context.NullPointerException
- if any of subject, predicate, or object are null
.public static Statement statement(ValueFactory vf, Resource subject, IRI predicate, Value object, Resource context)
Statement
from the supplied subject, predicate, object and context.vf
- the ValueFactory
to use for creating the Statement
object.subject
- the statement subjectpredicate
- the statement predicateobject
- the statement objectcontext
- the context to assign to the Statement
. May be null to indicate no context.Statement
with the same subject, predicate and object as the input triple, and having the
supplied context.NullPointerException
- if any of vf, subject, predicate, or object are null
.public static boolean isSameTriple(Statement st1, Statement st2)
st1
- the first statement to compare. May not be null.st2
- the second statement to compare. May not be null.true
iff the subject, predicate and object of st1
and st2
are equal,
false
otherwise.Statement.equals(Object)
@Experimental public static void convertRDFStarToReification(Statement st, java.util.function.Consumer<Statement> consumer)
The statements needed to represent reification will use blank nodes.
@Experimental public static void convertRDFStarToReification(ValueFactory vf, Statement st, java.util.function.Consumer<Statement> consumer)
The statements needed to represent reification will use blank nodes.
The supplied value factory is used to create all new statements and blank nodes.
vf
- the ValueFactory
to use for creating statements.st
- the Statement
to convert.consumer
- the Consumer
function for the produced statements.@Experimental public static void convertRDFStarToReification(ValueFactory vf, java.util.function.Function<Triple,Resource> reifiedIdMapper, Statement st, java.util.function.Consumer<Statement> consumer)
The supplied value factory is used to create all new statements.
The supplied mapper function maps a Triple
to a Resource
and is used to create the ID of the RDF
reification statement corresponding to the converted triple. The function must return the same value for
identical triples in order to produce consistent results between invocations. See TRIPLE_BNODE_MAPPER
.
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.