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
Fix FILTER (lang(…) = …) for predicate paths #276 #277
Fix FILTER (lang(…) = …) for predicate paths #276 #277
Conversation
We were trying to use language tagged predicates on predicate paths. Instead if the predicate path isn't simple we have to fallback on using language predicates on the literal variable. This change also means that if a predicate path mixes predicates with literal subjects and non-literal subjects we only get the literals when FILTER (lang(?var) = "…") is used. The spec at https://www.w3.org/TR/sparql11-query/#func-lang doesn't make it clear what should happen when applied to a non-literal. Our behaviour matches the Wikidata Query Service though.
The following is an example query for the behavior with mixed literal and non-literal subjects: PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?alias WHERE {
wd:Q567 skos:altLabel|rdfs:label|wdt:P106 ?alias .
FILTER (lang(?alias) = "en")
} removing the language |
@floriankramer can you take a look, otherwise I'll just merge as trivial change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor wording stuff, can't say much about the code itself.
src/parser/SparqlParser.cpp
Outdated
it = std::find_if(it + 1, pattern->_whereClauseTriples.end(), | ||
[&lhs](const auto& tr) { return tr._o == lhs; }); | ||
} | ||
// First find a suitabke triple for the given variable. It |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo suitabke
-> suitable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find
@lehmann-4178656ch can you give this an ACK, I'd like to merge it and it seems neither @floriankramer nor @joka921 are coming around to a proper review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM without running extensive tests.
Improve FILTER (lang(… for predicate paths #276
We were trying to use language tagged predicates on predicate paths.
Instead if the predicate path isn't simple we have to fallback on using
language predicates on the literal variable.
This change also means that if a predicate path mixes predicates with
literal subjects and non-literal subjects we only get the literals when
FILTER (lang(?var) = "…")
is used.The spec at https://www.w3.org/TR/sparql11-query/#func-lang
doesn't make it clear what should happen when applied to a non-literal.
Our behaviour matches the Wikidata Query Service though.