A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/podcast-language_podcast-list.sparql
Podcast-language aspect: podcast list
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q7411>
SELECT ?podcast ?podcastLabel (CONCAT("/podcast/", SUBSTR(STR(?podcast), 32)) AS ?podcastUrl)
(GROUP_CONCAT(?genreWDLabel; separator=", ") AS ?genre)
WHERE {
?podcast wdt:P31 wd:Q24634210 ; wdt:P407 target: .
OPTIONAL {
?podcast wdt:P136 ?iri
BIND(SUBSTR(STR(?iri), 32) AS ?q)
?iri rdfs:label ?value_string .
FILTER (LANG(?value_string) = 'en')
BIND(COALESCE(?value_string, ?q) AS ?genreWDLabel)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?podcast ?podcastLabel
ORDER BY DESC(?podcastLabel)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?genre")
v6("?genreWDLabel"):::projected
v4("?iri")
v3("?podcast"):::projected
v1("?podcastLabel"):::projected
v7("?podcastUrl")
v5("?q")
v2("?value_string")
c9([http://www.bigdata.com/rdf#serviceParam]):::iri
c3([http://wikidata.org/entity/Q24634210]):::iri
c5(["wd:Q7411"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
v3 --"p:direct/P31"--> c3
v3 --"p:direct/P407"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P136".-> v4
bind0[/"substring(str(?iri),'32^^xsd:integer')"/]
v4 --o bind0
bind0 --as--o v5
v4 --"rdfs:label"--> v2
bind1[/"?value_string?q"/]
v2 --o bind1
v5 --o bind1
bind1 --as--o v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind3[/"concat('/podcast/',substring(str(?podcast),'32^^xsd:integer'))"/]
v3 --o bind3
bind3 --as--o v7
bind4[/"?genreWDLabel"/]
v6 --o bind4
bind4 --as--o v8