[
https://issues.apache.org/jira/browse/JENA-1945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183070#comment-17183070
]
Claus Stadler commented on JENA-1945:
-------------------------------------
Hi Andy,
My use cases are my collection of command line tools such as
[sparql-integrate|https://github.com/SmartDataAnalytics/SparqlIntegrate/tree/develop]
which allows running a sequence of sparql statements over an RDFConnection in
the same fashion as one would run .sql scripts and
[facete3|https://github.com/hobbit-project/facete3/tree/develop/facete3-core-parent/facete3-cli]
which enables faceted search over an RDFConnection. In the recent years I
starting working alot with quad-based datasets - essentially using named graphs
to group together sets of triples that make up meaningful data records.
Hence, at some point I added flags to both my SPARQL-centric tools for enabling
unionDefaultGraph query rewriting so that queries such as SELECT * { ?s ?p ?o }
can be run on plain RDF datasets (the default graph) or across all 'records'
(i.e. named graphs).
The main reason why I like the unionDefaultGraph query rewriting approach is
that it facilitates independence of the underlying RDF store, and it can be
abstracted away from the application logic by wrapping an RDFConnection to
transparently perform the rewriting.
This is also the reason why I'd prefer query rewriting over
DatasetGraph.getUnionGraph.
The faceted search tool creates essentially UNIONs of GROUP BY of BGP+FILTERs -
so for this use case the existing code works. But recently I had a use case
where I wanted to run some property paths across a set of 'records' and there I
noted that I would not work as expected.
> Algebra.unionDefaultGraph: OpPath not handled
> ---------------------------------------------
>
> Key: JENA-1945
> URL: https://issues.apache.org/jira/browse/JENA-1945
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Affects Versions: Jena 3.16.0
> Reporter: Claus Stadler
> Priority: Major
>
>
> {code:java}
> System.out.println(
> Algebra.unionDefaultGraph(
> Algebra.compile(
> QueryFactory.create("SELECT * { ?s <urn:p> ?o }"))));
> /* Yields correct result:
> (distinct
> (graph ??_
> (bgp (triple ?s <urn:p> ?o))))
> */
> System.out.println(
> Algebra.unionDefaultGraph(
> Algebra.compile(
> QueryFactory.create("SELECT * { ?s <urn:p1>/<urn:p2>/<urn:p3> ?o }"))));
> /* Yields incorrect result because wrapping with graph ??_ (and distinct) is
> missing:
> (path ?s (seq (seq <urn:p1> <urn:p2>) <urn:p3>) ?o)
> */
> {code}
>
> It seems
> [TransformUnionQuery.java|https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformUnionQuery.java#L34]
> lacks the handling of (at least) OpPath
--
This message was sent by Atlassian Jira
(v8.3.4#803005)