Il 22/04/2015 00:05, James Douglas ha scritto: > Here's the (nearly) equivalent query for the statements dump[1] loaded > into Blazegraph: > > PREFIX wd: <http://www.wikidata.org/entity/> > SELECT DISTINCT ?city ?citylabel ?mayorlabel WHERE { > ?city wd:P31s/wd:P31v wd:Q515 . # find instances of > subclasses of city > ?city wd:P6s ?statement . # with a P6 (head of > goverment) statement > ?statement wd:P6v ?mayor . # ... that has the value > ?mayor > ?mayor wd:P21s/wd:P21v wd:Q6581072 . # ... where the ?mayor > has P21 (sex or gender) female > FILTER NOT EXISTS { ?statement wd:P582q ?x } # ... but the statement > has no P582 (end date) qualifier > > # Now select the population value of the ?city > # (the number is reached through a chain of three properties) > ?city > wd:P1082s/wd:P1082v/<http://www.wikidata.org/ontology#numericValue> > ?population . > > # Optionally, find English labels for city and mayor: > OPTIONAL { > ?city wd:P373s/wd:P373v ?citylabel . > # FILTER ( LANG(?citylabel) = "en" ) > } > OPTIONAL { > ?mayor wd:P373s/wd:P373v ?mayorlabel . > # FILTER ( LANG(?mayorlabel) = "en" ) > } > > } ORDER BY DESC(?population) LIMIT 100 > > Free beer to anyone who can figure out how to use those language > filters. Would we need to also load property definitions[2]?
James, I believe language filters are defined only on rdfs:label, not on the P373 property(-ies). Replace wd:P373s/wd:P373v with rdfs:label and it will work. Nicola P.S. Where is my beer? :-) _______________________________________________ Wikidata-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-l
