PREFIX mus: <http://data.doremus.org/ontology#>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX efrbroo: <http://erlangen-crm.org/efrbroo/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

# Source: https://list.indiana.edu/sympa/arc/mla-l/2017-08/msg00248.html
# [en] Could I find any music for flute and TWO bassoons  an interesting combo

SELECT DISTINCT ?expression, SAMPLE(?composer) as ?composer, SAMPLE(?title) as ?title, ?casting
WHERE {
  ?expression a efrbroo:F22_Self-Contained_Expression ;
          mus:U70_has_title ?title ;
          mus:U13_has_casting ?casting .

  ?expCreation efrbroo:R17_created ?expression ;
          ecrm:P9_consists_of / ecrm:P14_carried_out_by / foaf:name ?composer .

  ?casting mus:U23_has_casting_detail ?allCastingDets .

  ?casting mus:U23_has_casting_detail ?castingDet1, ?castingDet2 .
  ?castingDet1 mus:U2_foresees_use_of_medium_of_performance_of_type ?bassoon ;
       mus:U30_foresees_quantity_of_mop 2 .

  ?castingDet2 mus:U2_foresees_use_of_medium_of_performance_of_type ?flute .

  VALUES (?bassoon) { ( <http://data.doremus.org/vocabulary/iaml/mop/wba> ) (<http://www.mimo-db.eu/InstrumentsKeywords/3795>) }
  VALUES (?flute) { ( <http://data.doremus.org/vocabulary/iaml/mop/wfl> ) (<http://www.mimo-db.eu/InstrumentsKeywords/3955>) }
}
GROUP BY ?expression ?casting
HAVING (COUNT(?allCastingDets) >= 2)