2

I'm trying to get information from my local ontology on GraphDB with a PHP script.

Online I've only found this this, so I've tried to adapt it to my necessities.

// ARC2 static class inclusion
include_once('semsol/ARC2.php');  

$dbpconfig = array(
    "remote_store_endpoint" => "http://localhost:7200/sparql",
);

$store = ARC2::getRemoteStore($dbpconfig); 

if ($errs = $store->getErrors()) {
    echo "<h1>getRemoteSotre error<h1>" ;
};
                
$query = 'PREFIX aplm: <http://www.andareperlomondo.it/rdf/ontologia.rdf#>
            select * where { 
                ?s aplm:nomeCognome ?o .
            }';

// execute the query
$rows = $store->query($query, 'rows'); 

if ($errs = $store->getErrors()) {
    echo "Query errors\n" ;
    print_r($errs);
};

// display the results in an HTML table
foreach ($rows as $value) {
    echo $value;
};

However, the connection doesn't work and in PHP prints the following error:

Array (
   [0] => 404 "Not Found (HTTP status 404)..." in ARC2_Reader
   [1] => missing stream in "getFormat" via ARC2_Reader
   [2] => missing stream in "readStream" http://localhost:7200/sparql?query=%0APREFIX+aplm%3A+%3Chttp%3A%2F%2Fwww.andareperlomondo.it%2Frdf%2Fontologia.rdf%23%3E%0A%09%09%09%09%09%09%09%09select+%2A+where+%7B+%0A%09%09%09%09%09%09%09%09%09%3Fs+aplm%3AnomeCognome+%3Fo+.%0A%09%09%09%09%09%09%09%09%7D via ARC2_Reader
) 

What shuld I do?

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
DandozWar
  • 21
  • 4
  • try changing the repository URL from `localhost:7200/sparql` to `localhost:7200/repositories/` – Damyan Ognyanov May 26 '21 at 07:00
  • Using your solution, something has changed but it still doesn't work. I get the following errors: `Notice: Undefined index: scheme in /opt/lampp/htdocs/aplm/semsol/ARC2_Reader.php on line 219 Query errors Array ( [0] => missing stream in "getFormat" via ARC2_Reader [1] => missing stream in "readStream" localhost:7200/repositories/aplm?query=%0APREFIX+aplm%3A+%3Chttp%3A%2F%2Fwww.andareperlomondo.it%2Frdf%2Fontologia.rdf%23%3E%0A++++++++++++%09%09%09%09%09select+%2A+where+%7B+%0A++++++++++++%09%09%09%09++++%09%3Fs+aplm%3AnomeCognome+%3Fo+.%0A++++++++++++%09%09%09%09%09%7D via ARC2_Reader ) ` – DandozWar May 26 '21 at 15:09

0 Answers0