init(); } public function do_query($query) { global $debug; $res = $this->store->query(" PREFIX sioc: PREFIX dc: PREFIX dct: PREFIX tags: PREFIX rdf: PREFIX foaf: PREFIX moat: PREFIX dbp: PREFIX content: PREFIX geo: $query "); if($debug && $this->store->getErrors()) { print_r($this->store->errors); echo "***\nQuery = $query"; die(); } return $res; } private function init() { global $arc_config; $config = $arc_config + array( 'sem_html_formats' => 'rdfa', 'store_triggers_path' => dirname(__FILE__).'/triggers/', 'store_triggers' => array( 'insert' => array('graphTimestamp'), 'load' => array('subPropertyInference'), ), ); $this->store = ARC2::getStore($config); } public function dump() { $query = "select ?g ?s ?p ?o where { graph ?g { ?s ?p ?o } } "; $res = $this->do_query($query); print_r($res); die(); } public function setup() { global $user, $default_vocabs; // If the store exists - do not reset if($this->store->isSetUp()) { echo "The store is already setup"; die(); } $this->store->reset(); $this->store->setUp(); // Load ontologies so that we can infer subproperties later foreach($default_vocabs as $vocab) { $graph = LODrTools::get_datagraph($vocab); $this->store->query("LOAD <$vocab> INTO <$graph>"); } // Load user data $usergraph = LODrTools::get_datagraph($user); $this->store->query("LOAD <$user> INTO <$usergraph>"); } public function endpoint() { global $arc_config; $config = $arc_config + array ( 'endpoint_features' => array( 'select', 'construct', 'ask', 'describe' ) ); $ep = ARC2::getStoreEndpoint($config); $ep->go(); } } ?>