本文整理汇总了PHP中ARC2::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getStore方法的具体用法?PHP ARC2::getStore怎么用?PHP ARC2::getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getStore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct() {
parent::__construct();
global $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword, $smwgARC2StoreConfig;
/* instantiation */
$this->arc2store = ARC2::getStore( $smwgARC2StoreConfig );
}
示例2: testAddGraphToStore
public function testAddGraphToStore()
{
$storeConf = array('db_host' => 'localhost', 'db_name' => 'negtest', 'db_user' => 'negtest', 'db_pwd' => 'negtest');
$store = ARC2::getStore($storeConf);
$store->reset();
if (!$store->isSetUp()) {
$store->setUp();
}
$docNeg = $this->getDOMDocNeg();
$docNeg->setStore($store);
$docNeg->process();
$docNeg->gatherSubnegotiatorGraphs(false);
$docNeg->addGraphToStore();
$q = 'SELECT DISTINCT ?s ?p ?o WHERE { ?s ?p ?o }';
$rs = $store->query($q);
if (!$store->getErrors()) {
$rows = $rs['result']['rows'];
$this->assertEquals('http://example.org/domDoc', $rows[0]['s']);
}
$q = 'SELECT DISTINCT ?s ?p ?o WHERE { GRAPH <http://example.org/graphURI> { ?s ?p ?o } }';
$rs = $store->query($q);
if (!$store->getErrors()) {
$rows = $rs['result']['rows'];
$this->assertEquals('http://example.org/domDoc', $rows[0]['s']);
$this->assertEquals(2, count($rows));
}
$q = 'SELECT DISTINCT ?s ?p ?o WHERE { GRAPH <http://example.org/graphURIX> { ?s ?p ?o } }';
$rs = $store->query($q);
if (!$store->getErrors()) {
$rows = $rs['result']['rows'];
$this->assertEquals(0, count($rows));
}
}
示例3: connect
/**
* Connexion au store
* @return bool
*/
private function connect()
{
$this->store = ARC2::getStore($this->config);
if (!@$this->store->getDBCon()) {
//On regarde si l'on peut se connecter avec les informations fournies
$this->errors[] = "Error connexion";
return false;
} else {
if (!$this->store->isSetUp()) {
//Si les tables du store n'existent pas
$this->store->setUp();
//On crée les tables
if ($erreurs = $this->store->getErrors()) {
//Si la création à échouée
foreach ($erreurs as $value) {
$this->errors[] = $value;
}
return false;
$this->store->closeDBCon();
} else {
//Si on vient de faire la création pour pouvoir faire autre chose on doit se déconnecter et se reconnecter
$this->store->closeDBCon();
$this->store = ARC2::getStore($this->config);
}
}
}
return true;
}
示例4: __construct
public function __construct($contextURI)
{
global $config;
$this->store = ARC2::getStore($config);
$this->contextURI = $contextURI;
$this->query = "\n\nSELECT DISTINCT ?rName ?pURL ?pTitle ?lvDesc ?lvScore \nWHERE {\n\t<{$this->contextURI}> r:hasRubric ?rubric ; \nr:hasRubric ?rubric ; \n\t r:hasRecording ?rec .\n ?rubric sioc:name ?rName . \n\t?rec r:hasLineValue ?lv ;\n\t\tr:hasPage ?pURL ; \n\t\t sioc:has_creator ?recCreator . \n\t?lv r:score ?lvScore ;\n\t\tr:description ?lvDesc . \nOPTIONAL {\n\t?pURL dc:title ?pTitle . \n}\t\n}\n\n\t";
}
示例5: __construct
public function __construct($contextURIs)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
$this->uris = $contextURIs;
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
}
示例6: getStore
/**
* Get the triple store.
* @return ARC2_Store A triple store.
*/
public function getStore()
{
/** @var ARC2_Store $store */
$store = ARC2::getStore($this->getConfig());
if (!$store->isSetUp()) {
$store->setUp();
}
return $store;
}
示例7: __construct
public function __construct()
{
$ci =& get_instance();
$config = array('db_host' => $ci->db->hostname, 'db_name' => $ci->db->database, 'db_user' => $ci->db->username, 'db_pwd' => $ci->db->password, 'store_name' => rtrim($ci->db->ARC_dbprefix, '_'));
$this->store = @ARC2::getStore($config);
if (!$this->store->isSetUp()) {
$this->store->setUp();
}
$this->ns = $ci->config->item('namespaces');
}
示例8: __construct
public function __construct()
{
$this->store = ARC2::getStore($this->config);
if (!$this->store->isSetUp()) {
$this->store->setUp();
}
//$this->store->reset();
//$this->store->query('LOAD <person.rdf>');
//$this->store->query('LOAD <http://xmlns.com/foaf/0.1/>');
$this->ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'foaf' => 'http://xmlns.com/foaf/0.1/', 's' => 'http://www.w3.org/2000/01/rdf-schema#', 'view' => 'http://purl.org/aquarium/engine/MVC/', 'tal' => 'http://xml.zope.org/namespaces/tal');
}
示例9: __construct
public function __construct($vars)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
foreach ($vars as $var => $val) {
$this->{$var} = $val;
}
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
$this->setQuery();
$this->doQuery();
$this->processResultSet();
}
示例10: __construct
public function __construct($array)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
if (isset($array['uris'])) {
$this->uris = $array['uris'];
}
if (isset($array['tagURIs'])) {
$this->tagURIs = $array['tagURIs'];
}
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
}
示例11: execute
function execute($par)
{
global $wgRequest, $wgOut, $smwgARC2StoreConfig, $wgServer, $wgScriptPath, $wgUser;
if (!$this->userCanExecute($this->getUser())) {
$this->displayRestrictionError();
return;
}
$this->setHeaders();
$output = "";
# Get request data from, e.g.
$rdfioAction = $wgRequest->getText('rdfio_action');
# instantiation
$store = ARC2::getStore($smwgARC2StoreConfig);
$output .= "\n===RDF Store Setup===\n'''Status:'''\n\n";
if (!$store->isSetUp()) {
$output .= "* Store is '''not''' set up\n";
if ($rdfioAction == "setup") {
if (!$wgUser->matchEditToken($wgRequest->getText('token'))) {
die('Cross-site request forgery detected!');
} else {
if ($this->isSysop) {
$output .= "* Setting up now ...\n";
$store->setUp();
if ($store->isSetUp()) {
$output .= "* Done!\n";
} else {
$output .= "Setup failed:\n";
$store->getErrors();
}
} else {
$errorMessage = "Only sysops can perform this operation!";
$wgOut->addHTML("<pre>Permission Error: " . $errorMessage . "</pre>");
}
}
}
} else {
$output .= "* Store is already set up.\n";
}
$wgOut->addWikiText($output);
$htmlOutput = '<form method="get" action="' . $wgServer . $wgScriptPath . '/index.php/Special:RDFIOAdmin"
name="createEditQuery">
<input type="submit" name="rdfio_action" value="setup">' . Html::Hidden('token', $wgUser->getEditToken()) . '
</form>';
$wgOut->addHTML($htmlOutput);
$wgOut->addWikiText("\n===Data Sources===\n");
$wgOut->addWikiText("\n{{#ask: [[Category:RDFIO Data Source]]\n\t\t\t\t\t|?Equivalent URI\n\t\t\t\t\t|?RDFIO Import Type\n\t\t\t\t\t|format=table\n\t\t\t\t\t|mainlabel=Data Source\n\t\t\t\t\t|limit=10\n\t\t\t\t\t}}\n");
$wgOut->addWikiText("\n===Pages and Templates===\n");
$wgOut->addWikiText("To associate a template with a category, add <nowiki>[[Has template::Template:Name]]</nowiki> to the Category page");
$wgOut->addWikiText("{{#ask: [[:Category:+]]\n\t\t\t\t\t|?Equivalent URI\n\t\t\t\t\t|?Has template\n\t\t\t\t\t|format=table\n\t\t\t\t\t|mainlabel=Category\n\t\t\t\t\t|limit=10\n\t\t\t\t\t}}");
}
示例12: execute
function execute( $par ) {
global $wgRequest, $wgOut, $smwgARC2StoreConfig,
$wgServer, $wgScriptPath, $wgUser;
$this->setHeaders();
$output = "";
# Get request data from, e.g.
$rdfio_action = $wgRequest->getText( 'rdfio_action' );
# instantiation
$store = ARC2::getStore( $smwgARC2StoreConfig );
$output .= "\n===RDF Store Setup===\n'''Status:'''\n\n";
if ( !$store->isSetUp() ) {
$output .= "* Store is '''not''' set up\n";
if ( $rdfio_action == "setup" ) {
if ( !$wgUser->matchEditToken( $wgRequest->getText( 'token' ) ) ) {
die( 'Cross-site request forgery detected!' );
} else {
if ( $this->m_issysop ) {
$output .= "* Setting up now ...\n";
$store->setUp();
$output .= "* Done!\n";
} else {
$errormessage = "Only sysops can perform this operation!";
$wgOut->addHTML( RDFIOUtils::formatErrorHTML( "Permission Error", $errormessage ) );
}
}
}
} else {
$output .= "* Store is already set up.\n";
}
$wgOut->addWikiText( $output );
$htmlOutput = '<form method="get" action="' . $wgServer . $wgScriptPath . '/index.php/Special:ARC2Admin"
name="createEditQuery">
<input type="submit" name="rdfio_action" value="setup">' .
Html::Hidden( 'token', $wgUser->editToken() ) . '
</form>';
$wgOut->addHTML( $htmlOutput );
}
示例13: createStore
function createStore($host, $name, $user, $pwd, $store_name)
{
include_once dirname(__FILE__) . '/../lib/arc/ARC2.php';
$config = array('db_host' => $host, 'db_name' => $name, 'db_user' => $user, 'db_pwd' => $pwd, 'store_name' => $store_name);
$store = ARC2::getStore($config);
if (!$store->isSetUp()) {
$store->setUp();
print "<p>Database correctly set-up.</p>";
} else {
print "<p>The store was already set up.</p>";
}
// write databsed information in the config file
$config = "<?php\n\ninclude_once(dirname(__FILE__).'/../lib/arc/ARC2.php');\ninclude_once(dirname(__FILE__).'/../lib/xmlrpc/lib/xmlrpc.inc');\n\ndefine('DB_HOST', '{$host}');\ndefine('DB_NAME', '{$name}');\ndefine('DB_USER', '{$user}');\ndefine('DB_PASS', '{$pwd}');\ndefine('DB_STORE', '{$store_name}');\n\t\n";
$f = fopen(dirname(__FILE__) . '/../config/config.php', 'w');
fwrite($f, $config);
fclose($f);
}
示例14: execute
public function execute()
{
global $smwgARC2StoreConfig;
# Get ARC2 Store
$store = ARC2::getStore($smwgARC2StoreConfig);
if (!$store->isSetUp()) {
echo "ARC2 Store is NOT setup, so setting up now ... ";
$store->setUp();
if ($store->isSetUp()) {
echo "Done!\n";
} else {
echo "Setup failed with the following errors reported by the ARC2 library:\n";
echo $store->getErrors();
exit(1);
}
} else {
echo "Store is already set up, so not doing anything.\n";
}
}
示例15: createStore
function createStore()
{
global $DEBUG;
$host = urldecode($_GET['host']);
$name = $_GET['name'];
$user = $_GET['user'];
$pwd = $_GET['pwd'];
$store_name = $_GET['store'];
print "<p>";
$config = array('db_host' => $host, 'db_name' => $name, 'db_user' => $user, 'db_pwd' => $pwd, 'store_name' => $store_name);
$store = ARC2::getStore($config);
if (!$store->isSetUp()) {
print "Setting up the store...";
$store->setUp();
print "Done.";
} else {
print "The store was already set up.";
}
print "\n<p>Now just paste the following snippet into the file <code>config.php</code>,\nmaking sure that <code><?php</code> is the first line:\n</p>\n<pre>\n<?php\n\ninclude_once(dirname(__FILE__).'/arc/ARC2.php'); // path to the file ARC2.php\n\n// SQL database configuration for storing the postings:\n\$arc_config = array(\n /* MySQL database settings */\n 'db_host' => '{$host}',\n 'db_user' => '{$user}',\n 'db_pwd' => '{$pwd}',\n 'db_name' => '{$name}',\n\n /* ARC2 store settings */\n 'store_name' => '{$store_name}',\n\n /* SPARQL endpoint settings */\n 'endpoint_features' => array(\n 'select', 'construct', 'ask', 'describe', // allow read\n 'load', 'insert', 'delete', // allow update\n 'dump' // allow backup\n ),\n 'endpoint_timeout' => 60, /* not implemented in ARC2 preview */\n 'endpoint_read_key' => '', /* optional */\n 'endpoint_write_key' => '', /* optional */\n 'endpoint_max_limit' => 250, /* optional */\n);\n</pre>";
}