Odd filter behavior


(Johan Kumps) #1

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,


(stephen) #2

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


(Johan Kumps) #3

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,


(stephen) #4

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”


(Johan Kumps) #5

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,


(system) #6

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