Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental queries with ChoCo's new model #108

Open
jonnybluesman opened this issue Jun 29, 2023 · 3 comments
Open

Experimental queries with ChoCo's new model #108

jonnybluesman opened this issue Jun 29, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@jonnybluesman
Copy link
Member

jonnybluesman commented Jun 29, 2023

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

@jonnybluesman
Copy link
Member Author

jonnybluesman commented Jun 29, 2023

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

@jonnybluesman
Copy link
Member Author

jonnybluesman commented Jun 29, 2023

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
Copy link
Member Author

jonnybluesman commented Jun 29, 2023

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

@jonnybluesman jonnybluesman self-assigned this Jun 29, 2023
@jonnybluesman jonnybluesman added the documentation Improvements or additions to documentation label Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant