From fd62aee6e41043aa26f0e96d9094efa7afc5ec27 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 5 Feb 2018 09:41:36 -0500 Subject: [PATCH] WIP - hardcoded WP snippet Signed-off-by: Dan Scott --- .../web/js/ui/default/opac/wikidata_music_card.js | 26 +- test_wikidata.html | 331 +++++++++++++++++++++ 2 files changed, 352 insertions(+), 5 deletions(-) create mode 100644 test_wikidata.html diff --git a/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js b/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js index a87e60d9b0..40d7e73e5a 100644 --- a/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js +++ b/Open-ILS/web/js/ui/default/opac/wikidata_music_card.js @@ -83,14 +83,12 @@ function findPerformer(icon_node, entity_name) { var url = 'https://query.wikidata.org/sparql'; var query = 'SELECT DISTINCT ?item ?itemLabel ?itemDescription ?image ?birthPlace ?birthPlaceLabel ' + - '?website ?musicbrainz ?songKick ?twitter ?facebook ' + + '?website ?musicbrainz ?songKick ?twitter ?facebook ?wplink ' + 'WHERE { ' + '?item rdfs:label|skos:altLabel|wdt:P1449 "' + entity_name + '"@en . ' + - '{ ?item wdt:P31 wd:Q215380 . } ' + // band + '{ ?item wdt:P31/wdt:P279* wd:Q215380 . } ' + // band 'UNION ' + - '{ ?item wdt:P31 wd:Q5741069 . } ' + // rock band - 'UNION ' + - '{ ?item wdt:P106/wdt:P279* wd:Q639669 . } ' + + '{ ?item wdt:P106/wdt:P279* wd:Q639669 . } ' + // musician 'OPTIONAL { ?item wdt:P3478 ?songKick } . ' + 'OPTIONAL { ?item wdt:P19 ?birthPlace } . ' + 'OPTIONAL { ?item wdt:P856 ?website } . ' + @@ -98,6 +96,11 @@ 'OPTIONAL { ?item wdt:P2002 ?twitter } . ' + 'OPTIONAL { ?item wdt:P2013 ?facebook } . ' + 'OPTIONAL { ?item wdt:P18 ?image } . ' + + 'OPTIONAL { ' + + '?wplink schema:about ?item . ' + + '?wplink schema:inLanguage "en" . ' + + '?wplink schema:isPartOf . ' + + '} ' + 'SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } ' + '} ' + 'LIMIT 10'; @@ -157,6 +160,19 @@ musician.appendChild(wdd); } + if (r.hasOwnProperty('wplink')) { + var wplink = r.wplink.value; + // Strip the WP title from the link + // https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&explaintext=true&exintro=true&titles=CANO + var description = ''; // extract text from wplink + var wdd = document.createElement('div'); + var wddl = document.createElement('label'); + wddl.innerText = description; + wdd.appendChild(wddl); + musician.appendChild(wdd); + } + + function addWDValue(property, propertyLabel, label, isLink, linkFormatter) { var value = ''; if (r.hasOwnProperty(property)) { diff --git a/test_wikidata.html b/test_wikidata.html new file mode 100644 index 0000000000..3383a22d58 --- /dev/null +++ b/test_wikidata.html @@ -0,0 +1,331 @@ + + + + + + + + + The 1985 Juno Awards collection - Laurentian University + + + + + + + + + + + +

Catalog

+ + +
+ +
+ + + +

Record Details

+

Catalog Search

+ +
+ +
+ +
+ + + + + +
+ +
+
+

The 1985 Juno Awards collection

+ +
Adams, Bryan (Singer). Hart, Corey (Singer). Silver, Liberty (Singer). McLauchlan, Murray (Singer). Thompson, Don (Instrumentalist). Luba (Singer). Janz, Paul (Singer). lang, k.d. (Kathryn Dawn), 1961- (Singer). Idle Eyes (Performer). The Family Brown (Performer). Parachute Club (Performer). Oxford String Quartet (Performer). +
+ + + +
+
+ Image of item + +
+
+
+ + + + Phonograph music recording + Phonograph music recording + + +
+
+ +
+
+ Print / Email Actions Image + Print / + Email +
+ + + +
+
+
+ +
+

Available copies

+
    +
  • + 1 of 1 copy available at Conifer. + (Show) +
  • +
  • + 1 of 1 copy available at Laurentian University. +
  • +
+
+ + +

Current holds

+

+ 0 current holds with 1 total copy. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LocationCall Number / Copy NotesBarcodeShelving LocationStatusDue Date
J.N. Desmarais Library + + + LP 3689 + 30007006013980 Long-play records (3rd floor)Available-
+
+
+ + +
+ +

Record details

+
    +
  • + Physical Description: + 1 sound disc : 33 1/3 rpm, stereo +
  • +
  • + Publisher: + + Montréal, Qué. : + Radio Canada International, + + 1986.
  • +
+ + +

Content descriptions

+ + + + + + +
Formatted Contents Note: Heaven / Adams -- Never surrender / Hart -- Lost somewhere inside your love / Silver -- Railroad man / McLauchlan -- Tokyo Rose / Idle Eyes -- I've never been in love before / Thompson -- Let it go / Luba -- Go to pieces / Janz -- Wouldn't you love us together again / The Family Brown -- At the feet of the moon / Parachute Club -- Pine and stew / lang -- Minuetto from Quartet in B flat major / Mozart.
+ + + + + + + + + + + + +
Subject: Popular music > Canada.
String quartets.
Country music > Canada.
+ + + +
+
+ +
+
+ +
+
+ + + + +
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ + + +
+ +
+
+
+
+

Additional Resources

+ + + + + + + -- 2.11.0