Help

Difference between revisions of "SPARQL"

Line 7: Line 7:
  
 
== ✅ Property Gender(Q7) → list all possible values ==
 
== ✅ Property Gender(Q7) → list all possible values ==
 +
{|
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 
<syntaxhighlight lang="sparql">
 
<syntaxhighlight lang="sparql">
 
SELECT ?item ?itemLabel
 
SELECT ?item ?itemLabel
Line 16: Line 19:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
|
<br>
 
 
<query _pagination="5" item="Property" itemLabel="Values">
 
<query _pagination="5" item="Property" itemLabel="Values">
 
SELECT ?item ?itemLabel
 
SELECT ?item ?itemLabel
 
WHERE {
 
WHERE {
   ?item prop:P2* entity:Q7
+
   ?item prop:P2/prop:P9 * entity:Q7
 
   SERVICE wikibase:label {
 
   SERVICE wikibase:label {
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
 
     bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
Line 27: Line 29:
 
}
 
}
 
</query>
 
</query>
 
+
|}
 
== ✅ Query → list all speakers ==
 
== ✅ Query → list all speakers ==
 +
{|
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 
<syntaxhighlight lang="sparql">
 
<syntaxhighlight lang="sparql">
 
select ?locutor ?locutorLabel
 
select ?locutor ?locutorLabel
Line 38: Line 43:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
||
<br>
 
 
<query _pagination="5" locutor="Item" locutorLabel="Speaker" langLabel="Language">
 
<query _pagination="5" locutor="Item" locutorLabel="Speaker" langLabel="Language">
 
select ?locutor ?locutorLabel
 
select ?locutor ?locutorLabel
Line 49: Line 53:
 
}
 
}
 
</query>
 
</query>
<!--
+
|}<!--
 
== Speaker name → Speaker Qid ==
 
== Speaker name → Speaker Qid ==
 
== Speaker Qid → Speaker data ==
 
== Speaker Qid → Speaker data ==

Revision as of 23:44, 3 December 2021

Base

✅ Property Gender(Q7) → list all possible values

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

✅ Query → list all speakers

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