Changeset 34818
- Timestamp:
- 2021-02-11T18:07:12+13:00 (3 years ago)
- Location:
- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata/LOCAL-LOD-QUERY.sh
r34813 r34818 1 1 #!/bin/bash 2 2 3 input_sparql_query_file=${1:-fix-problem-songs--using-errata.sparql} 3 input_sparql_query_file=${1:-local--countries-in-esc-by-year-after-1956--with-errata.sparql} 4 5 output_json_queryresult_file=${input_sparql_query_file%.*}.json 4 6 5 7 sparql_query=`cat "$input_sparql_query_file"` … … 12 14 echo " http://localhost:3030/greenstone/query" 13 15 echo "" 16 echo "Saving output JSON resultset as:" 17 echo " $output_json_queryresult_file" 18 echo "" 14 19 15 20 s-query --service http://localhost:3030/greenstone/query \ 16 "$sparql_query" 21 "$sparql_query" > "$output_json_queryresult_file" -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata/local--countries-in-esc-by-year-after-1956--with-errata.sparql
r34817 r34818 16 16 17 17 SELECT ?countries_in_esc_by_year ?country_in_year (?year AS ?Year) (?country AS ?Country) 18 ?entrant_robust (?entrant_label AS ?Creator) ?song_robust (?song_label AS ?Title) (?was_derived_from AS ?WikipediaURL) 18 ?entrant_robust (?entrant_label AS ?Creator) ?song_robust (?song_label AS ?Title) 19 (?country_in_year_abstract_en AS ?Abstract_en) 20 (?song_abstract_en AS ?TitleAbstract_en) (?entrant_abstract_en AS ?CreatorAbstract_en) 21 (?was_derived_from AS ?WikipediaURL) 19 22 WHERE { 20 23 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> { … … 22 25 23 26 ?country_in_year dct:subject ?countries_in_esc_by_year. 27 # Useful example 28 ## FILTER (?country_in_year = dbr:Bosnia_and_Herzegovina_in_the_Eurovision_Song_Contest_2010). 29 24 30 bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") AS ?year). 25 31 FILTER ( xsd:integer(?year) > 1956 && xsd:integer(?year) < 2020). … … 49 55 BIND (IF(isIRI(?song),?song,?song_errata_uri) AS ?song_robust) 50 56 57 58 # BIND(REPLACE(REPLACE(str(?entrant_robust), "^.*/", "", "i"),"_"," ","i") AS ?entrant_label_raw). 59 # # Create more DL friendly entrant-title metadata from Wikipedia entrant-uri/label 60 # BIND(REPLACE(?entrant_label_raw, "\\s*\\(.*?singer\\)$", "", "i") AS ?entrant_label_p1). 61 # BIND(REPLACE(?entrant_label_p1, "\\s*\\(.*?duo\\)$", "", "i") AS ?entrant_label_p2). 62 # BIND(REPLACE(?entrant_label_p2, "\\s*\\(.*?band\\)$", "", "i") AS ?entrant_label_p3). 63 # BIND(REPLACE(?entrant_label_p3, "\\s*\\(.*?group\\)$", "", "i") AS ?entrant_label_p4). 64 # BIND(REPLACE(?entrant_label_p4, "\\s*\\(.*?musician\\)$", "", "i") AS ?entrant_label). 65 66 # Create more DL friendly entrant-title metadata from Wikipedia entrant-uri/label 67 BIND(REPLACE(REPLACE(str(?entrant_robust), "^.*/(.*?)(_+\\(.*(singer|duo|band|group|musician)\\))?$", "$1"),"_"," ") AS ?entrant_label). 68 69 70 # BIND(REPLACE(REPLACE(str(?song_robust), "^.*/", "", "i"),"_"," ","i") AS ?song_label_raw). 71 # # Create more DL friendly song-title metadata from Wikipedia song-uri/label 72 # BIND(REPLACE(?song_label_raw, "\\s*\\(.*?song\\)$", "", "i") AS ?song_label). 73 ## BIND(REPLACE(?song_label_p1, "\\s*\\(.*?band\\)$", "", "i") AS ?song_label_p2). 74 ## BIND(REPLACE(?song_label_p2, "\\s*\\(.*?duo\\)$", "", "i") AS ?song_label). 75 76 # Create more DL friendly song-title metadata from Wikipedia song-uri/label 77 BIND(REPLACE(REPLACE(str(?song_robust), "^.*/(.*?)(_+\\(.*song\\))?$", "$1"),"_"," ") AS ?song_label). 78 51 79 SERVICE <https://dbpedia.demo.openlinksw.com/sparql> { 52 80 53 BIND(REPLACE(REPLACE(str(?entrant_robust), "^.*/", "", "i"),"_"," ","i") AS ?entrant_label_raw). 54 # Create more DL friendly entrant-title metadata from Wikipedia entrant-uri/label 55 BIND(REPLACE(?entrant_label_raw, "\\s*\\(.*?singer\\)$", "", "i") AS ?entrant_label). 81 OPTIONAL { 82 ?song_robust prov:wasDerivedFrom ?was_derived_from. 56 83 57 BIND(REPLACE(REPLACE(str(?song_robust), "^.*/", "", "i"),"_"," ","i") AS ?song_label_raw). 58 # Create more DL friendly song-title metadata from Wikipedia song-uri/label 59 BIND(REPLACE(?song_label_raw, "\\s*\\(.*?song\\)$", "", "i") AS ?song_label). 60 61 OPTIONAL { 62 ?song_robust prov:wasDerivedFrom ?was_derived_from 84 ?country_in_year dbo:abstract ?country_in_year_abstract_en 85 FILTER (lang(?country_in_year_abstract_en) = 'en'). 86 87 ?entrant_robust dbo:abstract ?entrant_abstract_en 88 FILTER (lang(?entrant_abstract_en) = 'en'). 89 90 ?song_robust dbo:abstract ?song_abstract_en 91 FILTER (lang(?song_abstract_en) = 'en'). 92 63 93 } 64 94 }
Note:
See TracChangeset
for help on using the changeset viewer.