Help

Difference between revisions of "SPARQL"

Line 56: Line 56:
 
|}
 
|}
 
== Speaker name → Speaker Qid ==
 
== Speaker name → Speaker Qid ==
 +
 +
{|
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 +
<syntaxhighlight lang="sparql">
 +
select ?speakerName ?speakerId
 +
where {
 +
  VALUES ?speakerName { "Yug" "VIGNERON" } #One or multiple values are acceptable here
 +
  BIND ( STRLANG(?speakerName, "en") AS ?speakerLabel )
 +
  ?speakerId prop:P2 entity:Q3 ; rdfs:label ?speakerLabel .
 +
}
 +
</syntaxhighlight>
 +
||
 +
 +
<query _pagination="5">
 +
select ?speakerName ?speakerId
 +
where {
 +
  VALUES ?speakerName { "Yug" "VIGNERON" } #One or multiple values are acceptable here
 +
  BIND ( STRLANG(?speakerName, "en") AS ?speakerLabel )
 +
  ?speakerId prop:P2 entity:Q3 ; rdfs:label ?speakerLabel .
 +
}
 +
</query>
 +
|}
 +
 
== Speaker Qid ([[Q42]]) → Speaker data ==
 
== Speaker Qid ([[Q42]]) → Speaker data ==
 
{|  
 
{|  

Revision as of 17:42, 5 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

select ?speakerName ?speakerId
where {
  VALUES ?speakerName { "Yug" "VIGNERON" } #One or multiple values are acceptable here
  BIND ( STRLANG(?speakerName, "en") AS ?speakerLabel )
  ?speakerId prop:P2 entity:Q3 ; rdfs:label ?speakerLabel .
}
... Loading ...

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

... Loading ...