0

What I am trying to do is to select a certain entity for the certain condition. If the condition is url, then how I can make a proper query to get the only result that matches the v1 = "https://www.getmagicbullet.com/" . The commented sentences are what I tried different ways, but only to fail. How could I adjust the query to get the right answer? Thank you for your help.

    SELECT DISTINCT ?iLabel ?p ?v1
    WHERE {
        ?i wdt:P31 wd:Q212920.
        ?i wdt:P856 ?v1.
#       FILTER (?v1Label = "https://www.getmagicbullet.com/")
#        { ?v1 rdfs:label "https://www.getmagicbullet.com/"@en } 
# UNION { ?v1 skos:altLabel "https://www.getmagicbullet.com/"@en }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en,[AUTO_LANGUAGE]". }
    }
    LIMIT 1000  
Keanu Paik
  • 304
  • 2
  • 12
  • the bindings of `?v1` are URIs, thus, you have to use the URI in the filter expression: `FILTER (?v1 = )` - is that what you're asking? And w.r.t. to your `UNION` pattern, those *external* URIs don't have labels contained in the Wikidata dataset. So it does not work. – UninformedUser Apr 22 '19 at 09:48
  • 1
    if you want to do string comparison on URIs, as you already should know from previous questions, use string functions in the filter, e.g. `FILTER(str(?v1) = "https://www.getmagicbullet.com/")` - clearly, this might be much slower than `FILTER (?v1 = )` which in fact is equivalent to use the URI directly in the triple pattern, i.e. `?i wdt:P856 ` where the triple store could make use of `pos` index – UninformedUser Apr 22 '19 at 09:51
  • Oh, I see. Great. I didn't know that url always use blacket like <> Thanks – Keanu Paik Apr 22 '19 at 12:12

0 Answers0