Exemple #1
0
 /**
  * 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]');
 }
Exemple #2
0
rdfdb_insert_data('http://example/bookStore', '<http://example/book4>  <http://ex.org/title>  "Fundamentals of Compiler Design4"')->execute();
// An array containing prefix and namespaces as name/value pairs.
$options = array('namespaces' => array('dc' => 'http://purl.org/dc/terms/'));
//var_dump(rdfdb_insert_data('http://example/bookStore', '<http://example/book3>  dc:title  "Fundamentals of Compiler Design with ns34"', $options)->execute());
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// Delete data from a graph
// DELETE DATA { graph_triples }
//  graph_triples :: = TriplesBlock | GRAPH <graph_uri> { TriplesBlock }
//rdfdb_delete_data($graph_triples)
// DELETE FROM <http://example/bookStore>
// DELETE { ?s ?p ?o . } WHERE { ?s ?p ?o . }
//var_dump(rdfdb_delete_data(NULL, '<http://example/book3>  <http://ex.org/title>  "Fundamentals of Compiler Design"')->execute());
//var_dump(rdfdb_delete_data('http://example/bookStore', '<http://example/book4>  <http://ex.org/title>  "Fundamentals of Compiler Design"')->execute());
//rdfdb_select('?s ?p ?o', $options)->where('?s ?p ?o')->execute();
$rs = rdfdb_clear('http://example/bookStore', $options)->execute();
var_dump($rs);
//rdfdb_clear()->execute();
//return;
//echo SparqlToTSV($rs['result']);
//ARC2::getComponent('ARC2_StoreEndpoint');
//echo SparqlToTSV($rs['result']['rows'], $rs['result']['variables']);
//$rs = rdfdb_clear('http://example.org/g2', $options)->execute();
//var_dump($rs);
// Dummy function exporting SPARQL results as TSV plain text, making it easier
// to do RDF comparisons for unit testing purposes.
function SparqlToTSV($results)
{
    $rows = $results['rows'];
    $vars = $results['variables'];
    $r = '';
Exemple #3
0
 /**
  * Helper functions to clear an entire store during tests.
  */
 function _clear($options = array())
 {
     rdfdb_clear()->execute();
     $this->assertEqual(0, $this->countQuads(), 'The store has been cleared. [%s]');
 }
Exemple #4
0
 /**
  * Helper functions to clear an entire store during tests.
  */
 function _reset($options = array())
 {
     $rs = rdfdb_select('DISTINCT ?g')->where('GRAPH ?g { ?s ?p ?o . } ')->execute();
     foreach ($rs['result']['rows'] as $row) {
         rdfdb_clear($row['g'])->execute();
     }
     $this->assertEqual(0, $this->countQuads(), 'The store has been cleared. [%s]');
 }