Tuesday 15 September 2015

SPARQL INSERT with ARC2 PHP library -



SPARQL INSERT with ARC2 PHP library -

i trying execute insert on sparql endpoint in php using arc2 library. fails error "could not handle " prefix dc:"

the sparql update query taken w3c specification , works fine on jena-fuseki command panel:

$query = ' prefix dc: <http://purl.org/dc/elements/1.1/> insert info { <http://example/book007> dc:title "a new book" ; dc:creator "a.n.other" . } ';

but variations of query without prefix statement result in similar error "could not handle " insert info {" in php code.

my php code follows:

include_once('./lib/arc2/arc2.php'); $config = array( //db 'db_name' => 'arc2', 'db_user' => 'root', 'db_pwd' => '-', //store 'store_name' => 'arc_tests' ); $store = arc2::getstore($config); if (!$store->issetup()) $store->setup(); $res = $store->query($query); echo var_dump($store->geterrors()); echo "<br><br>executed insert, returned: "; echo var_dump($res);

this version using native arc2 store cut down potential error sources. trying interact remote store:

$config = array( 'remote_store_endpoint' => 'http://localhost:3030/data/update', ); $store = arc2::getremotestore($config);

both give me same error, however.

in end want connect remote sparql endpoint of jena fuseki server , interactively insert , retrieve info in php. if have other libraries or clean solutions how interact through sparql protocol in php, happy alter approach.

it seems, arc2 not back upwards sparql 1.1 parsing.

instead supports simplified sparql+ update queries. next query inserts new triple arc2 store:

$query = 'insert info { <http://example/book1> dc:title "a new book" ; dc:creator "a.n.other" . }';

unfortunately, limited sparql+ seems impossible updates through remote store on jena fuseki instance. either arc2 complaining sparql 1.1 conform query syntax given in question, or jena fuseki complaining sparql+ query syntax seems specific arc2.

any advice? posted new question this: php sparql 1.1 library semantic web stack: php - sparql - jena fuseki?

php sparql semantic-web

No comments:

Post a Comment