Package org.aksw.jenax.sparql.query.rx
Class SparqlRx
java.lang.Object
org.aksw.jenax.sparql.query.rx.SparqlRx
Utilities for wrapping SPARQL query execution with flows.
- Author:
- raven
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>constructTriples(Callable<org.apache.jena.sparql.exec.QueryExec> qes) static Function<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.engine.binding.Binding> createGrouper(Collection<org.apache.jena.sparql.core.Var> vars, boolean retainNulls) Create a grouping function Usage: flowable .groupBy(createGrouper(Arrays.asList(...static Function<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.graph.Node> createGrouper(org.apache.jena.sparql.core.Var var) static Function<List<org.apache.jena.sparql.engine.binding.Binding>,org.apache.jena.sparql.algebra.Table> createTableBuffer(List<org.apache.jena.sparql.core.Var> vars) static io.reactivex.rxjava3.core.Single<Boolean>execAsk(Function<org.apache.jena.query.Query, org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execConcept(Callable<org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.sparql.core.Var var) static <T extends org.apache.jena.rdf.model.RDFNode>
io.reactivex.rxjava3.core.Flowable<T>execConcept(Callable<org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.sparql.core.Var var, Class<T> clazz) static <T extends org.apache.jena.rdf.model.RDFNode>
io.reactivex.rxjava3.core.Flowable<T>execConcept(Function<? super org.apache.jena.query.Query, ? extends org.apache.jena.query.QueryExecution> qef, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var, Class<T> clazz) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node>execConceptRaw(Callable<org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.sparql.core.Var var) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node>execConceptRaw(Function<? super org.apache.jena.query.Query, ? extends org.apache.jena.query.QueryExecution> qef, org.apache.jena.query.Query query) Convenience method that assumes a single projected variablestatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node>execConceptRaw(Function<? super org.apache.jena.query.Query, ? extends org.apache.jena.query.QueryExecution> qef, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node>execConceptRaw(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) static io.reactivex.rxjava3.core.Flowable<Map.Entry<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.rdf.model.RDFNode>> execConstructGrouped(Function<org.apache.jena.query.Query, org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.query.Query query, List<org.apache.jena.sparql.core.Var> primaryKeyVars, org.apache.jena.graph.Node rootNode, boolean sortRowsByPartitionVar) static io.reactivex.rxjava3.core.Flowable<Map.Entry<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.rdf.model.RDFNode>> execConstructGrouped(RDFDataSource dataSource, org.apache.jena.query.Query query, List<org.apache.jena.sparql.core.Var> primaryKeyVars, org.apache.jena.graph.Node rootNode, boolean sortRowsByPartitionVar) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execConstructGrouped(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execConstructGrouped(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e, boolean sortRowsByPartitionVar) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execConstructGrouped(QueryExecutionFactoryQuery conn, org.apache.jena.query.Query query, org.apache.jena.graph.Node s) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execConstructGrouped(QueryExecutionFactoryQuery conn, org.apache.jena.query.Query query, org.apache.jena.graph.Node s, boolean sortRowsByPartitionVar) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>execConstructQuads(Callable<org.apache.jena.query.QueryExecution> qes) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad>execConstructQuads(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>execConstructTriples(Callable<org.apache.jena.query.QueryExecution> qes) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple>execConstructTriples(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.atlas.json.JsonObject>execJsonItems(Callable<org.apache.jena.query.QueryExecution> qes) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.atlas.json.JsonObject>execJsonItems(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execPartitioned(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e) Deprecated.static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execPartitioned(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e, boolean sortRowsByPartitionVar) Deprecated.static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode>execPartitioned(QueryExecutionFactoryQuery conn, org.apache.jena.graph.Node s, org.apache.jena.query.Query q, boolean sortRowsByPartitionVar) Deprecated.static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution>execSelect(Callable<? extends org.apache.jena.query.QueryExecution> qes) static <T> io.reactivex.rxjava3.core.Flowable<T>execSelect(Callable<? extends org.apache.jena.query.QueryExecution> qes, Function<? super org.apache.jena.query.ResultSet, T> next) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution>execSelect(org.apache.jena.rdfconnection.SparqlQueryConnection conn, String queryStr) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution>execSelect(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>execSelectRaw(Callable<? extends org.apache.jena.query.QueryExecution> qes) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>execSelectRaw(Callable<? extends org.apache.jena.rdfconnection.SparqlQueryConnection> queryConnSupp, org.apache.jena.query.Query query) Create a Flowable from a supplier of connections and a query.static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>execSelectRaw(QueryExecutionFactoryQuery qeSupp, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>execSelectRaw(org.apache.jena.rdfconnection.SparqlQueryConnection queryConn, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Single<Long>fetchBindingCount(String serviceUrl, org.apache.jena.query.Query query) static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>>fetchCountQuery(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, Long itemLimit, Long rowLimit) static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>>fetchCountQuery(QueryExecutionFactoryQuery qef, org.apache.jena.query.Query query, Long itemLimit, Long rowLimit) static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>>fetchCountQueryPartition(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, Collection<org.apache.jena.sparql.core.Var> partitionVars, Long itemLimit, Long rowLimit) static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>>fetchCountQueryPartition(QueryExecutionFactoryQuery qef, org.apache.jena.query.Query query, Collection<org.apache.jena.sparql.core.Var> partitionVars, Long itemLimit, Long rowLimit) static io.reactivex.rxjava3.core.Single<Number>fetchNumber(Callable<? extends org.apache.jena.sparql.exec.QueryExec> queryConnSupp, org.apache.jena.sparql.core.Var var) static io.reactivex.rxjava3.core.Single<Number>fetchNumber(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) groupByOrdered(io.reactivex.rxjava3.core.Flowable<X> in, Function<X, K> getGroupKey) static voidstatic io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>mapToBinding(org.apache.jena.query.ResultSet rs) static Map.Entry<List<org.apache.jena.sparql.core.Var>,io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>> mapToFlowable(org.apache.jena.query.ResultSet rs) static org.apache.jena.query.QuerypreprocessQueryForPartition(org.apache.jena.query.Query q, List<org.apache.jena.sparql.core.Var> primaryKeyVars, boolean sortRowsByPartitionVar) Return a SELECT query from the given query where - it is ensured that all primaryKeyVars are part of the projection (if they aren't already) - distinct is applied in preparation to instantiation of construct templates (where duplicates can be ignored) - if sortRowsByPartitionVar is true then result bindings are sorted by the primary key vars so that bindings that belong together are consecutive - In case of a construct template without variables variable free is handledstatic voidprocessExecConstructTriples(io.reactivex.rxjava3.core.FlowableEmitter<org.apache.jena.graph.Triple> emitter, org.apache.jena.query.QueryExecution qex) static <T> voidprocessExecSelect(io.reactivex.rxjava3.core.FlowableEmitter<T> emitter, org.apache.jena.query.QueryExecution qex, Function<? super org.apache.jena.query.ResultSet, ? extends T> next) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>static <T> io.reactivex.rxjava3.core.Flowable<T>select(Callable<? extends org.apache.jena.sparql.exec.QueryExec> qes, Function<? super org.apache.jena.sparql.exec.RowSet, T> next) static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding>select(QueryExecFactoryQuery qef, org.apache.jena.query.Query query) static com.google.common.collect.Range<Long>
-
Constructor Details
-
SparqlRx
public SparqlRx()
-
-
Method Details
-
execAsk
-
execSelectRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> execSelectRaw(Callable<? extends org.apache.jena.rdfconnection.SparqlQueryConnection> queryConnSupp, org.apache.jena.query.Query query) Create a Flowable from a supplier of connections and a query. Each subscription obtains a fresh connection FIXME Connection is not yet closed when the flowable completes!- Parameters:
query-queryConnSupp-- Returns:
-
execSelectRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> execSelectRaw(QueryExecutionFactoryQuery qeSupp, org.apache.jena.query.Query query) -
execSelectRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> execSelectRaw(org.apache.jena.rdfconnection.SparqlQueryConnection queryConn, org.apache.jena.query.Query query) -
groupByOrdered
-
createTableBuffer
public static Function<List<org.apache.jena.sparql.engine.binding.Binding>,org.apache.jena.sparql.algebra.Table> createTableBuffer(List<org.apache.jena.sparql.core.Var> vars) - Parameters:
vars-- Returns:
-
processExecSelect
public static <T> void processExecSelect(io.reactivex.rxjava3.core.FlowableEmitter<T> emitter, org.apache.jena.query.QueryExecution qex, Function<? super org.apache.jena.query.ResultSet, ? extends T> next) -
processExecConstructTriples
public static void processExecConstructTriples(io.reactivex.rxjava3.core.FlowableEmitter<org.apache.jena.graph.Triple> emitter, org.apache.jena.query.QueryExecution qex) -
execSelect
-
execSelectRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> execSelectRaw(Callable<? extends org.apache.jena.query.QueryExecution> qes) -
execSelect
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution> execSelect(Callable<? extends org.apache.jena.query.QueryExecution> qes) -
execSelect
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution> execSelect(org.apache.jena.rdfconnection.SparqlQueryConnection conn, String queryStr) -
execSelect
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.query.QuerySolution> execSelect(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) -
execConstructTriples
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple> execConstructTriples(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) -
execConstructTriples
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple> execConstructTriples(Callable<org.apache.jena.query.QueryExecution> qes) -
constructTriples
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Triple> constructTriples(Callable<org.apache.jena.sparql.exec.QueryExec> qes) -
execConstructQuads
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> execConstructQuads(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) -
execConstructQuads
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.core.Quad> execConstructQuads(Callable<org.apache.jena.query.QueryExecution> qes) -
execJsonItems
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.atlas.json.JsonObject> execJsonItems(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query) -
execJsonItems
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.atlas.json.JsonObject> execJsonItems(Callable<org.apache.jena.query.QueryExecution> qes) -
select
-
select
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> select(QueryExecFactoryQuery qef, org.apache.jena.query.Query query) -
select
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> select(Callable<? extends org.apache.jena.sparql.exec.QueryExec> qes) -
mapToFlowable
-
mapToBinding
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.sparql.engine.binding.Binding> mapToBinding(org.apache.jena.query.ResultSet rs) -
createGrouper
public static Function<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.engine.binding.Binding> createGrouper(Collection<org.apache.jena.sparql.core.Var> vars, boolean retainNulls) Create a grouping function Usage: flowable .groupBy(createGrouper(Arrays.asList(... yourVars ...)))- Parameters:
vars-retainNulls-- Returns:
-
createGrouper
public static Function<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.graph.Node> createGrouper(org.apache.jena.sparql.core.Var var) -
main2
-
fetchNumber
public static io.reactivex.rxjava3.core.Single<Number> fetchNumber(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) -
fetchNumber
-
fetchCountQueryPartition
public static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>> fetchCountQueryPartition(QueryExecutionFactoryQuery qef, org.apache.jena.query.Query query, Collection<org.apache.jena.sparql.core.Var> partitionVars, Long itemLimit, Long rowLimit) -
fetchCountQueryPartition
public static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>> fetchCountQueryPartition(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, Collection<org.apache.jena.sparql.core.Var> partitionVars, Long itemLimit, Long rowLimit) -
fetchBindingCount
-
fetchCountQuery
public static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>> fetchCountQuery(QueryExecutionFactoryQuery qef, org.apache.jena.query.Query query, Long itemLimit, Long rowLimit) -
fetchCountQuery
public static io.reactivex.rxjava3.core.Single<com.google.common.collect.Range<Long>> fetchCountQuery(QueryExecFactoryQuery qef, org.apache.jena.query.Query query, Long itemLimit, Long rowLimit) -
toRange
-
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execConstructGrouped(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e) -
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execConstructGrouped(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e, boolean sortRowsByPartitionVar) -
execPartitioned
@Deprecated public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execPartitioned(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e) Deprecated. -
execPartitioned
@Deprecated public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execPartitioned(QueryExecutionFactoryQuery conn, Map.Entry<? extends org.apache.jena.graph.Node, org.apache.jena.query.Query> e, boolean sortRowsByPartitionVar) Deprecated. -
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execConstructGrouped(QueryExecutionFactoryQuery conn, org.apache.jena.query.Query query, org.apache.jena.graph.Node s) -
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execConstructGrouped(QueryExecutionFactoryQuery conn, org.apache.jena.query.Query query, org.apache.jena.graph.Node s, boolean sortRowsByPartitionVar) -
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<Map.Entry<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.rdf.model.RDFNode>> execConstructGrouped(RDFDataSource dataSource, org.apache.jena.query.Query query, List<org.apache.jena.sparql.core.Var> primaryKeyVars, org.apache.jena.graph.Node rootNode, boolean sortRowsByPartitionVar) -
execConstructGrouped
public static io.reactivex.rxjava3.core.Flowable<Map.Entry<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.rdf.model.RDFNode>> execConstructGrouped(Function<org.apache.jena.query.Query, org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.query.Query query, List<org.apache.jena.sparql.core.Var> primaryKeyVars, org.apache.jena.graph.Node rootNode, boolean sortRowsByPartitionVar) -
preprocessQueryForPartition
public static org.apache.jena.query.Query preprocessQueryForPartition(org.apache.jena.query.Query q, List<org.apache.jena.sparql.core.Var> primaryKeyVars, boolean sortRowsByPartitionVar) Return a SELECT query from the given query where - it is ensured that all primaryKeyVars are part of the projection (if they aren't already) - distinct is applied in preparation to instantiation of construct templates (where duplicates can be ignored) - if sortRowsByPartitionVar is true then result bindings are sorted by the primary key vars so that bindings that belong together are consecutive - In case of a construct template without variables variable free is handled- Parameters:
q-primaryKeyVars-sortRowsByPartitionVar-- Returns:
-
execPartitioned
@Deprecated public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execPartitioned(QueryExecutionFactoryQuery conn, org.apache.jena.graph.Node s, org.apache.jena.query.Query q, boolean sortRowsByPartitionVar) Deprecated. -
execConcept
-
execConcept
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.rdf.model.RDFNode> execConcept(Callable<org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.sparql.core.Var var) -
execConceptRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node> execConceptRaw(Callable<org.apache.jena.query.QueryExecution> qeSupp, org.apache.jena.sparql.core.Var var) -
execConceptRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node> execConceptRaw(org.apache.jena.rdfconnection.SparqlQueryConnection conn, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) -
execConcept
-
execConceptRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node> execConceptRaw(Function<? super org.apache.jena.query.Query, ? extends org.apache.jena.query.QueryExecution> qef, org.apache.jena.query.Query query, org.apache.jena.sparql.core.Var var) -
execConceptRaw
public static io.reactivex.rxjava3.core.Flowable<org.apache.jena.graph.Node> execConceptRaw(Function<? super org.apache.jena.query.Query, ? extends org.apache.jena.query.QueryExecution> qef, org.apache.jena.query.Query query) Convenience method that assumes a single projected variable
-