aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-07-31 14:06:03 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-07-31 14:06:03 -0700
commit232cdfed7ee174e105719918acbd5a29dfe73933 (patch)
tree8617c90b8e56adfde0beae67b48433e721a88708
parent9b7d05a87b72989449d5e4b4b5d4cc4f808c2703 (diff)
downloadfatcat-x-attic-chocula.tar.gz
fatcat-x-attic-chocula.zip
add wikidata SPARQL queryx-attic-chocula
-rw-r--r--extra/journal_metadata/wikidata.sparql35
1 files changed, 35 insertions, 0 deletions
diff --git a/extra/journal_metadata/wikidata.sparql b/extra/journal_metadata/wikidata.sparql
new file mode 100644
index 00000000..3f7e2f92
--- /dev/null
+++ b/extra/journal_metadata/wikidata.sparql
@@ -0,0 +1,35 @@
+# this query fetches basic metadata for about 45k journal from wikidata
+# run at: https://query.wikidata.org/
+#
+# NOTE: the publisher label somtimes falls through to a QID or "t"-prefixed
+# number if the publisher name isn't actually known
+
+# would rather have direct QID instead of URL, but this seems to slow things down too much (query times out)
+#SELECT (REPLACE(STR(?item),".*Q","Q") AS ?wikidata_qid) (SAMPLE(?issn) AS ?issn) (SAMPLE(?title) AS ?title) (SAMPLE(?publisherLabel) AS ?publisher_name) (SAMPLE(?websiteurl) AS ?websiteurl) (str(YEAR(SAMPLE(?inception))) AS ?start_year)
+
+SELECT ?item (SAMPLE(?issn) AS ?issn) (SAMPLE(?title) AS ?title) (SAMPLE(?publisherLabel) AS ?publisher_name) (SAMPLE(?websiteurl) AS ?websiteurl) (str(YEAR(SAMPLE(?inception))) AS ?start_year)
+WHERE
+{
+ # any instance of...
+ { ?item wdt:P31 wd:Q5633421 } # "scientific journal"
+ UNION { ?item wdt:P31 wd:Q773668 } # "open access journal"
+ UNION { ?item wdt:P31 wd:Q737498 } # "academic journal"
+ UNION { ?item wdt:P31 wd:Q49850 } # "journal"
+ UNION { ?item wdt:P31 wd:Q51135530 } # "humanities journal"
+
+ # must have an ISSN
+ ?item wdt:P1476 ?title
+
+ # may have title, website, publisher, inception date
+ OPTIONAL{?item wdt:P236 ?issn}
+ OPTIONAL{?item wdt:P856 ?websiteurl}
+ OPTIONAL{?item wdt:P123 ?publisher}
+ OPTIONAL{?item wdt:P571 ?inception}
+
+ # "label service" to turn publisher entity into name
+ SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,es,de,fr,ja".
+ ?publisher rdfs:label ?publisherLabel. }
+} GROUP BY ?item
+
+# could include all known ISSNs instead of just one with:
+# (GROUP_CONCAT(DISTINCT ?issn; SEPARATOR=";") AS ?issns)