Reputation: 2431
How to make a FILTER()
conditional? This is the relevant part of my query:
SELECT *
WHERE {
VALUES (?open) {$U2}
?URI_OPP CSV:id_opportunita ?ID_OPP.
OPTIONAL { ?URI_OPP CSV:data_scadenza ?DATA_S }
FILTER ((NOW() - xsd:datetime(?DATA_S)) > 0)
}
It gets $U2
as a value for ?open
. I want to apply the filter if ?open = 1
, and not to apply it in all other cases.
While IF()
works on the query results, I don't know what to use to switch off parts of the query itself.
Upvotes: 1
Views: 1153
Reputation: 3551
Since the above commented never answered, I will:
FILTER(
(?open != 1) ||
((NOW() - xsd:datetime(?DATA_S)) > 0)
)
Upvotes: 1