Unbound variable in FILTER clause doesn't raise an error
The following query returns no results:
SELECT ?urn
WHERE {
{ SELECT ?urn
WHERE {
?urn a nmm:Photo ; nie:isStoredAs ?file
}
}
FILTER (fn:contains (nie:isStoredAs(?file), 'file://'))
}
It is in fact invalid, as the ?file
variable is unbound in the outer graph pattern. The same occurs if the FILTER is changed to FILTER (fn:contains (?file, 'file://'))
.
If we use a variable in the filter that's not mentioned in the inner SELECT, we do get a Could not run query, Use of undefined variable 'random'
error, so I think the issue is related to use of a nested query.