You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Stephen Allen (JIRA)" <ji...@apache.org> on 2015/01/30 02:31:34 UTC
[jira] [Updated] (JENA-874) Subqueries not functioning properly
when Filter clauses are present
[ https://issues.apache.org/jira/browse/JENA-874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen Allen updated JENA-874:
-------------------------------
Attachment: TestSubquery.java
Attached a unit test that demonstrates the failure.
> Subqueries not functioning properly when Filter clauses are present
> -------------------------------------------------------------------
>
> Key: JENA-874
> URL: https://issues.apache.org/jira/browse/JENA-874
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 2.12.2
> Reporter: Stephen Allen
> Priority: Blocker
> Attachments: TestSubquery.java
>
>
> Queries with Subqueries are not functioning properly when a filter clause exists. This is a regression, as it worked properly in 2.11.2 (I haven't checked 2.12.1).
> Example:
> {code:title=data.ttl}
> <http://r1> a <http://type> .
> <http://r1> a <http://type2> .
> <http://r2> a <http://type> .
> <http://r2> a <http://type2> .
> <http://r3> a <http://type> .
> <http://r3> a <http://type2> .
> {code}
> {code:title=Bind Query}
> select *
> where {
> graph <http://graph1> {
> {
> select distinct (?_id as ?id)
> where {
> values ?_type {
> <http://type2>
> }
> ?_id a ?_type .
> ?_id a <http://type> .
> filter ( ?_id = <http://r1> || ?_id = <http://r2> )
> }
> }
> ?id a <http://type> . bind (<http://type2> as ?type) . ?id a ?type .
> }
> }
> order by ?id
> {code}
> {code:title=Bind Algebra}
> (base <http://example/base/>
> (order (?id)
> (graph <http://graph1>
> (join
> (extend ((?type <http://type2>))
> (join
> (distinct
> (project (?id)
> (extend ((?id ?_id))
> (filter (|| (= ?_id <http://r1>) (= ?_id <http://r2>))
> (join
> (table (vars ?_type)
> (row [?_type <http://type2>])
> )
> (bgp
> (triple ?_id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?_type)
> (triple ?_id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://type>)
> ))))))
> (bgp (triple ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://type>))))
> (bgp (triple ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type))))))
> {code}
> {code:title=Filter Query}
> select *
> where {
> graph <http://graph1> {
> {
> select distinct (?_id as ?id)
> where {
> values ?_type {
> <http://type2>
> }
> ?_id a ?_type .
> ?_id a <http://type> .
> filter ( ?_id = <http://r1> || ?_id = <http://r2> )
> }
> }
> ?id a <http://type> . ?id a ?type . filter (?type != <http://type> ) .
> }
> }
> order by ?id
> {code}
> {code:title=Filter Algebra}
> (base <http://example/base/>
> (order (?id)
> (graph <http://graph1>
> (filter (!= ?type <http://type>)
> (join
> (distinct
> (project (?id)
> (extend ((?id ?_id))
> (filter (|| (= ?_id <http://r1>) (= ?_id <http://r2>))
> (join
> (table (vars ?_type)
> (row [?_type <http://type2>])
> )
> (bgp
> (triple ?_id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?_type)
> (triple ?_id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://type>)
> ))))))
> (bgp
> (triple ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://type>)
> (triple ?id <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type)
> ))))))
> {code}
> For both queries, the results should look like:
> {code}
> --------------------------------
> | id | type |
> ================================
> | <http://r1> | <http://type2> |
> | <http://r2> | <http://type2> |
> --------------------------------
> {code}
> However, only the Bind query actually works correctly. The Filter query returns no rows.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)