public class Connections extends Object
RepositoryConnection
s.Constructor and Description |
---|
Connections() |
Modifier and Type | Method and Description |
---|---|
static void |
consumeRDFCollection(RepositoryConnection conn,
Resource head,
java.util.function.Consumer<Statement> collectionConsumer,
Resource... contexts)
|
static <C extends Collection<Statement>> |
getRDFCollection(RepositoryConnection conn,
Resource head,
C statementCollection,
Resource... contexts)
Retrieve all
Statement s that together form the RDF Collection starting with the supplied starting
resource. |
static Optional<Statement> |
getStatement(RepositoryConnection conn,
Resource subject,
IRI predicate,
Value object,
Resource... contexts)
Retrieve a single
Statement matching with the supplied subject, predicate, object and context(s) from the
given RepositoryConnection . |
public static void consumeRDFCollection(RepositoryConnection conn, Resource head, java.util.function.Consumer<Statement> collectionConsumer, Resource... contexts) throws RepositoryException
Statement
s that together form the RDF Collection starting with the supplied start resource
and send them to the supplied Consumer
.conn
- the RepositoryConnection
to use for statement retrieval.head
- the start resource of the RDF Collection. May not be null
.collectionConsumer
- a Consumer
function to which all retrieved statements will be reported. May not
be null
.contexts
- the context(s) from which to read the RDF Collection. This argument is an optional
vararg and can be left out.RepositoryException
- if an error occurred while reading the collection statements, for example if a cycle
is detected in the RDF collection, or some other anomaly which makes it
non-wellformed.RDFCollections
,
RDF Schema 1.1 section on Collection
vocabulary.public static <C extends Collection<Statement>> C getRDFCollection(RepositoryConnection conn, Resource head, C statementCollection, Resource... contexts) throws RepositoryException
Statement
s that together form the RDF Collection starting with the supplied starting
resource.conn
- the RepositoryConnection
to use for statement retrieval.head
- the start resource of the RDF Collection. May not be null
.statementCollection
- a Collection
of Statement
s (for example, a Model
) to which all
retrieved statements will be reported. May not be null
.contexts
- the context(s) from which to read the RDF Collection. This argument is an optional
vararg and can be left out.RepositoryException
- if an error occurred while reading the collection statements, for example if a cycle
is detected in the RDF collection, or some other anomaly which makes it
non-wellformed.RDFCollections
,
RDF Schema 1.1 section on Collection
vocabulary.public static Optional<Statement> getStatement(RepositoryConnection conn, Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException
Statement
matching with the supplied subject, predicate, object and context(s) from the
given RepositoryConnection
. If more than one Statement matches, any one Statement is selected and
returned.conn
- the RepositoryConnection
from which to retrieve the statement.subject
- the subject to which the statement should match. May be null
.predicate
- the predicate to which the statement should match. May be null
.object
- the object to which the statement should match. May be null
.contexts
- the context(s) from which to read the Statement. This argument is an optional vararg and can be
left out.Optional
of Statement
. If no matching Statement was found, Optional.empty()
is
returned.RepositoryException
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.