smashub / choco

ChoCo: the Chord Corpus
Other
58 stars 6 forks source link

Experimental queries with ChoCo's new model #108

Open jonnybluesman opened 1 year ago

jonnybluesman commented 1 year ago

This is a thread to collect the new queries in ChoCo+MusicMeta, following the ongoing update.


1.1 README Query: Michelle

Give me the first 10 chord occurrences in an annotation of "Michelle"


PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX jams: <http://w3id.org/polifonia/ontology/jams/>
PREFIX mm: <http://w3id.org/polifonia/ontology/music-entity/>
PREFIX core: <http://w3id.org/polifonia/ontology/core/>

SELECT DISTINCT ?observationValue ?startTime ?startTimeType ?duration ?durationType WHERE { ?musicentity a mm:MusicEntity ; core:title "Michelle" ; jams:hasJAMSAnnotation ?annotation . ?annotation jams:includesObservation ?observation ; jams:hasAnnotationType "chord" . ?observation rdfs:label ?observationValue ; jams:hasMusicTimeInterval [jams:hasMusicTimeDuration [ jams:hasValue ?duration ; jams:hasValueType ?durationType ] ; jams:hasMusicTimeStartIndex [ jams:hasMusicTimeIndexComponent [ jams:hasValue ?startTime ; jams:hasValueType ?startTimeType ]]] . } ORDER BY (?startTime) LIMIT 10


[Run it](https://polifonia.disi.unibo.it/choco/query#query=PREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX%20jams%3A%20%3Chttp%3A%2F%2Fw3id.org%2Fpolifonia%2Fontology%2Fjams%2F%3E%0APREFIX%20mm%3A%20%3Chttp%3A%2F%2Fw3id.org%2Fpolifonia%2Fontology%2Fmusic-entity%2F%3E%0APREFIX%20core%3A%20%3Chttp%3A%2F%2Fw3id.org%2Fpolifonia%2Fontology%2Fcore%2F%3E%0A%0ASELECT%20DISTINCT%20%3FobservationValue%20%3FstartTime%20%3FstartTimeType%20%3Fduration%20%3FdurationType%0AWHERE%20%7B%0A%20%20%3Fmusicentity%20a%20mm%3AMusicEntity%20%3B%0A%20%20%20%20core%3Atitle%20%22Michelle%22%20%3B%0A%20%20%20%20jams%3AhasJAMSAnnotation%20%3Fannotation%20.%0A%20%20%3Fannotation%20jams%3AincludesObservation%20%3Fobservation%20%3B%0A%20%20%20%20jams%3AhasAnnotationType%20%22chord%22%20.%0A%20%20%3Fobservation%20rdfs%3Alabel%20%3FobservationValue%20%3B%0A%20%20%20%20jams%3AhasMusicTimeInterval%20%5Bjams%3AhasMusicTimeDuration%20%5B%20jams%3AhasValue%20%3Fduration%20%3B%20jams%3AhasValueType%20%3FdurationType%20%5D%20%3B%0A%20%20%20%20%20%20jams%3AhasMusicTimeStartIndex%20%5B%20jams%3AhasMusicTimeIndexComponent%20%5B%20jams%3AhasValue%20%3FstartTime%20%3B%20jams%3AhasValueType%20%3FstartTimeType%20%20%5D%5D%5D%20.%0A%7D%0AORDER%20BY%20(%3FstartTime)%0ALIMIT%2010&endpoint=https%3A%2F%2Fpolifonia.disi.unibo.it%2Fsemanticroman%2Fsparql&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=application%2Fn-triples%2C*%2F*%3Bq%3D0.9&contentTypeSelect=application%2Fsparql-results%2Bjson%2C*%2F*%3Bq%3D0.9&outputFormat=table)
jonnybluesman commented 1 year ago

2.1 Searching ChoCo by text

Give me the JAMS files, title, artist name, ChoCo ID, and link to the JAMS file — for anything that has “Beatles” in the title or in the artist name (limited by 10)

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX jams: <http://w3id.org/polifonia/ontology/jams/>
PREFIX mm: <http://w3id.org/polifonia/ontology/music-entity/>
PREFIX core: <http://w3id.org/polifonia/ontology/core/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT DISTINCT ?jamsFile ?title ?artistName ?chocoId ?chocoLink
WHERE {
  ?musicentity a mm:MusicEntity ;
    mm:hasArtist ?artist ;
    core:title ?title ;
    jams:hasJAMSAnnotation ?annotation .
  ?annotation jams:hasAnnotationType ?chordType ;
    prov:wasDerivedFrom ?jamsFile .
  ?jamsFile owl:sameAs ?chocoLink ;
    rdfs:label ?chocoId .
  ?artist rdfs:label ?artistName .
  bind("mozart" as ?query)
  filter(contains(lcase(?artistName), lcase(?query)))
  filter(contains(?chordType, "chord"))
}
ORDER BY (?chocoId)
LIMIT 100

Run it)%0A%20%20filter(contains(%3FchordType%2C%20%22chord%22))%0A%7D%0AORDER%20BY%20(%3FchocoId)%0ALIMIT%20100&endpoint=https%3A%2F%2Fpolifonia.disi.unibo.it%2Fsemanticroman%2Fsparql&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=application%2Fn-triples%2C%2F%3Bq%3D0.9&contentTypeSelect=application%2Fsparql-results%2Bjson%2C%2F%3Bq%3D0.9&outputFormat=table)

jonnybluesman commented 1 year ago

2.2 JAMS files and IDs

Give me all the JAMS files in ChoCo together with their ID and link (limited to 10)

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX jams: <http://w3id.org/polifonia/ontology/jams/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT DISTINCT ?jamsFile ?chocoId ?chocoLink
WHERE {
  ?jamsFile a jams:JAMSFile ;
    owl:sameAs ?chocoLink ;
    rdfs:label ?chocoId .
} 
ORDER BY (?chocoId)
LIMIT 10

Run it

jonnybluesman commented 1 year ago

2.3 Observations from ChoCo ID

Given a ChoCo ID of a specific JAMS, just give me the chord observations

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX jams: <http://w3id.org/polifonia/ontology/jams/>
PREFIX mm: <http://w3id.org/polifonia/ontology/music-entity/>
PREFIX core: <http://w3id.org/polifonia/ontology/core/>
PREFIX prov: <http://www.w3.org/ns/prov#>

SELECT DISTINCT ?observationValue ?startTime ?startTimeType ?duration ?durationType
WHERE {
  bind("billboard_132.jams" as ?queryID)
  ?jamsFile a jams:JAMSFile ;
    rdfs:label ?queryID .
  ?annotation a jams:JAMSAnnotation ;
    prov:wasDerivedFrom ?jamsFile ;
    jams:includesObservation ?observation ;
    jams:hasAnnotationType "chord" .
  ?observation rdfs:label ?observationValue ;
    jams:hasMusicTimeInterval [jams:hasMusicTimeDuration [ jams:hasValue ?duration ; jams:hasValueType ?durationType ] ;
      jams:hasMusicTimeStartIndex [ jams:hasMusicTimeIndexComponent [ jams:hasValue ?startTime ; jams:hasValueType ?startTimeType  ]]] .
}
ORDER BY (?startTime)

Run it