Hi On Mon, Apr 2, 2018 at 4:22 PM, gilga gilga <[email protected]> wrote: > SELECT DISTINCT ?person ?personLabel WHERE { > ?person wdt:P31 wd:Q5. > ?person wdt:P735 ?givenName. > SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } > FILTER(STRSTARTS(?givenName, "A")) > } > LIMIT 1000
so that's trying to filter the given name item not the label of the given name item. there's a few examples at https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial#FILTER that try to do FILTER(STRSTARTS(?humanLabel, "Mr. ")). the first one is broken but I assume it used to work. adapt the second "Mr. " example there and I get: SELECT DISTINCT ?person ?personLabel ?givenNameLabel ?gnlabel WHERE { ?person wdt:P31 wd:Q5. ?person wdt:P735 ?givenName. ?givenName rdfs:label ?gnlabel. FILTER(LANG(?gnlabel) = "[AUTO_LANGUAGE]"). FILTER(STRSTARTS(?gnlabel, "A")) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } that times out even with LIMIT 5. but if I test with a smaller dataset (fictional humans) it appears to be written properly: SELECT DISTINCT ?person ?personLabel ?givenNameLabel ?gnlabel WHERE { ?person wdt:P31 wd:Q15632617. ?person wdt:P735 ?givenName. ?givenName rdfs:label ?gnlabel. FILTER(LANG(?gnlabel) = "[AUTO_LANGUAGE]"). FILTER(STRSTARTS(?gnlabel, "A")) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } http://tinyurl.com/ydzdywmw -Jeremy _______________________________________________ Wikidata mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata
