[SPARQL][WIKIDATA] FILTER NOT EXISTS
FILTER NOT EXISTS
How did I encounter this?
It's found out that Wikidata keeps track of deprecated dates of videos games in case a game is delayed or with other reasons. The deprecated date is marked with p2241 code in publication date statement node. This is an unnecessary data for the project. I found a way to filter this out: FILTER NOT EXISTS.
Syntax
FILTER NOT EXISTS is used to exclude certain patterns from the results. It works by checking if the specified pattern exists in the graph. If the pattern exists for a given variable binding, the result is excluded. If the pattern does not exist, the result is included.Example:
For each
?publicationDateNode:- If a
P2241qualifier exists, the node is excluded. - If no
P2241qualifier exists, the node is included.
Note: that `FILTER NOT EXISTS` should be followed by patterns, not logical expressions. The following case doesn't work
FILTER NOT EXISTS {
(?platformLabelFromDate != "PlayStation 4" || ?platformLabelFromDate != "PlayStation 5")
}
Comments
Post a Comment