From d4bf770aae2566c1e1cdd25a7f1d055404d6c414 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sat, 12 Aug 2017 15:27:17 -0400 Subject: [PATCH] Make each property OPTIONAL By making the entire set of properties in a single OPTIONAL clause, we were only getting properties when all of them were present. Signed-off-by: Dan Scott --- Open-ILS/web/js/ui/default/opac/wikidata_music_card.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 69f4398635..a87e60d9b0 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,20 +83,21 @@ 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 WHERE {' + + '?website ?musicbrainz ?songKick ?twitter ?facebook ' + + 'WHERE { ' + '?item rdfs:label|skos:altLabel|wdt:P1449 "' + entity_name + '"@en . ' + '{ ?item wdt:P31 wd:Q215380 . } ' + // band 'UNION ' + '{ ?item wdt:P31 wd:Q5741069 . } ' + // rock band 'UNION ' + '{ ?item wdt:P106/wdt:P279* wd:Q639669 . } ' + - 'OPTIONAL { ?item wdt:P3478 ?songKick . ' + - ' ?item wdt:P19 ?birthPlace . ' + - ' ?item wdt:P856 ?website . ' + - ' ?item wdt:P434 ?musicbrainz . ' + - ' ?item wdt:P2002 ?twitter . ' + - ' ?item wdt:P2013 ?facebook . ' + - ' ?item wdt:P18 ?image } . ' + + 'OPTIONAL { ?item wdt:P3478 ?songKick } . ' + + 'OPTIONAL { ?item wdt:P19 ?birthPlace } . ' + + 'OPTIONAL { ?item wdt:P856 ?website } . ' + + 'OPTIONAL { ?item wdt:P434 ?musicbrainz } . ' + + 'OPTIONAL { ?item wdt:P2002 ?twitter } . ' + + 'OPTIONAL { ?item wdt:P2013 ?facebook } . ' + + 'OPTIONAL { ?item wdt:P18 ?image } . ' + 'SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } ' + '} ' + 'LIMIT 10'; -- 2.11.0