4

I made a query, that shows all items that are 'found in taxon' 'Chlamydia trachomatis D/UW-3/CX'. These items must have the Properties P644 (genomic start) and P645 (genomic end). So far this works. But then I wanted to filter these items depending on the values of 'genomic start' and 'genomic end'. In my example I wanted to recieve all items, where 'genomic start' is higher than '100' and 'genomic end' is lower than '3000'. But it did not work. Am I not using FILTER the right way?

Here is my code directly in the Wikidata Query Service Page: Wikidata Query Service

SELECT ?item ?genomic_start ?genomic_end
Where{
?item wdt:P703 wd:Q20800373. #P703:found in taxon
?item wdt:P644 ?genomic_start.
?item wdt:P645 ?genomic_end.
FILTER (?genomic_start > "100").
FILTER (?genomic_end < "3000").
}
4

1 回答 1

6

您需要先将值转换为 int 才能使用 > 或 <:

SELECT ?item ?genomic_start ?genomic_end
Where{
?item wdt:P703 wd:Q20800373. #P703:found in taxon
?item wdt:P644 ?genomic_start.
?item wdt:P645 ?genomic_end.
FILTER (xsd:integer(?genomic_start) > 100).
FILTER (xsd:integer(?genomic_end) < 3000). 
}
于 2016-03-16T15:28:11.730 回答