query-fbe1e83c8ff54362bfb5ffb65b8fb1f2

rq turtle/ttl

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

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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v16("?DOI"):::projected v4("?DOIformat") v15("?JSTOR"):::projected v12("?JSTOR_ID") v3("?JSTORformat") v6("?article"):::projected v8("?author") v2("?authorlabel"):::projected v17("?authors") v9("?date"):::projected v5("?journal") v14("?metadata"):::projected v11("?pp") v13("?rawDOI") v7("?title") v10("?vol") v17("?year") c4(["wd:P356"]):::iri c15(["bd:serviceParam"]):::iri c2(["wd:P888"]):::iri c17(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2 --"wdt:P1630"--> v3 c4 --"wdt:P1630"--> v4 bind0[/VALUES ?journal/] bind0-->v5 bind00(["wd:Q15756170"]) bind00 --> bind0 bind01(["wd:Q15214730"]) bind01 --> bind0 v6 --"wdt:P1433"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P1476".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P50".-> v8 v8 --"rdfs:label"--> v2 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P577".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P478".-> v10 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P304".-> v11 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P888".-> v12 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P356".-> v13 end bind1[/"concat('Vol. ',?vol,'; pp. ',?pp,'. Published ',substring(concat('0',str(day-from-dateTime(?date))),string-length(str(day-from-dateTime(?date))) + '-1^^xsd:integer'),'/',substring(concat('0',str(month-from-dateTime(?date))),string-length(str(month-from-dateTime(?date))) + '-1^^xsd:integer'),'/',str(year-from-dateTime(?date)),'.')"/] v10 --o bind1 v11 --o bind1 v9 --o bind1 bind1 --as--o v14 bind2[/"replace(?JSTOR_ID,'^(.+)$',?JSTORformat)"/] v12 --o bind2 v3 --o bind2 bind2 --as--o v15 bind3[/"replace(?rawDOI,'^(.+)$',?DOIformat)"/] v13 --o bind3 v4 --o bind3 bind3 --as--o v16 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c17 end bind5[/"year-from-dateTime(?date)"/] v9 --o bind5 bind5 --as--o v17 bind6[/"?authorlabel"/] v2 --o bind6 bind6 --as--o v17