SPARQL and number comparison in Sesame
A colleague of mine wanted to do a simple number comparison in Sesame2, and couldn't make it out of the box. Because you may also want to query for "?blogposts nao:numericRating ?rating. FILTER (?rating > 8)":
SELECT ?blogpost ?rating WHERE {
?blogpost nao:numericRating ?rating.
FILTER (?rating >= '8'^^<http://www.w3.org/2001/XMLSchema#integer>) .
}
Thanks and kudos to Manuel Möller
What is NAO? An ontology used on the Semantic Desktop to rate things. So, if you give stars to something in KDE 4.0, its a NAO triple...
- This won't work: FILTER (?rating > 8)
- This will: FILTER (?depth <= '5'^^<http://www.w3.org/2001/XMLSchema#integer>)
- If you didn't guess it already: its single hyphens, double hyphens won't work!
SELECT ?blogpost ?rating WHERE {
?blogpost nao:numericRating ?rating.
FILTER (?rating >= '8'^^<http://www.w3.org/2001/XMLSchema#integer>) .
}
Thanks and kudos to Manuel Möller
What is NAO? An ontology used on the Semantic Desktop to rate things. So, if you give stars to something in KDE 4.0, its a NAO triple...
leobard - 13. Aug, 12:06
|
- add comment - 0 trackbacks