select distinct ?libraryName where {
    ?amplicon <http://schema.org/identifier> ?identifier .
    ?amplicon <http://unlock-icat.irods.surfsara.nl/Library_name> ?libraryName .
    ?amplicon <http://m-unlock.nl/ontology/library> ?library .
    ?library <http://jermontology.org/ontology/JERMOntology#hasPart> ?part .
    ?part <http://schema.org/name> ?filename .
    {
        select distinct ?identifier (COUNT(DISTINCT(?part)) AS ?count) where {
            ?amplicon <http://schema.org/identifier> ?identifier .
            ?amplicon <http://unlock-icat.irods.surfsara.nl/Library_name> ?name .
            ?amplicon <http://m-unlock.nl/ontology/library> ?library .
            ?library <http://jermontology.org/ontology/JERMOntology#hasPart> ?part .
        } GROUP BY ?identifier
        HAVING(?count != 2)
    }
}