On 4/23/15 5:25 PM, Nicola Vitucci wrote:
Il 23/04/2015 20:01, Kingsley Idehen ha scritto:
>On 4/23/15 1:02 PM, Nicola Vitucci wrote:
>>Il 23/04/2015 18:36, Gerard Meijssen ha scritto:
>>> >Hoi,
>>> >Do I understand correctly that you cannot have results showing labels
>>> >for a given languages?
>>> >Thanks,
>>> >       GerardM
>>> >
>>Hi Gerard,
>>
>>what do you mean? Are you looking for something like this?
>>
>>http://wikisparql.org/sparql?query=PREFIX+wd%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0D%0ASELECT+DISTINCT+%3Fcity+%3Fcitylabel+%3Fmayorlabel+WHERE+%7B%0D%0A++%3Fcity+wd%3AP31s%2Fwd%3AP31v+wd%3AQ515+.%0D%0A++%3Fcity+wd%3AP6s+%3Fstatement+.+++%0D%0A++%3Fstatement+wd%3AP6v+%3Fmayor+.%0D%0A++%3Fmayor+wd%3AP21s%2Fwd%3AP21v+wd%3AQ6581072+.+++++%0D%0A++FILTER+NOT+EXISTS+%7B+%3Fstatement+wd%3AP582q+%3Fx+%7D%0D%0A++%3Fcity+wd%3AP1082s%2Fwd%3AP1082v%2F%3Chttp%3A%2F%2Fwww.wikidata.org%2Fontology%23numericValue%3E+%3Fpopulation+.%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fcity+rdfs%3Alabel+%3Fcitylabel+.%0D%0A++++FILTER+%28+LANG%28%3Fcitylabel%29+%3D+%22es%22+%29%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fmayor+rdfs%3Alabel+%3Fmayorlabel+.%0D%0A++++FILTER+%28+LANG%28%3Fmayorlabel%29+%3D+%22es%22+%29%0D%0A++%7D%0D%0A%7D+ORDER+BY+DESC%28%3Fpopulation%29+LIMIT+100
>>
>>
>>(The chosen language is Spanish)
>>
>>Nicola
>
>Do you not have a URL parameter that resolves to the query source?
>
>Example:
>http://milenio.dcc.uchile.cl/sparql?default-graph-uri=&qtxt=PREFIX+wd:+%3Chttp://www.wikidata.org/entity/%3E%0D%0ASELECT+DISTINCT+%3Fcity+%3Fcitylabel+%3Fmayorlabel+WHERE+%7B%0D%0A++%3Fcity++++++wd:P31s/wd:P31v+wd:Q515+++++.++++++%23+find+instances+of+subclasses+of+city%0D%0A++%3Fcity++++++wd:P6s++++++++++%3Fstatement++.++++++%23+with+a+P6+(head+of+goverment)+statement%0D%0A++%3Fstatement+wd:P6v++++++++++%3Fmayor++++++.++++++%23+...+that+has+the+value+%3Fmayor%0D%0A++%3Fmayor+++++wd:P21s/wd:P21v+wd:Q6581072+.++++++%23+...+where+the+%3Fmayor+has+P21+(sex+or+gender)+female%0D%0A++FILTER+NOT+EXISTS+%7B+%3Fstatement+wd:P582q+%3Fx+%7D++%23+...+but+the+statement+has+no+P582+(end+date)+qualifier%0D%0A+%0D%0A++%23+Now+select+the+population+value+of+the+%3Fcity%0D%0A++%23+(the+number+is+reached+through+a+chain+of+three+properties)%0D%0A++%3Fcity+wd:P1082s/wd:P1082v/%3Chttp://www.wikidata.org/ontology%23numericValue%3E+%3Fpopulation+.%0D%0A%0D%0A++%23+Optionally,+find+English+labels+for+city+
and+mayor:%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fcity+wd:P373s/wd:P373v+%3Fcitylabel+.%0D%0A++++%23+FILTER+(+LANG(%3Fcitylabel)+%3D+%22en%22+)%0D%0A++%7D%0D%0A++OPTIONAL+%7B%0D%0A++++%3Fmayor+wd:P373s/wd:P373v+%3Fmayorlabel+.%0D%0A++++%23+FILTER+(+LANG(%3Fmayorlabel)+%3D+%22en%22+)%0D%0A++%7D%0D%0A%0D%0A%7D+ORDER+BY+DESC(%3Fpopulation)+LIMIT+100&format=text/html&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on
>
>
>
>
>If not, please paste the query source in a reply.
>
>
Hi Kingsley,

currently there is no such parameter, but it's a good idea - I'll add it.

The query source with the Spanish labels is below (replace "es" with
"ru" for the Russian labels):

---------------------------------------------------

PREFIX wd:<http://www.wikidata.org/entity/>
SELECT DISTINCT ?city ?citylabel ?mayorlabel WHERE {
   ?city wd:P31s/wd:P31v wd:Q515 .
   ?city wd:P6s ?statement .
   ?statement wd:P6v ?mayor .
   ?mayor wd:P21s/wd:P21v wd:Q6581072 .
   FILTER NOT EXISTS { ?statement wd:P582q ?x }
   ?city
wd:P1082s/wd:P1082v/<http://www.wikidata.org/ontology#numericValue>
?population .
   OPTIONAL {
     ?city rdfs:label ?citylabel .
     FILTER ( LANG(?citylabel) = "es" )
   }
   OPTIONAL {
     ?mayor rdfs:label ?mayorlabel .
     FILTER ( LANG(?mayorlabel) = "es" )
   }
} ORDER BY DESC(?population) LIMIT 100

---------------------------------------------------

Nicola

Yes, I know that. Our responses our a little out of sync. The link I shared to the query definition exposed what I wanted to share with others re. use of LANG() and the nature of SELECT list output etc..

Anyway, it would be great if you add the @qtx parameter as alternative to @query when the goal is identifying a document that's comprised of the SPARQL Query Definition rather than SPARQL Query Result (or solution).

This is good news!

--
Regards,

Kingsley Idehen 
Founder & CEO
OpenLink Software
Company Web: http://www.openlinksw.com
Personal Weblog 1: http://kidehen.blogspot.com
Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen
Twitter Profile: https://twitter.com/kidehen
Google+ Profile: https://plus.google.com/+KingsleyIdehen/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen
Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this


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

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

Reply via email to