smashub/choco

Experimental queries with ChoCo's new model

Opened this issue · 3 comments

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

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

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

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