Sample queries: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Until we can update the Query Service to include our own sample queries, let's list those here...") |
No edit summary |
||
(37 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== 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. | |||
<pre> | |||
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) | |||
</pre> | |||
== First 100 Works (now more than 100) == | |||
Get a list of all of the works <br/> | |||
(as of 2019-11, that's exactly 100 works!) | |||
<pre> | |||
SELECT ?work ?workLabel (count(distinct ?edition) as ?editions) | |||
(min(?year) as ?earliestPublicationDate) | |||
(GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) | |||
(GROUP_CONCAT(distinct ?literaryFormLabel; SEPARATOR="; ") as ?format) | |||
WHERE | |||
{ | |||
?work wdt:P8 wd:Q4 . | |||
OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } | |||
OPTIONAL { ?work wdt:P11 ?literaryForm . ?literaryForm rdfs:label ?literaryFormLabel } | |||
OPTIONAL { ?edition wdt:P13 ?work . ?edition p:P29|p:P32 ?pubStatement } | |||
OPTIONAL { ?pubStatement pq:P31 ?date . | |||
BIND(str(YEAR(?date)) AS ?year) } | |||
?work rdfs:label ?workLabel . | |||
} | |||
group by ?work ?workLabel | |||
order by ?workLabel | |||
</pre> | |||
==Poems By Author in Aggregated Work== | |||
Return a network map of all poems by Gwendolyn Brooks that are included in an aggregated work. | |||
<pre> | |||
#title: Gwendolyn Brooks Poems | |||
#defaultView:Graph | |||
SELECT ?work ?workLabel ?aggworkLabel WHERE { | |||
?work wdt:P90 wd:Q1418; | |||
wdt:P118 ?aggwork. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} | |||
</pre> | |||
== Author Gallery == | |||
Return a list of everyone in the BBP listed as an author, as long as they also have a picture in Wikimedia commons, and sort the results by the total number of works listed. | |||
<pre> | |||
PREFIX wd_1: <http://www.wikidata.org/entity/> | |||
PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> | |||
SELECT distinct ?person ?personLabel ?pic (COUNT(distinct ?work) as ?workCount) | |||
WHERE | |||
{ | |||
?person wdt:P8 wd:Q3 . | |||
?person rdfs:label ?personLabel . | |||
?person wdt:P107 ?wid . | |||
?person ^wdt:P90 ?work . | |||
BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?wikidataURI ) | |||
SERVICE <https://query.wikidata.org/sparql> { | |||
?wikidataURI wdt_1:P18 ?pic . | |||
} | |||
} | |||
group by ?person ?personLabel ?pic | |||
order by desc(?workCount) | |||
</pre> | |||
== Birthplaces == | |||
Map the birth places for everyone listed in the BBP, using coordinate data from Wikidata | |||
<pre> | |||
PREFIX wd_1: <http://www.wikidata.org/entity/> | |||
PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> | |||
SELECT distinct ?person ?personLabel ?pob ?pobLabel ?coords | |||
WITH { | |||
SELECT ?person WHERE { | |||
?item wdt:P8 wd:Q3 . | |||
?item wdt:P107 ?wid . | |||
BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?person ) | |||
} | |||
} AS %people | |||
WHERE { | |||
include %people | |||
SERVICE <https://query.wikidata.org/sparql> { | |||
?person wdt_1:P19 ?pob . | |||
?pob wdt_1:P625 ?coords . | |||
?person rdfs:label ?personLabel . | |||
FILTER((LANG(?personLabel)) = "en") | |||
?pob rdfs:label ?pobLabel . | |||
FILTER((LANG(?pobLabel)) = "en") | |||
} | |||
} | |||
</pre> | |||
== Authors with works in a Serial == | |||
<pre> | |||
#Authors with works that appeared in the Journal of Black Poetry | |||
SELECT ?author ?authorLabel ?issue ?issueLabel | |||
WHERE { | |||
?work wdt:P90 ?author ; #work has author | |||
wdt:P118 ?issue . #work appears in issue | |||
?issue wdt:P111 wd:Q2261 . #issue is issue of JBP | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | |||
} | |||
</pre> | |||
== Narrative Publication Overview == | |||
<pre> | |||
prefix wd_1: <http://www.wikidata.org/entity/> | |||
prefix wdt_1: <http://www.wikidata.org/prop/direct/> | |||
select ?work ?edition ?publisher (year(?date) as ?publicationYear) (count(*) as ?editionsPublishedAtThisLocation) ?coords { | |||
?work wdt:P11 wd:Q28 . | |||
?edition wdt:P13 ?work ; wdt:P29 ?publisher . | |||
?edition ?has ?pubStmt . | |||
?pubStmt ps:P29 ?publisher ; pq:P30 ?place ; pq:P31 ?date . | |||
?place wdt:P107 ?wid . | |||
?publisher rdfs:label ?pubLabel . | |||
?place rdfs:label ?placeLabel . | |||
BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?placeMatch ) | |||
SERVICE <https://query.wikidata.org/sparql> { | |||
?placeMatch wdt_1:P625 ?coords . | |||
} | |||
} | |||
group by ?work ?edition ?publisher ?date ?coords ?pubLabel ?placeLabel | |||
</pre> | |||
== Edition count by year and genre == | |||
<pre> | |||
SELECT ?year (COUNT(?_genreLabel) AS ?count ) (SAMPLE(?_genreLabel) AS ?genreLabel ) WHERE { | |||
?edition wdt:P8 wd:Q7 . | |||
?edition p:P29 ?pubStatement . | |||
?pubStatement pq:P31 ?date . | |||
BIND(str(YEAR(?date)) AS ?year) | |||
?edition wdt:P13 ?work . | |||
?work wdt:P11 ?literaryForm . | |||
?literaryForm rdfs:label ?_genreLabel | |||
} | |||
GROUP BY ?_genreLabel ?year | |||
ORDER BY ?year | |||
</pre> | |||
== Page counts, down the line == | |||
<pre> | |||
# List of stuff numbered by pages, in order | |||
# look at Table view…. and at Line view. What’s different? Why? | |||
#defaultView:LineChart | |||
SELECT ?item ?itemLabel ?pages | |||
WHERE | |||
{ | |||
?item ?b ?statement. | |||
?statement pq:P34 ?pages. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | |||
} | |||
ORDER BY desc(?pages) | |||
</pre> | |||
== Illustration Overview == | |||
<pre> | |||
# How many and which titles are illustrated? | |||
# Works that have editions that are marked as illustrated. | |||
SELECT ?workLabel (GROUP_CONCAT(distinct ?illLabel; SEPARATOR="; ") as ?illustrationLabel) | |||
(GROUP_CONCAT(distinct ?x; SEPARATOR="; ") as ?illustrationOverview) | |||
(GROUP_CONCAT(distinct ?illustratorLabel; SEPARATOR="; ") as ?illustrator) | |||
(count(distinct ?edition) as ?editionCount) | |||
(GROUP_CONCAT(distinct ?editionLabel; SEPARATOR="; ") as ?editions) | |||
(GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) | |||
(min(?year) as ?earliestPublicationDate) | |||
WHERE { | |||
?edition wdt:P35 ?illustration ; wdt:P13 ?work ; rdfs:label ?editionLabel . | |||
?illustration rdfs:label ?illLabel . | |||
?work rdfs:label ?workLabel . | |||
OPTIONAL { ?edition p:P35 ?statement . ?statement pq:P64|pq:P28 ?x .} | |||
OPTIONAL { ?edition wdt:P79 ?illustrator . ?illustrator rdfs:label ?illustratorLabel } | |||
OPTIONAL { ?edition p:P29|p:P32 ?pubStatement . ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) } | |||
OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } | |||
} | |||
group by ?workLabel | |||
order by ?workLabel | |||
</pre> | |||
== Just the Frontispieces == | |||
<pre> | |||
# Just the Frontispieces | |||
# How many titles have frontispieces? | |||
SELECT ?workLabel ?frontispieceLabel | |||
(GROUP_CONCAT(distinct ?note; SEPARATOR="; ") as ?frontispieceNote) | |||
(count(distinct ?edition) as ?editionCount) | |||
(GROUP_CONCAT(distinct ?editionLabel; SEPARATOR="; ") as ?editions) | |||
(GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) | |||
(min(?year) as ?earliestPublicationDate) | |||
WHERE { | |||
?edition wdt:P35 wd:Q35 ; wdt:P13 ?work ; rdfs:label ?editionLabel . | |||
wd:Q35 rdfs:label ?frontispieceLabel . | |||
?work rdfs:label ?workLabel . | |||
OPTIONAL { ?edition p:P35 ?statement . ?statement pq:P64 ?note .} | |||
OPTIONAL { ?edition p:P29|p:P32 ?pubStatement . ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) } | |||
OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } | |||
} | |||
group by ?workLabel ?frontispieceLabel | |||
order by ?workLabel | |||
</pre> | |||
== Andrews List, mapped out == | |||
<pre> | |||
PREFIX wd_1: <http://www.wikidata.org/entity/> | |||
PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> | |||
SELECT * WHERE { | |||
?edition wdt:P13 ?work ; | |||
wdt:P121 wd:Q1176 ; | |||
wdt:P29 ?publisher ; | |||
?has ?pubStmt . | |||
?pubStmt ps:P29 ?publisher ; pq:P30 ?place . | |||
?place wdt:P107 ?wid . | |||
?publisher rdfs:label ?pubLabel . | |||
?place rdfs:label ?placeLabel . | |||
BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?placeMatch ) | |||
SERVICE <https://query.wikidata.org/sparql> { | |||
?placeMatch wdt_1:P625 ?coords . | |||
} | |||
} | |||
</pre> | |||
[http://172.17.10.220:8834/#%23defaultView%3AMap%0APREFIX%20wd_1%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt_1%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0A%0ASELECT%20%2a%20WHERE%20%7B%0A%20%3Fedition%20wdt%3AP13%20%3Fwork%20%3B%0A%20%20%20%20wdt%3AP121%20wd%3AQ1176%20%3B%0A%20%20%20%20wdt%3AP29%20%3Fpublisher%20%3B%0A%20%20%20%20%3Fhas%20%3FpubStmt%20.%0A%20%3FpubStmt%20ps%3AP29%20%3Fpublisher%20%3B%20pq%3AP30%20%3Fplace%20.%0A%20%3Fplace%20wdt%3AP107%20%3Fwid%20.%0A%20%3Fpublisher%20rdfs%3Alabel%20%3FpubLabel%20.%0A%20%3Fplace%20rdfs%3Alabel%20%3FplaceLabel%20.%0A%20%20BIND%28IRI%28CONCAT%28%27http%3A%2F%2Fwww.wikidata.org%2Fentity%2F%27%2C%20%3Fwid%29%29%20AS%20%3FplaceMatch%20%29%0A%20%20%0A%20%20SERVICE%20%3Chttps%3A%2F%2Fquery.wikidata.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3FplaceMatch%20wdt_1%3AP625%20%3Fcoords%20.%0A%20%20%20%20%7D%0A%7D Try it out!] | |||
== Copyright Data == | |||
<pre> | |||
# How many editions have copyright statements? | |||
# How many of those statements are qualified by rights holder? | |||
# How many of those rights holders were also the author of the work? | |||
SELECT | |||
?editionCount | |||
?copyrightedEditionCount | |||
?rightsHolderCount | |||
(xsd:float(?copyrightedEditionCount)/xsd:float(?editionCount) AS ?percentCopyrighted) | |||
(xsd:float(?rightsHolderCount)/xsd:float(?copyrightedEditionCount) AS ?percentWithRightsHolder) | |||
(xsd:float(?authorAsRightsHolderCount)/xsd:float(?rightsHolderCount) AS ?percentWithRightsHolderCopyrightedByAuthor) | |||
WHERE { | |||
{ | |||
SELECT (COUNT(?editionType) AS ?editionCount) WHERE { | |||
?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work . | |||
BIND(bbpq:Q7 AS ?editionType) | |||
} GROUP BY ?editionType | |||
} | |||
{ | |||
SELECT ?editionType (COUNT(?editionType) AS ?copyrightedEditionCount) WHERE { | |||
?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . | |||
?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . | |||
BIND(bbpq:Q7 AS ?editionType) | |||
} GROUP BY ?editionType | |||
} | |||
{ | |||
SELECT ?editionType (COUNT(?editionType) AS ?rightsHolderCount) WHERE { | |||
?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . | |||
?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . | |||
?copyRightStmt bbppq:P20 ?rightsHolder . | |||
BIND(bbpq:Q7 AS ?editionType) | |||
#FILTER(?author = ?rightsHolder) | |||
} GROUP BY ?editionType | |||
} | |||
{ | |||
SELECT ?editionType (COUNT(?editionType) AS ?authorAsRightsHolderCount) WHERE { | |||
?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . | |||
?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . | |||
?copyRightStmt bbppq:P20 ?rightsHolder . | |||
BIND(bbpq:Q7 AS ?editionType) | |||
FILTER(?author = ?rightsHolder) | |||
} GROUP BY ?editionType | |||
} | |||
} | |||
</pre> |
Latest revision as of 18:52, 28 May 2024
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)
First 100 Works (now more than 100)
Get a list of all of the works
(as of 2019-11, that's exactly 100 works!)
SELECT ?work ?workLabel (count(distinct ?edition) as ?editions) (min(?year) as ?earliestPublicationDate) (GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) (GROUP_CONCAT(distinct ?literaryFormLabel; SEPARATOR="; ") as ?format) WHERE { ?work wdt:P8 wd:Q4 . OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } OPTIONAL { ?work wdt:P11 ?literaryForm . ?literaryForm rdfs:label ?literaryFormLabel } OPTIONAL { ?edition wdt:P13 ?work . ?edition p:P29|p:P32 ?pubStatement } OPTIONAL { ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) } ?work rdfs:label ?workLabel . } group by ?work ?workLabel order by ?workLabel
Poems By Author in Aggregated Work
Return a network map of all poems by Gwendolyn Brooks that are included in an aggregated work.
#title: Gwendolyn Brooks Poems #defaultView:Graph SELECT ?work ?workLabel ?aggworkLabel WHERE { ?work wdt:P90 wd:Q1418; wdt:P118 ?aggwork. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Author Gallery
Return a list of everyone in the BBP listed as an author, as long as they also have a picture in Wikimedia commons, and sort the results by the total number of works listed.
PREFIX wd_1: <http://www.wikidata.org/entity/> PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> SELECT distinct ?person ?personLabel ?pic (COUNT(distinct ?work) as ?workCount) WHERE { ?person wdt:P8 wd:Q3 . ?person rdfs:label ?personLabel . ?person wdt:P107 ?wid . ?person ^wdt:P90 ?work . BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?wikidataURI ) SERVICE <https://query.wikidata.org/sparql> { ?wikidataURI wdt_1:P18 ?pic . } } group by ?person ?personLabel ?pic order by desc(?workCount)
Birthplaces
Map the birth places for everyone listed in the BBP, using coordinate data from Wikidata
PREFIX wd_1: <http://www.wikidata.org/entity/> PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> SELECT distinct ?person ?personLabel ?pob ?pobLabel ?coords WITH { SELECT ?person WHERE { ?item wdt:P8 wd:Q3 . ?item wdt:P107 ?wid . BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?person ) } } AS %people WHERE { include %people SERVICE <https://query.wikidata.org/sparql> { ?person wdt_1:P19 ?pob . ?pob wdt_1:P625 ?coords . ?person rdfs:label ?personLabel . FILTER((LANG(?personLabel)) = "en") ?pob rdfs:label ?pobLabel . FILTER((LANG(?pobLabel)) = "en") } }
Authors with works in a Serial
#Authors with works that appeared in the Journal of Black Poetry SELECT ?author ?authorLabel ?issue ?issueLabel WHERE { ?work wdt:P90 ?author ; #work has author wdt:P118 ?issue . #work appears in issue ?issue wdt:P111 wd:Q2261 . #issue is issue of JBP SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Narrative Publication Overview
prefix wd_1: <http://www.wikidata.org/entity/> prefix wdt_1: <http://www.wikidata.org/prop/direct/> select ?work ?edition ?publisher (year(?date) as ?publicationYear) (count(*) as ?editionsPublishedAtThisLocation) ?coords { ?work wdt:P11 wd:Q28 . ?edition wdt:P13 ?work ; wdt:P29 ?publisher . ?edition ?has ?pubStmt . ?pubStmt ps:P29 ?publisher ; pq:P30 ?place ; pq:P31 ?date . ?place wdt:P107 ?wid . ?publisher rdfs:label ?pubLabel . ?place rdfs:label ?placeLabel . BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?placeMatch ) SERVICE <https://query.wikidata.org/sparql> { ?placeMatch wdt_1:P625 ?coords . } } group by ?work ?edition ?publisher ?date ?coords ?pubLabel ?placeLabel
Edition count by year and genre
SELECT ?year (COUNT(?_genreLabel) AS ?count ) (SAMPLE(?_genreLabel) AS ?genreLabel ) WHERE { ?edition wdt:P8 wd:Q7 . ?edition p:P29 ?pubStatement . ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) ?edition wdt:P13 ?work . ?work wdt:P11 ?literaryForm . ?literaryForm rdfs:label ?_genreLabel } GROUP BY ?_genreLabel ?year ORDER BY ?year
Page counts, down the line
# List of stuff numbered by pages, in order # look at Table view…. and at Line view. What’s different? Why? #defaultView:LineChart SELECT ?item ?itemLabel ?pages WHERE { ?item ?b ?statement. ?statement pq:P34 ?pages. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY desc(?pages)
Illustration Overview
# How many and which titles are illustrated? # Works that have editions that are marked as illustrated. SELECT ?workLabel (GROUP_CONCAT(distinct ?illLabel; SEPARATOR="; ") as ?illustrationLabel) (GROUP_CONCAT(distinct ?x; SEPARATOR="; ") as ?illustrationOverview) (GROUP_CONCAT(distinct ?illustratorLabel; SEPARATOR="; ") as ?illustrator) (count(distinct ?edition) as ?editionCount) (GROUP_CONCAT(distinct ?editionLabel; SEPARATOR="; ") as ?editions) (GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) (min(?year) as ?earliestPublicationDate) WHERE { ?edition wdt:P35 ?illustration ; wdt:P13 ?work ; rdfs:label ?editionLabel . ?illustration rdfs:label ?illLabel . ?work rdfs:label ?workLabel . OPTIONAL { ?edition p:P35 ?statement . ?statement pq:P64|pq:P28 ?x .} OPTIONAL { ?edition wdt:P79 ?illustrator . ?illustrator rdfs:label ?illustratorLabel } OPTIONAL { ?edition p:P29|p:P32 ?pubStatement . ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) } OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } } group by ?workLabel order by ?workLabel
Just the Frontispieces
# Just the Frontispieces # How many titles have frontispieces? SELECT ?workLabel ?frontispieceLabel (GROUP_CONCAT(distinct ?note; SEPARATOR="; ") as ?frontispieceNote) (count(distinct ?edition) as ?editionCount) (GROUP_CONCAT(distinct ?editionLabel; SEPARATOR="; ") as ?editions) (GROUP_CONCAT(distinct ?authorLabel; SEPARATOR="; ") as ?authors) (min(?year) as ?earliestPublicationDate) WHERE { ?edition wdt:P35 wd:Q35 ; wdt:P13 ?work ; rdfs:label ?editionLabel . wd:Q35 rdfs:label ?frontispieceLabel . ?work rdfs:label ?workLabel . OPTIONAL { ?edition p:P35 ?statement . ?statement pq:P64 ?note .} OPTIONAL { ?edition p:P29|p:P32 ?pubStatement . ?pubStatement pq:P31 ?date . BIND(str(YEAR(?date)) AS ?year) } OPTIONAL { ?work wdt:P90 ?author . ?author rdfs:label ?authorLabel } } group by ?workLabel ?frontispieceLabel order by ?workLabel
Andrews List, mapped out
PREFIX wd_1: <http://www.wikidata.org/entity/> PREFIX wdt_1: <http://www.wikidata.org/prop/direct/> SELECT * WHERE { ?edition wdt:P13 ?work ; wdt:P121 wd:Q1176 ; wdt:P29 ?publisher ; ?has ?pubStmt . ?pubStmt ps:P29 ?publisher ; pq:P30 ?place . ?place wdt:P107 ?wid . ?publisher rdfs:label ?pubLabel . ?place rdfs:label ?placeLabel . BIND(IRI(CONCAT('http://www.wikidata.org/entity/', ?wid)) AS ?placeMatch ) SERVICE <https://query.wikidata.org/sparql> { ?placeMatch wdt_1:P625 ?coords . } }
Copyright Data
# How many editions have copyright statements? # How many of those statements are qualified by rights holder? # How many of those rights holders were also the author of the work? SELECT ?editionCount ?copyrightedEditionCount ?rightsHolderCount (xsd:float(?copyrightedEditionCount)/xsd:float(?editionCount) AS ?percentCopyrighted) (xsd:float(?rightsHolderCount)/xsd:float(?copyrightedEditionCount) AS ?percentWithRightsHolder) (xsd:float(?authorAsRightsHolderCount)/xsd:float(?rightsHolderCount) AS ?percentWithRightsHolderCopyrightedByAuthor) WHERE { { SELECT (COUNT(?editionType) AS ?editionCount) WHERE { ?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work . BIND(bbpq:Q7 AS ?editionType) } GROUP BY ?editionType } { SELECT ?editionType (COUNT(?editionType) AS ?copyrightedEditionCount) WHERE { ?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . ?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . BIND(bbpq:Q7 AS ?editionType) } GROUP BY ?editionType } { SELECT ?editionType (COUNT(?editionType) AS ?rightsHolderCount) WHERE { ?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . ?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . ?copyRightStmt bbppq:P20 ?rightsHolder . BIND(bbpq:Q7 AS ?editionType) #FILTER(?author = ?rightsHolder) } GROUP BY ?editionType } { SELECT ?editionType (COUNT(?editionType) AS ?authorAsRightsHolderCount) WHERE { ?work bbppd:P8 bbpq:Q4 ; bbppd:P90 ?author . ?edition bbppd:P8 bbpq:Q7 ; bbppd:P13 ?work ; bbpp:P19 ?copyRightStmt . ?copyRightStmt bbppq:P20 ?rightsHolder . BIND(bbpq:Q7 AS ?editionType) FILTER(?author = ?rightsHolder) } GROUP BY ?editionType } }