public final class RDFSources extends Object
RDFSource
s.Modifier and Type | Field and Description |
---|---|
static RDFSource |
NIL
The null
RDFSource that returns no statements, namespaces and comments. |
Modifier and Type | Method and Description |
---|---|
static RDFSource |
query(boolean parallelize,
boolean preserveBNodes,
String endpointURL,
String query)
Returns an
RDFSource that retrieves data from a SPARQL endpoint using SPARQL
CONSTRUCT or SELECT queries. |
static RDFSource |
read(boolean parallelize,
boolean preserveBNodes,
String baseURI,
org.openrdf.rio.ParserConfig config,
String... locations)
Returns an
RDFSource that reads files from the locations specified. |
static RDFSource |
wrap(Iterable<? extends org.openrdf.model.Statement> statements)
Returns an
RDFSource providing access to the statements in the supplied collection. |
static RDFSource |
wrap(Iterable<? extends org.openrdf.model.Statement> statements,
Iterable<? extends org.openrdf.model.Namespace> namespaces)
Returns an
RDFSource providing access to the statements and namespaces in the
supplied collections. |
static RDFSource |
wrap(Iterable<? extends org.openrdf.model.Statement> statements,
Map<String,String> namespaces)
Returns an
RDFSource providing access to the statements and namespaces in the
supplied collection and map. |
public static final RDFSource NIL
RDFSource
that returns no statements, namespaces and comments.public static RDFSource wrap(Iterable<? extends org.openrdf.model.Statement> statements)
RDFSource
providing access to the statements in the supplied collection.
If the collection is a Model
or QuadModel
, also its namespaces are wrapped
and returned when reading from the source. If you don't want namespaces to be read, use
wrap(Iterable, Iterable)
passing null as second argument. The collection MUST NOT
be changed while the returned source is being used, as this will cause the source to return
different statements in different passes. Access to the collection is sequential, so it
does not need to be thread-safe.statements
- the statements collection, not null (can also be another RDFSource
)RDFSource
.public static RDFSource wrap(Iterable<? extends org.openrdf.model.Statement> statements, @Nullable Iterable<? extends org.openrdf.model.Namespace> namespaces)
RDFSource
providing access to the statements and namespaces in the
supplied collections. The two collections MUST NOT be changed while the returned source is
being used, as this will cause the source to return different data in different passes.
Access to the collections is sequential, so they do not need to be thread-safe.statements
- the statements collection, not null (can also be another RDFSource
)namespaces
- the namespaces collection, possibly nullRDFSource
.public static RDFSource wrap(Iterable<? extends org.openrdf.model.Statement> statements, @Nullable Map<String,String> namespaces)
RDFSource
providing access to the statements and namespaces in the
supplied collection and map. The collection and map MUST NOT be changed while the returned
source is being used, as this will cause the source to return different data in different
passes. Access to the collection and map is sequential, so they do not need to be
thread-safe.statements
- the statements collection, not null (can also be another RDFSource
)namespaces
- the namespaces map, possibly nullRDFSource
public static RDFSource read(boolean parallelize, boolean preserveBNodes, @Nullable String baseURI, @Nullable org.openrdf.rio.ParserConfig config, String... locations)
RDFSource
that reads files from the locations specified. Each location
is either a file path or a full URL, possibly prefixed with an .ext:
fragment that
overrides the file extension used to detect RDF format and compression. Files are read
sequentially if parallelize == false
, otherwise multiple files can be parsed in
parallel and files in a line-oriented RDF format can be parsed using multiple threads, in
both cases the effect being a greater throughput but no guarantee on the statements order,
however. Arguments preserveBNodes
, baseURI
and config
control the
parsing process.parallelize
- false if files should be parsed sequentially using only one threadpreserveBNodes
- true if BNodes in parsed files should be preserved, false if they should be
rewritten on a per-file basis to avoid possible clashesbaseURI
- the base URI to be used for resolving relative URIs, possibly nullconfig
- the optional ParserConfig
for the fine tuning of the used RDF parser; if
null a default, maximally permissive configuration will be usedlocations
- the locations of the RDF files to be readRDFSource
public static RDFSource query(boolean parallelize, boolean preserveBNodes, String endpointURL, String query)
RDFSource
that retrieves data from a SPARQL endpoint using SPARQL
CONSTRUCT or SELECT queries. CONSTRUCT queries are limited (due to SPARQL) to return only
triples in a default graph. SELECT query should return bindings for variables s
,
p
, o
and c
, which are used as subject, predicate, object and
context of returned statements; incomplete or invalid bindings (e.g., bindings where the
subject is bound to a literal) are silently ignored.parallelize
- true to use multiple threads should for handling parsed triplespreserveBNodes
- true if BNodes in the query result should be preserved, false if they should be
rewritten on a per-endpoint basis to avoid possible clashesendpointURL
- the URL of the SPARQL endpoint, not nullquery
- the SPARQL query (CONSTRUCT or SELECT form) to submit to the endpointRDFSource
Copyright © 2015–2016 FBK-irst. All rights reserved.