[SPARQL] VALUES
VALUES
How did I encounter this?
When sending SPARQL queries, I wanted to limit the search to certain type of data only to entities of video games. I found VALUES() as a solution for that.
Syntax
In SPARQL, the VALUES clause restricts a variable to a fixed set of possible values. It effectively acts like a short, direct way of saying “only accept these specific values.”
VALUES ?type { wd:Q7889 wd:Q64170203 }.
This example says, “?type must be either wd:Q7889 or wd:Q64170203.” Any row where ?type is something else will be excluded from the results.
This approach is simpler and better performance-wise
Comments
Post a Comment