Sample queries: Difference between revisions

From Black Bibliography Project
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:




== Sample queries ==
= Sample queries =
 
== Instance count ==
To get an overview of what's in the BBP, the following query will return a count of all of the different instances, such as works, people, and places.


==== To get an overview of what's in the BBP, the following query will return a count of all of the different instances, such as works, people, and places. ====
<pre>
<pre>
SELECT ?typeLabel (count(distinct ?x) as ?count)
SELECT ?typeLabel (count(distinct ?x) as ?count)

Revision as of 20:32, 10 November 2019

Until we can update the Query Service to include our own sample queries, let's list those here...


Sample queries

Instance count

To get an overview of what's in the BBP, the following query will return a count of all of the different instances, such as works, people, and places.

SELECT ?typeLabel (count(distinct ?x) as ?count)
WHERE
{
  ?x wdt:P8 ?type .
  ?type rdfs:label ?typeLabel.
  FILTER((LANG(?typeLabel)) = "en")
}
group by ?type ?typeLabel
order by desc(?count)

Try it out!