query-fbe1e83c8ff54362bfb5ffb65b8fb1f2
Records of the Auckland Museum
SELECT DISTINCT (YEAR(?date) AS ?year) ?journalLabel ?article ?titleLabel (GROUP_CONCAT (DISTINCT ?authorlabel; separator="; ") AS ?authors) ?metadata ?JSTOR ?DOI WHERE { # Get JSTOR URL format wd:P888 wdt:P1630 ?JSTORformat .
#Get DOI URL format wd:P356 wdt:P1630 ?DOIformat .
# Get articles "P14333" (published in) "Q15756170" (Records of the Auckland Museum) VALUES ?journal { wd:Q15756170 wd:Q15214730 } ?article wdt:P1433 ?journal .
OPTIONAL { ?article wdt:P1476 ?title. }
OPTIONAL { ?article wdt:P50 ?author. ?author rdfs:label ?authorlabel . FILTER(LANG(?authorlabel)='en') }
OPTIONAL { ?article wdt:P577 ?date. }
OPTIONAL { ?article wdt:P478 ?vol. }
OPTIONAL { ?article wdt:P304 ?pp. }
OPTIONAL { ?article wdt:P888 ?JSTOR_ID. }
OPTIONAL { ?article wdt:P356 ?rawDOI. }
# Combine vol & page numbers with pub. date BIND(CONCAT("Vol. ", ?vol, "; pp. ", ?pp, ". Published ", SUBSTR(CONCAT('0',STR(DAY(?date))),STRLEN(STR(DAY(?date)))-1), "/", SUBSTR(CONCAT('0',STR(MONTH(?date))),STRLEN(STR(MONTH(?date)))-1), "/", STR(YEAR(?date)), ".") AS ?metadata )
# Create JSTOR links BIND(IRI(REPLACE(?JSTOR_ID, "^(.+)$", ?JSTORformat)) AS ?JSTOR)
# Create DOI links BIND(IRI(REPLACE(?rawDOI, "^(.+)$", ?DOIformat)) AS ?DOI)
# Get English labels SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
GROUP BY ?date ?journalLabel ?article ?titleLabel ?metadata ?JSTOR ?DOI ORDER BY ?year
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Records of the Auckland Museum
SELECT DISTINCT (YEAR(?date) AS ?year) ?journalLabel ?article ?titleLabel
(GROUP_CONCAT (DISTINCT ?authorlabel; separator="; ") AS ?authors)
?metadata ?JSTOR ?DOI
WHERE {
# Get JSTOR URL format
wd:P888 wdt:P1630 ?JSTORformat .
#Get DOI URL format
wd:P356 wdt:P1630 ?DOIformat .
# Get articles "P14333" (published in) "Q15756170" (Records of the Auckland Museum)
VALUES ?journal { wd:Q15756170 wd:Q15214730 }
?article wdt:P1433 ?journal .
OPTIONAL { ?article wdt:P1476 ?title. }
OPTIONAL { ?article wdt:P50 ?author. ?author rdfs:label ?authorlabel . FILTER(LANG(?authorlabel)='en') }
OPTIONAL { ?article wdt:P577 ?date. }
OPTIONAL { ?article wdt:P478 ?vol. }
OPTIONAL { ?article wdt:P304 ?pp. }
OPTIONAL { ?article wdt:P888 ?JSTOR_ID. }
OPTIONAL { ?article wdt:P356 ?rawDOI. }
# Combine vol & page numbers with pub. date
BIND(CONCAT("Vol. ", ?vol, "; pp. ", ?pp, ". Published ", SUBSTR(CONCAT('0',STR(DAY(?date))),STRLEN(STR(DAY(?date)))-1), "/", SUBSTR(CONCAT('0',STR(MONTH(?date))),STRLEN(STR(MONTH(?date)))-1), "/", STR(YEAR(?date)), ".")
AS ?metadata )
# Create JSTOR links
BIND(IRI(REPLACE(?JSTOR_ID, "^(.+)$", ?JSTORformat)) AS ?JSTOR)
# Create DOI links
BIND(IRI(REPLACE(?rawDOI, "^(.+)$", ?DOIformat)) AS ?DOI)
# Get English labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?date ?journalLabel ?article ?titleLabel ?metadata ?JSTOR ?DOI
ORDER BY ?year