Skip to content

Commit 6be22d1

Browse files
committed
reformat queries to prompts
1 parent baa3c8d commit 6be22d1

20 files changed

+258
-372
lines changed

queries/prompt_1.sparql

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PROMPT 1
2+
# For a given pattern, which are the tracks (titles, artists
3+
# and genres) in which the pattern can be found?
4+
############################################################
5+
# Example for pattern "0_0_0"
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
SELECT DISTINCT ?artist ?genre ?title
13+
WHERE {
14+
?pattern1 rdfs:label "0_0_0" ;
15+
har:refersToSegment ?segment1 .
16+
?segment1 har:belongsToMusicalWork ?track1 .
17+
?track1 har:hasArtist ?artist ;
18+
har:hasGenre ?genre ;
19+
har:hasTitle ?title .
20+
}
21+
LIMIT 30

queries/prompt_2.sparql

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PROMPT 2
2+
# Given a music genre, what are the most frequent patterns?
3+
############################################################
4+
# Example for genre "classical"
5+
6+
PREFIX har: <http://w3id.org/polifonia/harmory/>
7+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
8+
PREFIX core: <http://w3id.org/polifonia/core/>
9+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
10+
11+
SELECT (COUNT(DISTINCT ?track) as ?patternCount)
12+
WHERE {
13+
?pattern har:refersToSegment ?segment .
14+
?segment har:belongsToMusicalWork ?track .
15+
?track har:hasArtist ?artist ;
16+
har:hasGenre ?genre ;
17+
har:hasTitle ?title .
18+
FILTER (?genre = "classical")
19+
}
20+
GROUP BY ?track
21+
ORDER BY DESC (?patternCount)
22+
LIMIT 30

queries/prompt_3.sparql

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PROMPT 3
2+
# Which harmonic patterns are used in “Michelle” by The
3+
# Beatles, but also in a classical composition?
4+
############################################################
5+
6+
PREFIX har: <http://w3id.org/polifonia/harmory/>
7+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
8+
PREFIX core: <http://w3id.org/polifonia/core/>
9+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
10+
11+
SELECT DISTINCT ?pattern
12+
WHERE {
13+
?pattern har:refersToSegment ?segmen .
14+
?segment har:belongsToMusicalWork ?track .
15+
?track har:hasArtist ?artist ;
16+
har:hasGenre ?genre ;
17+
har:hasTitle ?title .
18+
FILTER (?title = "Michelle")
19+
FILTER (?genre = "classical")
20+
}
21+
LIMIT 30

queries/prompt_4.sparql

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# PROMPT 4
2+
# Which patterns used by The Beatles in “Michelle” but not
3+
# in “Hey Jude” contain at least a B flat major seventh chord?
4+
############################################################
5+
6+
PREFIX har: <http://w3id.org/polifonia/harmory/>
7+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
8+
PREFIX core: <http://w3id.org/polifonia/core/>
9+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
10+
11+
SELECT DISTINCT ?pattern
12+
WHERE {
13+
?pattern har:refersToSegment ?segment .
14+
?segment har:belongsToMusicalWork ?track ;
15+
har:containsChordAnnotation ?chordAnnotation .
16+
?chordAnnotation har:hasChord ?chord .
17+
?chord rdfs:label ?chordLabel .
18+
?track har:hasArtist ?artist ;
19+
har:hasGenre ?genre ;
20+
har:hasTitle ?title .
21+
FILTER (?title = "Michelle")
22+
FILTER (?title != "Hey Jude")
23+
FILTER (?chordLabel = "Bb:maj7")
24+
}
25+
LIMIT 30

queries/prompt_5.sparql

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# PROMPT 5
2+
# Given a chord sequence, which are its variations, and
3+
# which tracks these variations belong to?
4+
############################################################
5+
# Example for the sequence Eb:min, Eb:min, Bb:maj
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
SELECT DISTINCT ?title ?relatedSegment
13+
WHERE {
14+
?segment har:belongsToMusicalWork ?track ;
15+
har:containsChordAnnotation ?chordAnnotation .
16+
?chordAnnotation har:hasChord ?chord1 ;
17+
har:hasNextChord ?chordAnnotation2 .
18+
?chordAnnotation2 har:hasChord ?chord2 ;
19+
har:hasNextChord ?chordAnnotation3 .
20+
?chordAnnotation3 har:hasChord ?chord3 .
21+
?chord1 rdfs:label "Eb:min" .
22+
?chord2 rdfs:label "Eb:min" .
23+
?chord3 rdfs:label "Bb:maj" .
24+
?segment har:hasSegmentPattern ?pattern .
25+
?pattern har:isSegmentPatternOf ?track ;
26+
har:refersToSegment ?relatedSegment .
27+
?track har:hasArtist ?artist ;
28+
har:hasGenre ?genre ;
29+
har:hasTitle ?title .
30+
}
31+
LIMIT 30

