The two ?child variables occur in different scopes. Therefore your MINUS is subtracting all resources that have any value for dcterms:subject which is almost certainly not your intent
Movingthe earlier pattern that selects specific ?child values of interest inside of the minus likely gives you the results you were after because that puts the two variables in the same scope Rob On 10/01/2017 10:32, "Mikael Pesonen" <[email protected]> wrote: Hi, Could anyone help, whats the issue with my query using MINUS? First, this returns all ~700 resources : SELECT DISTINCT ?resource WHERE { GRAPH <http://www.lingsoft.fi/ontologies/574ef1a40236a/> { <http://www.lingsoft.fi/ontologies/574ef1a40236a/9db41bbf2114c46e> skos:narrower* ?child } GRAPH <http://www.lingsoft.fi/resource-meta/> { ?resource dcterms:isPartOf <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . } } And adding one condition (dcterms:subject) returns correctly ~300 resources SELECT DISTINCT ?resource WHERE { GRAPH <http://www.lingsoft.fi/ontologies/574ef1a40236a/> { <http://www.lingsoft.fi/ontologies/574ef1a40236a/9db41bbf2114c46e> skos:narrower* ?child } GRAPH <http://www.lingsoft.fi/resource-meta/> { ?resource dcterms:isPartOf <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . ?resource dcterms:subject ?child } } But I would like to get the rest of docs, about ~400, that above is not returning SELECT DISTINCT ?resource WHERE { GRAPH <http://www.lingsoft.fi/ontologies/574ef1a40236a/> { <http://www.lingsoft.fi/ontologies/574ef1a40236a/9db41bbf2114c46e> skos:narrower* ?child } GRAPH <http://www.lingsoft.fi/resource-meta/> { ?resource dcterms:isPartOf <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . MINUS { ?resource dcterms:subject ?child } } } This query returns 0 results. I don't get what's wrong here. I'm using Jena Fuseki 2.3.1. Thanks, Mikael -- Lingsoft - 30 years of Leading Language Management www.lingsoft.fi Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books Mikael Pesonen System Engineer e-mail: [email protected] Tel. +358 2 279 3300 Time zone: GMT+2 Helsinki Office Eteläranta 10 FI-00130 Helsinki FINLAND Turku Office Linnankatu 10 A FI-20100 Turku FINLAND
