Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subqueries can lead to filters not being applied #158

Closed
floriankramer opened this issue Dec 10, 2018 · 1 comment
Closed

Subqueries can lead to filters not being applied #158

floriankramer opened this issue Dec 10, 2018 · 1 comment
Assignees
Labels

Comments

@floriankramer
Copy link
Member

floriankramer commented Dec 10, 2018

As mentioned in #156 by @niklas88:
Could this be related to the problem discussed on the list, that:

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?predicate ?predicate_name WHERE {
    ?x wikibase:claim ?predicate .
    ?x rdfs:label ?predicate_name .
    FILTER regex(?predicate_name, "^"occ") .
    FILTER langMatches(lang(?predicate_name), "en") 
}

works with prefix regex but adding a subquery fails to filter:

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?predicate ?predicate_name ?count WHERE {
    {
        SELECT ?predicate (COUNT(?predicate) as ?count) WHERE {
          ?person wdt:P31 wd:Q5 .
          ?person ql:has-predicate ?predicate
        }
        GROUP BY ?predicate
        ORDER BY DESC(?count)
    } 

    ?x wikibase:claim ?predicate .
    ?x rdfs:label ?predicate_name .
    FILTER regex(?predicate_name, "^"occ") .
    FILTER langMatches(lang(?predicate_name), "en") 
}

If you don't think this is the same issue I'll open a separate one

@floriankramer floriankramer self-assigned this Dec 10, 2018
@floriankramer floriankramer mentioned this issue Dec 10, 2018
@niklas88
Copy link
Member

Note that FILTER regex(?predicate_name, "^"occ") . is also a problem with the parser because the correct FILTER regex(?predicate_name, "^\"occ") . form isn't supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants