Help

Difference between revisions of "SPARQL"

Line 6: Line 6:
 
* [[DataViz:Records]]
 
* [[DataViz:Records]]
  
== ✅ Is Sex or Gender(Q7) → list all possible values ==
+
== ✅ Is Sex or Gender([[Q7]]) → list all possible values ==
 
{|  
 
{|  
 
|- style="vertical-align:top;"
 
|- style="vertical-align:top;"
Line 31: Line 31:
 
|}
 
|}
  
== ✅ Is Speaker (Q3) → list all speakers ==
+
== ✅ Is Speaker ([[Q3]]) → list all speakers ==
 
{|  
 
{|  
 
|- style="vertical-align:top;"
 
|- style="vertical-align:top;"
 
|style="padding: 0 3em;width:60%"|
 
|style="padding: 0 3em;width:60%"|
 
<syntaxhighlight lang="sparql">
 
<syntaxhighlight lang="sparql">
select ?locutor ?locutorLabel
+
select ?speaker ?speakerLabel
 
where {
 
where {
   ?locutor prop:P2 * entity:Q3 .
+
   ?speaker prop:P2 entity:Q3 .
 
   SERVICE wikibase:label {
 
   SERVICE wikibase:label {
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
Line 45: Line 45:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
||
 
||
<query _pagination="5" locutor="Item" locutorLabel="Speaker" langLabel="Language">
+
<query _pagination="5" speaker="Item" speakerLabel="Speaker" langLabel="Language">
select ?locutor ?locutorLabel
+
select ?speaker ?speakerLabel
 
where {
 
where {
   ?locutor prop:P2 entity:Q3 .
+
   ?speaker prop:P2 entity:Q3 .
 
   SERVICE wikibase:label {
 
   SERVICE wikibase:label {
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
Line 56: Line 56:
 
|}
 
|}
 
== Speaker name → Speaker Qid ==
 
== Speaker name → Speaker Qid ==
== Speaker Qid → Speaker data ==
+
== Speaker Qid ([[Q42]]) → Speaker data ==
 +
{|
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 +
<syntaxhighlight lang="sparql">
 +
</syntaxhighlight>
 +
||
 +
<query _pagination="5" speaker="Item" speakerLabel="Speaker" langLabel="Language">
 +
SELECT ?speaker ?speakerLabel
 +
WHERE {
 +
  entity:Q42 * ?speaker.
 +
  SERVICE wikibase:label {
 +
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
 +
  }
 +
}
 +
</query>
 +
|}
 +
<!--
 
== Speaker Qid → Speaker data → speaker languages ==
 
== Speaker Qid → Speaker data → speaker languages ==
 
== Speaker Qid + language → list of audios in target language ==
 
== Speaker Qid + language → list of audios in target language ==
Line 69: Line 86:
 
== Tools ==
 
== Tools ==
 
* [[Special:ApisSandbox]] – API queries generator for Lingualibre wikipage and wikibase contents.
 
* [[Special:ApisSandbox]] – API queries generator for Lingualibre wikipage and wikibase contents.
 +
-->

Revision as of 23:33, 4 December 2021

Base

✅ Is Sex or Gender(sex or gender (Q7)) → list all possible values

SELECT ?item ?itemLabel
WHERE {
  ?item prop:P2/prop:P9 * entity:Q7
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
  } 
}
... Loading ...

✅ Is Speaker (speaker (Q3)) → list all speakers

select ?speaker ?speakerLabel
where {
  ?speaker prop:P2 entity:Q3 .
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
  } 
}
... Loading ...

Speaker name → Speaker Qid

Speaker Qid (0x010C (Q42)) → Speaker data

... Loading ...