isSetUp()) { $store->setUp(); } $q = " PREFIX sioc: PREFIX sioct: PREFIX foaf: PREFIX rdf: PREFIX dct: select distinct ?g ?s ?p ?o where { graph ?g {?s ?p ?o} } "; $rs = $store->query($q); // var_dump($rs); $graphs = array(); foreach ($rs['result']['rows'] as $row) { // import the bindings of the result row as php variables foreach ($row as $k => $v) { $kn = 'row_' . str_replace(' ', '_', $k); $$kn = $v; } $triple = array($row_s, $row_p, $row_o); if ($graphs[$row_g]) $graphs[$row_g][] = $triple; else $graphs[$row_g] = array($triple); } print "

HTML dump of the documents aggregated

\n"; foreach ($graphs as $g => $triples) { print "

$g

\n\n"; array_multisort($triples); foreach ($triples as $triple) { echo "\n"; } print "
$triple[0]$triple[1]$triple[2]
\n"; } ?>