#First count how many triples are there PREFIX aocat: PREFIX ariadneplus: PREFIX skos: SELECT ?resource ?aat WHERE { GRAPH { ?resource ?p ?o . } GRAPH { ?resource aocat:has_derived_subject ?aat . } } #let's delete them from the aatplus graph for the individual records PREFIX aocat: PREFIX rdf: WITH DELETE { ?resource aocat:has_derived_subject ?aat . } USING USING WHERE { ?resource rdf:type aocat:AO_Individual_Data_Resource . ?resource aocat:has_derived_subject ?aat . } #and now the collection PREFIX aocat: PREFIX rdf: WITH DELETE { ?resource aocat:has_derived_subject ?aat . } USING USING WHERE { ?resource rdf:type aocat:AO_Collection . ?resource aocat:has_derived_subject ?aat . }