display: >-
  Show me <b>polymer nanocomposite samples</b> containing at least {{id_1}} constituent material(s) classified as a filler and at least {{id_2}} constituent material(s) classified as a matrix.
options:
  id_1:
    1: 1
    2: 2
    3: 3
  id_2:
    1: 1
    2: 2
    3: 3
SPARQL: |
  PREFIX sio: <http://semanticscience.org/resource/>
  PREFIX nm: <http://nanomine.org/ns/>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  SELECT DISTINCT ?Sample 
  (COUNT(DISTINCT ?Filler) AS ?FillerCount) (GROUP_CONCAT(DISTINCT ?Filler ; SEPARATOR=", ") AS ?FillerMaterials) 
  (COUNT(DISTINCT ?Matrix) AS ?MatrixCount) (GROUP_CONCAT(DISTINCT ?Matrix ; SEPARATOR=", ") AS ?MatrixMaterials)
  WHERE {
  ?Sample a nm:PolymerNanocomposite ;
        sio:hasComponentPart [ sio:hasRole [ a nm:Filler ] ;
                               a [ rdfs:label ?Filler ] ] ,
                             [ sio:hasRole [ a nm:Matrix ] ;
                               a [ rdfs:label ?Matrix] ]
  }
  GROUP BY ?Sample
  HAVING ((?FillerCount >= {{id_1}}) && (?MatrixCount >= {{id_2}}))