I don’t think there’s any SPARQL function that can transform a single
result into multiple results (one for each string fragment, in that
case). But for your request, a regex works:

SELECT ?human ?label WHERE {
  ?human wdt:P31 wd:Q15632617;
         rdfs:label ?label.
  FILTER(LANG(?label) = "en")
  FILTER(REGEX(?label, "y\\s"))
}

Link
<https://query.wikidata.org/#SELECT%20%3Fhuman%20%3Flabel%20WHERE%20%7B%0A%20%20%3Fhuman%20wdt%3AP31%20wd%3AQ15632617%3B%0A%20%20%20%20%20%20%20%20%20rdfs%3Alabel%20%3Flabel.%0A%20%20FILTER%28LANG%28%3Flabel%29%20%3D%20%22en%22%29%0A%20%20FILTER%28REGEX%28%3Flabel%2C%20%22y%5C%5Cs%22%29%29%0A%7D>

On 18.09.2017 19:07, Thad Guidry wrote:
>
> Say I have this query...
>
> SELECT ?human ?label
> WHERE
> {
>   ?human wdt:P31 wd:Q15632617; rdfs:label ?label.
>   FILTER(LANG(?label) = "en").
>   FILTER(STRSTARTS(?label, "Mr. ")).
> }
>
> What if I wanted to see if any one of a humans name ends with "y" such
> as my last name does , their first, last, doesn't matter.  I have a
> "d" and a "y" on the array returned from my name (if it were split by
> whitespace)
>
> I did not see any special syntax or FILTER or Label service commands
> to help with splitting apart a Label by whitespace and then applying a
> filter on each string.
>
> How would I accomplish this ? 
>
> Thad
> ​​
> +ThadGuidry <https://www.google.com/+ThadGuidry>
>
>
> _______________________________________________
> Wikidata mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikidata

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to