[
https://issues.apache.org/jira/browse/JENA-1633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695106#comment-16695106
]
ASF GitHub Bot commented on JENA-1633:
--------------------------------------
GitHub user afs opened a pull request:
https://github.com/apache/jena/pull/493
JENA-1633: MINUS when the LHS has an unbound but mentioned variable.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afs/jena minus
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/493.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #493
----
commit 66dbb0a9898aa5ee25dbce01751973bbf8ca9ad7
Author: Andy Seaborne <andy@...>
Date: 2018-11-21T18:47:48Z
JENA-1633: MINUS when the LHS has an unbound but mentioned variable.
commit dd5d59ab9e28b0f6fafb345a8c022a0cfa2bc78b
Author: Andy Seaborne <andy@...>
Date: 2018-11-21T18:48:22Z
Make sure all test suites are run.
----
> Seeing incorrect answers to a specific SPARQL 1.1 MINUS query with some
> datasets
> --------------------------------------------------------------------------------
>
> Key: JENA-1633
> URL: https://issues.apache.org/jira/browse/JENA-1633
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 3.4.0, Jena 3.9.0
> Reporter: Julian Dolby
> Assignee: Andy Seaborne
> Priority: Major
>
> We appear to be seeing incorrect answers when the following query is
> applied to some datasets but not others:
> {noformat}
> PREFIX foaf: <http://xmlns.com/foaf/0.1/>
> SELECT ?name ?musician ?band WHERE {
> ?musician foaf:name ?name .
> OPTIONAL {
> ?musician foaf:member ?band .
> }
> MINUS {
> ?x foaf:homepage "some bad page" .
> OPTIONAL {
> ?x foaf:member ?band .
> }
> }
> }
> {noformat}
> We run that query on the following data set using Jena 3.9.0:
> {noformat}
> <http://www.w3.org/2001/XMLSchema#string> <http://xmlns.com/foaf/0.1/name>
> <http://synthetic/0> .
> <http://www.w3.org/2001/XMLSchema#string>
> <http://www.w3.org/2001/XMLSchema#boolean> "some bad page" .
> <http://www.w3.org/2001/XMLSchema#string>
> <http://www.w3.org/2001/XMLSchema#boolean> "num1"^^<http://any/number> .
> <http://www.w3.org/2001/XMLSchema#string> <http://synthetic/0>
> <http://www.w3.org/2001/XMLSchema#boolean> .
> <http://www.w3.org/2001/XMLSchema#decimal>
> <http://xmlns.com/foaf/0.1/homepage> "some bad page" .
> {noformat}
> and the result is empty. This is surely wrong because the first
> triple of the dataset matches the first triple in the query, and
> nothing matches the optional part, indeed, there are no foaf:member
> triples at all. Given that, the minus part cannot possibly match
> because ?band is unbound and hence the dom() relations of the two
> parts must be disjoint. So surely there should be one result?
> We run this test using the following simple driver program:
> {noformat}
> public class JenaRunner {
>
> public static void main(String[] args) throws MalformedURLException,
> IOException {
> Query ast = JenaUtil.parse(args[0]);
> Dataset dataset = RDFDataMgr.loadDataset(args[1]);
> QueryExecution exec = QueryExecutionFactory.create(ast, dataset);
> ResultSet results = exec.execSelect();
> ResultSetFormatter.output(
> System.out,
> results,
> ResultsFormat.FMT_RDF_TURTLE);
> }
> }
> {noformat}
> This problem is possibly quite subtle, since we do get correct results
> for some other datasets like the following:
> {noformat}
> <http://synthetic/0> <http://synthetic/0> <http://synthetic/2> .
> <http://synthetic/3> <http://www.w3.org/2001/XMLSchema#boolean>
> "lit0"^^<http://any/iri> .
> <http://xmlns.com/foaf/0.1/name> <http://synthetic/3>
> "lit0"^^<http://any/iri> .
> _:BX5FX3Ablank0 <http://xmlns.com/foaf/0.1/name> "num2"^^<http://any/number> .
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)