Changeset 34818


Ignore:
Timestamp:
2021-02-11T18:07:12+13:00 (3 years ago)
Author:
davidb
Message:

Next stage of development/testing

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  
    11#!/bin/bash
    22
    3 input_sparql_query_file=${1:-fix-problem-songs--using-errata.sparql}
     3input_sparql_query_file=${1:-local--countries-in-esc-by-year-after-1956--with-errata.sparql}
     4
     5output_json_queryresult_file=${input_sparql_query_file%.*}.json
    46
    57sparql_query=`cat "$input_sparql_query_file"`
     
    1214echo "   http://localhost:3030/greenstone/query"
    1315echo ""
     16echo "Saving output JSON resultset as:"
     17echo "  $output_json_queryresult_file"
     18echo ""
    1419
    1520s-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  
    1616
    1717SELECT ?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)
    1922WHERE {
    2023  SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
     
    2225
    2326    ?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     
    2430    bind( REPLACE(str(?country_in_year), ".*(\\d{4})", "$1") AS ?year).
    2531    FILTER ( xsd:integer(?year) > 1956 && xsd:integer(?year) < 2020).
     
    4955  BIND (IF(isIRI(?song),?song,?song_errata_uri) AS ?song_robust)
    5056
     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
    5179  SERVICE <https://dbpedia.demo.openlinksw.com/sparql> {
    5280
    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.
    5683
    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
    6393    }
    6494  }
Note: See TracChangeset for help on using the changeset viewer.