PHP code example of sweetrdf / in-memory-store-sqlite
1. Go to this page and download the library: Download sweetrdf/in-memory-store-sqlite library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sweetrdf / in-memory-store-sqlite example snippets
use sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite;
// get ready to use store instance
$store = InMemoryStoreSqlite::createInstance();
// send a SPARQL query which creates two triples
$store->query('INSERT INTO <http://example.com/> {
<http://s> <http://p1> "baz" .
<http://s> <http://xmlns.com/foaf/0.1/name> "label1" .
}');
// send another SPARQL query asking for all triples
$res = $store->query('SELECT * WHERE {?s ?p ?o.}');
$triples = $res['result']['rows'];
echo \count($triples); // outputs: 2
// $triples contains result set, which consists of arrays and scalar values