Odd filter behavior

Hi,

I’m trying to filter my data using this query:

prefix sosa: http://www.w3.org/ns/sosa/
prefix qudt: http://qudt.org/schema/qudt#

select ?v ?o
where {
?o a sosa:Observation .
?o sosa:hasFeatureOfInterest ?foi .
?o sosa:phenomenonTime ?t .
?o sosa:hasResult ?r .
?r qudt:numericValue ?v .
FILTER (?v < 10.0)
}

The value of the ?v parameter is 2.5. Unfortunately I don’t get any results of the query but when I change my filter to FILTER(?v > 10.0) I get the triple with the 2.5 value out of the DB.

What is wrong here?

Johan,

I would check your datatypes on the qudt:numericValue field. It looks like they’re being compared as strings.

Hi Stephen,

What would that mean for the filter? Changing it to FILTER (?v < “10”) does not help. When I add the triple the object is a string.

Johan,

You would need to set the data type to a number type if you want them compared as numbers. When talking straight string comparison, “2.5” > “10.0” because “2” > “1”

Stephen,

Apparently the data was wrongly inserted as strings. I changed that to the correct datatypes and all is working fine.

Thanks for the tip!

Johan,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.