Reputation: 4532
I want to filter a count result. I'm using the following query:
SELECT (COUNT(*) AS ?total)
WHERE {
?s sf:RatioSWO ?o .
}
GROUP BY ?total
This only gives me the total rows of the predicate. I've tried filtering by placing a "< 0.5" after the COUNT(*) but this just gives me a result of "false" which I have no idea what that means. I've also tried HAVING and FILTER but both give me no results.
Upvotes: 2
Views: 11017
Reputation: 3660
If you want to return the ?total-s where ?total is < 0.5 you can do:
SELECT (COUNT(*) AS ?total)
WHERE {
?s sf:RatioSWO ?o .
}
GROUP BY ?s
HAVING (?total < 0.5)
From the question it's not clear what you mean.
Upvotes: 20
Reputation: 9472
I'm not quite sure what you're trying to achieve, but how about this:
SELECT (COUNT(*) AS ?total)
WHERE {
?s sf:RatioSWO ?o .
FILTER (?o < 0.5)
}
This counts the number of sf:RatioSWO
triples where the value is greater than 0.5.
Upvotes: 5