Project:SPARQL examples: Difference between revisions

From Inguma Wikibase
(Created page with "= SPARQL Queries = == Get direct download links (P48) and corresponding bibItems == <sparql tryit="1"> PREFIX iwb: <https://wikibase.inguma.eus/entity/> PREFIX idp: <https://wikibase.inguma.eus/prop/direct/> PREFIX ip: <https://wikibase.inguma.eus/prop/> PREFIX ips: <https://wikibase.inguma.eus/prop/statement/> PREFIX ipq: <https://wikibase.inguma.eus/prop/qualifier/> select distinct ?download (group_concat(str(?wikibase_item);SEPARATOR="|") as ?items) where { ?wiki...")
 
 
Line 14: Line 14:
   ?wikibase_item idp:P48 ?download .
   ?wikibase_item idp:P48 ?download .
  } group by ?download ?items
  } group by ?download ?items
</sparql>
== Filter certain BibItems ==
Example: items of publisher "Uztaro" with INGUMA domain indicator "Politics"
<sparql tryit="1">
PREFIX iwb: <https://wikibase.inguma.eus/entity/>
PREFIX idp: <https://wikibase.inguma.eus/prop/direct/>
PREFIX ip: <https://wikibase.inguma.eus/prop/>
PREFIX ips: <https://wikibase.inguma.eus/prop/statement/>
PREFIX ipq: <https://wikibase.inguma.eus/prop/qualifier/>
select ?wikibase_item (strafter(str(?wikibase_item),"https://wikibase.inguma.eus/entity/") as ?q_id)
where {
  ?wikibase_item idp:P5 iwb:Q8; # instance of: BibItem
                idp:P37 iwb:Q13091; # argitaratzailea: Uztaro
                idp:P59 iwb:Q13284. # INGUMA jakintza arloa: Politika
}
</sparql>
</sparql>

Latest revision as of 10:30, 2 October 2022

SPARQL Queries

Get direct download links (P48) and corresponding bibItems

PREFIX iwb: <https://wikibase.inguma.eus/entity/>
PREFIX idp: <https://wikibase.inguma.eus/prop/direct/>
PREFIX ip: <https://wikibase.inguma.eus/prop/>
PREFIX ips: <https://wikibase.inguma.eus/prop/statement/>
PREFIX ipq: <https://wikibase.inguma.eus/prop/qualifier/>

select distinct ?download (group_concat(str(?wikibase_item);SEPARATOR="|") as ?items)
where {
  ?wikibase_item idp:P48 ?download .
 } group by ?download ?items

Try it!


Filter certain BibItems

Example: items of publisher "Uztaro" with INGUMA domain indicator "Politics"

PREFIX iwb: <https://wikibase.inguma.eus/entity/>
PREFIX idp: <https://wikibase.inguma.eus/prop/direct/>
PREFIX ip: <https://wikibase.inguma.eus/prop/>
PREFIX ips: <https://wikibase.inguma.eus/prop/statement/>
PREFIX ipq: <https://wikibase.inguma.eus/prop/qualifier/>

select ?wikibase_item (strafter(str(?wikibase_item),"https://wikibase.inguma.eus/entity/") as ?q_id)
where {
  ?wikibase_item idp:P5 iwb:Q8; # instance of: BibItem
                 idp:P37 iwb:Q13091; # argitaratzailea: Uztaro
                 idp:P59 iwb:Q13284. # INGUMA jakintza arloa: Politika
 }

Try it!