public interface RDF4JDataset extends Dataset, RDF4JGraphLike<Quad>
| Modifier and Type | Method and Description |
|---|---|
Stream<BlankNodeOrIRI> |
getGraphNames() |
ClosableIterable<Quad> |
iterate() |
ClosableIterable<Quad> |
iterate(Optional<BlankNodeOrIRI> graphName,
BlankNodeOrIRI subject,
IRI predicate,
RDFTerm object) |
Stream<RDF4JQuad> |
stream() |
Stream<RDF4JQuad> |
stream(Optional<BlankNodeOrIRI> graphName,
BlankNodeOrIRI subject,
IRI predicate,
RDFTerm object) |
add, add, clear, close, contains, contains, getGraph, getGraph, remove, remove, sizeasModel, asRepositoryStream<RDF4JQuad> stream()
Note that for datasets backed by a repository (RDF4JGraphLike.asRepository() is
present), the stream must be closed with
BaseStream.close().
This can generally achieved using a try-with-resources block, e.g.:
int subjects;
try (Stream<RDF4JQuad> s : graph.stream()) {
subjects = s.map(RDF4JQuad::getSubject).distinct().count()
}
Stream<RDF4JQuad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Note that for datasets backed by a repository (RDF4JGraphLike.asRepository() is
present), the stream must be closed with
BaseStream.close().
This can generally achieved using a try-with-resources block, e.g.:
int subjects;
try (Stream<RDF4JQuad> s : graph.stream()) {
subjects = s.map(RDF4JQuad::getSubject).distinct().count()
}
Stream<BlankNodeOrIRI> getGraphNames()
Note that for datasets backed by a repository (RDF4JGraphLike.asRepository() is
present), the stream must be closed with
BaseStream.close().
This can generally achieved using a try-with-resources block, e.g.:
int graphs;
try (Stream<BlankNodeOrIRI> s : graph.stream()) {
graphs = s.count()
}
getGraphNames in interface DatasetClosableIterable<Quad> iterate()
Note that for datasets backed by a repository (RDF4JGraphLike.asRepository() is
present), the iterable must be closed with
AutoCloseable.close().
This can generally achieved using a try-with-resources block, e.g.:
try (ClosableIterable<Quad> s : graph.iterate()) {
for (Quad q : quads) {
return q; // OK to terminate for-loop early
}
}
If you don't use a try-with-resources block, the iterator will attempt to
close the ClosableIterable when reaching the end of the iteration.ClosableIterable<Quad> iterate(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
Note that for datasets backed by a repository (RDF4JGraphLike.asRepository() is
present), the iterable must be closed with
AutoCloseable.close().
This can generally achieved using a try-with-resources block, e.g.:
try (ClosableIterable<Quad> s : graph.iterate(g,s,p,o)) {
for (Quad q : quads) {
return q; // OK to terminate for-loop early
}
}
If you don't use a try-with-resources block, the iterator will attempt to
close the ClosableIterable when reaching the end of the iteration.Copyright © 2015–2017 The Apache Software Foundation. All rights reserved.