/** * Helper functions to reset an entire store during tests. This removes all * triples from all graphs in the store. */ function _reset($options = array()) { $rs = rdfdb_select('DISTINCT ?g')->where('GRAPH ?g { ?s ?p ?o . } ')->execute(); foreach ($rs['result']['rows'] as $row) { if ($row['g'] != 'http://www.openlinksw.com/schemas/virtrdf#' && $row['g'] != 'http://localhost:18890/DAV') { rdfdb_clear($row['g'])->execute(); } } $this->assertEqual(0, $this->countQuads(), 'The store has been cleared. [%s]'); }
function countQuads() { $rs = rdfdb_select('?g ?s ?p ?o')->where('GRAPH ?g { ?s ?p ?o . } ')->execute(); return count($rs['result']['rows']); }