queries/prompt_6.sparql

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# PROMPT 6
2+
# Given a chord sequence, which are its most similar chord
3+
# sequences, sorted by similarity?
4+
############################################################
5+
# Example for the sequence Eb:min, Eb:min, Bb:maj
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
SELECT DISTINCT ?title ?relatedSegment
13+
WHERE {
14+
?segment har:belongsToMusicalWork ?track ;
15+
har:containsChordAnnotation ?chordAnnotation .
16+
?chordAnnotation har:hasChord ?chord1 ;
17+
har:hasNextChord ?chordAnnotation2 .
18+
?chordAnnotation2 har:hasChord ?chord2 ;
19+
har:hasNextChord ?chordAnnotation3 .
20+
?chordAnnotation3 har:hasChord ?chord3 .
21+
?chord1 rdfs:label "Eb:min" .
22+
?chord2 rdfs:label "Eb:min" .
23+
?chord3 rdfs:label "Bb:maj" .
24+
?segment har:hasSegmentPattern ?pattern .
25+
?pattern har:isInvolvedInSimilarity ?similarity .
26+
?similarity har:involvesSegmentPattern ?similarPattern ;
27+
har:hasSimilarityValue ?similarityValue .
28+
?similarPattern har:isSegmentPatternOf ?track ;
29+
har:refersToSegment ?relatedSegment .
30+
?track har:hasArtist ?artist ;
31+
har:hasGenre ?genre ;
32+
har:hasTitle ?title .
33+
34+
FILTER (?similarPattern != ?pattern)
35+
}
36+
ORDER BY DESC (?similarityValue)
37+
LIMIT 30

queries/prompt_7.sparql

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PROMPT 7
2+
# Create a progression starting with “Michelle” by The Bea-
3+
# tles, continuing with a segment found in a classical piece of
4+
# music, and then continuing with another by Chet Baker.
5+
############################################################
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
SELECT DISTINCT ?segment1Track1 ?segment1Track2 ?segment1Track3
13+
WHERE {
14+
?track1 core:hasTitle "Michelle" ;
15+
core:hasArtist "The Beatles" ;
16+
har:containsSegmentPattern ?pattern1 .
17+
?pattern1 har:refersToSegment ?segment1Track1 .
18+
?segment1Track1 har:hasNextSegment ?segment2Track1 .
19+
?pattern2Track1 har:refersToSegment ?segment2Track1 ;
20+
har:isInvolvedInSimilarity ?similarity1_2 .
21+
?similarity1_2 har:involvesSegmentPattern ?pattern2 .
22+
?track2 har:containsSegmentPattern ?pattern2 ;
23+
core:hasTitle ?title2 ;
24+
core:hasGenre ?genre2 .
25+
?pattern2 har:refersToSegment ?segment1Track2 .
26+
?segment1Track2 har:hasNextSegment ?segment2Track2 .
27+
?pattern3 har:refersToSegment ?segment2Track2 ;
28+
har:isInvolvedInSimilarity ?similarity3_4 .
29+
?similarity3_4 har:involvesSegmentPattern ?pattern3 .
30+
?track3 har:containsSegmentPattern ?pattern3_sim ;
31+
core:hasTitle ?title3 ;
32+
core:hasArtist ?artist3 .
33+
?pattern3_sim har:refersToSegment ?segment1Track3 .
34+
35+
FILTER (?segment1order = 0)
36+
FILTER (?genre2 = "classical")
37+
FILTER (?artist3 = "Chet Baker")
38+
FILTER (?pattern1 != ?pattern2)
39+
FILTER (?pattern2 != ?pattern3)
40+
}

queries/prompt_8.sparql

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# PROMPT 8
2+
# Given a track, which tracks contain patterns with a dis-
3+
# tance of less than 0.2, each having the same order?
4+
############################################################
5+
# Example for the track "Michelle"
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
13+
SELECT DISTINCT ?track1 ?track2 ?pattern1 ?pattern2 ?similarityValue
14+
WHERE {
15+
?track1 a core:MusicalWork ;
16+
har:containsSegmentPattern ?pattern1 ;
17+
core:hasTitle ?title1 .
18+
?pattern1 har:isInvolvedInSimilarity ?similarityTo1 ;
19+
har:refersToSegment ?segment1 .
20+
?similarityTo1 har:hasSimilarityValue ?similarityValue ;
21+
har:involvesSegmentPattern ?pattern2 .
22+
?track2 har:containsSegmentPattern ?pattern2 .
23+
?pattern2 har:refersToSegment ?segment2 .
24+
?segment1 har:hasOrder ?order1 .
25+
?segment2 har:hasOrder ?order2 .
26+
27+
FILTER (?title1 = "Michelle")
28+
FILTER (?similarityValue < 0.2)
29+
FILTER (?track1 != ?track2)
30+
FILTER (?order1 = ?order2)
31+
}
32+
LIMIT 30

queries/prompt_9.sparql

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PROMPT 9
2+
# Given a track, which tracks contain patterns with a dis-
3+
# tance of less than 0.5, regardless of their order?
4+
############################################################
5+
# Example for the track "Michelle"
6+
7+
PREFIX har: <http://w3id.org/polifonia/harmory/>
8+
PREFIX mf: <http://w3id.org/polifonia/musical-features/>
9+
PREFIX core: <http://w3id.org/polifonia/core/>
10+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
11+
12+
13+
SELECT DISTINCT ?track1 ?track2 ?pattern1 ?pattern2 ?similarityValue
14+
WHERE {
15+
?track1 a core:MusicalWork ;
16+
har:containsSegmentPattern ?pattern1 ;
17+
core:hasTitle ?title1 .
18+
?pattern1 har:isInvolvedInSimilarity ?similarityTo1 ;
19+
har:refersToSegment ?segment1 .
20+
?similarityTo1 har:hasSimilarityValue ?similarityValue ;
21+
har:involvesSegmentPattern ?pattern2 .
22+
?track2 har:containsSegmentPattern ?pattern2 .
23+
?pattern2 har:refersToSegment ?segment2 .
24+
25+
FILTER (?title1 = "Michelle")
26+
FILTER (?similarityValue < 0.5)
27+
FILTER (?track1 != ?track2)
28+
}
29+
LIMIT 30

queries/query_1.sparql

-16
This file was deleted.

queries/query_10.sparql

-16
This file was deleted.

0 commit comments

Comments
 (0)