PREFIX n: select * where { ?x n:memberOf ?org . filter(exists {{?x n:related ?y} minus {?y n:memberOf ?org}}) }