SELECT ?src ?x ?p ?y WHERE { GRAPH ?src { ?x ?p ?y } FILTER ( regex(?src, '.*foaf.*') || regex(?src, '.*research.*')) } ORDER BY ?src