-
Notifications
You must be signed in to change notification settings - Fork 1
/
rdfdb_arc2.inc
45 lines (37 loc) · 1.07 KB
/
rdfdb_arc2.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* @file
* Code for connection to ARC2 servers.
*/
class RdfdbConnection_arc2 extends RdfdbConnection {
public function __construct(array $connection_options = array()) {
// Gets connection info and instanciate an ARC2 remote SPARQL store.
$rdfdb_info = Rdfdb::getConnectionInfo();
$config = array(
'remote_store_endpoint' => $rdfdb_info['default']['endpoint'],
'store_write_key' => $rdfdb_info['default']['apikey'],
);
if (!empty($rdfdb_info['default']['namespaces'])) {
$config['ns'] = $rdfdb_info['default']['namespaces'];
}
$this->store = ARC2::getRemoteStore($config);
}
public function query($query, array $options = array()) {
$r = $this->store->query($query, $options);
if ($e = $this->store->getErrors()) {
//var_dump($this);
//var_dump($e);
throw new PDOException('Invalid return directive: ' . implode($e));
}
else {
//var_dump($r);
return $r;
}
}
public function driver() {
return 'arc2';
}
public function databaseType() {
return 'arc2';
}
}