M20
M20

Reputation: 1112

SPARQL Regex does not show what is supposed to show

I am trying to run this query on http://www.linkedmdb.org/snorql and on Jena (java) in order to get all datasets with the title "NVA" for example.

select ?f where {

            ?f dc:title  ?s.
            FILTER(REGEX(?s, "NVA", "i")).

 }

However, it shows only this result http://data.linkedmdb.org/page/film/2532 and not http://data.linkedmdb.org/page/film/4958 (the one I should get).

But by running this query, I get only the second dataset (4958) and not first

select ?f where {

            ?f dc:title  "NVA"

 }

I was wondering why my filter is not working correctly ? and what should I add to get the datasets with the exact title of my keyword in my regex?

Thanks.

Upvotes: 0

Views: 60

Answers (1)

AndyS
AndyS

Reputation: 16630

FILTER(REGEX(?s, "NVA", "i")).

The "i" means case insensitive matching. The "NVA" matches any part for the string.

?f dc:title "NVA"

is more like:

?f dc:title  ?s.
FILTER REGEX(?s, "^NVA$")

Upvotes: 2

Related Questions