getStoreEndpoint() static public method

static public getStoreEndpoint ( $a = '', $caller = '' )
Example #1
0
 function synchro_rdf($session_id = 0, $activateEndpoint = false, $altBaseUri = '')
 {
     global $charset;
     //Pour créer des tables temporaires
     if ($session_id) {
         $this->config['store_name'] = $session_id . $this->config['store_name'];
     }
     //endpoint pour connecteurs
     if ($activateEndpoint) {
         $this->store = ARC2::getStoreEndpoint($this->config);
         $this->store->go();
     } else {
         //on initialise les tables mysql
         $this->initStore();
         if ($charset == 'utf-8') {
             mysql_query("SET NAMES 'utf8'");
         }
         //on initialise les uri
         if (trim($altBaseUri)) {
             $this->baseURI = $altBaseUri;
         }
         $this->prefix .= "\n\t\t\tPREFIX pmb: <" . $this->baseURI . ">\n\n";
         $this->baseUriConcept = $this->baseURI . "concept#";
         $this->baseUriThesaurus = $this->baseURI . "thesaurus#";
         $this->baseUriManifestation = $this->baseURI . "manifestation#";
         $this->baseUriExpression = $this->baseURI . "expression#";
         $this->baseUriOeuvre = $this->baseURI . "oeuvre#";
         $this->baseUriOeuvreBulletin = $this->baseURI . "oeuvre#fromBulletin";
         $this->baseUriAuteur = $this->baseURI . "auteur#";
         //on charge les correspondances rdf
         $this->loadMapping();
     }
     return;
 }
 /**
  * Executes endpoint action
  *
  */
 public function executeEndpoint()
 {
     require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'arc_config.php';
     /* instantiation */
     $ep = ARC2::getStoreEndpoint($arc_config);
     /* request handling */
     $ep->go();
     $this->ep = $ep;
     return sfView::NONE;
 }
 function __construct()
 {
     parent::__construct('SPARQLEndpoint');
     # Set up some stuff
     $this->sparqlendpointconfig = $this->getSPARQLEndpointConfig();
     $this->sparqlendpoint = ARC2::getStoreEndpoint($this->sparqlendpointconfig);
     $this->sparqlparser = ARC2::getSPARQLPlusParser();
     $this->store = new RDFIOARC2StoreWrapper();
     $this->user = new RDFIOUser();
     $this->requestdata = null;
 }
 public function process()
 {
     /* MySQL and endpoint configuration */
     $config = array_merge_recursive($this->storeService->getConfig(), array('endpoint_features' => array('select', 'construct', 'ask', 'describe', 'load', 'insert', 'delete', 'dump'), 'endpoint_timeout' => 60, 'endpoint_read_key' => '', 'endpoint_write_key' => 'REPLACE_THIS_WITH_SOME_KEY', 'endpoint_max_limit' => 250));
     /* instantiation */
     $ep = ARC2::getStoreEndpoint($config);
     if (!$ep->isSetUp()) {
         $ep->setUp();
         /* create MySQL tables */
     }
     /* request handling */
     $ep->go();
 }
    function __construct() {
        global $wgUser, $rdfiogQueryByOrigURI;

        parent::__construct( 'SPARQLEndpoint' );
        $this->m_sparqlendpointconfig = $this->getSPARQLEndpointConfig();
        $this->m_sparqlendpoint = ARC2::getStoreEndpoint( $this->m_sparqlendpointconfig );
        $this->m_sparqlparser = ARC2::getSPARQLPlusParser();
        $this->m_store = new RDFIOStore();

        $userrights = $wgUser->getRights();
        if ( in_array( 'edit', $userrights ) && in_array( 'createpage', $userrights ) ) {
            $this->m_haswriteaccess = true;
        } else {
            $this->m_haswriteaccess = false;
        }
        if ( in_array( 'edit', $userrights ) && in_array( 'delete', $userrights ) ) {
            $this->m_hasdeleteaccess = true;
        } else {
            $this->m_hasdeleteaccess = false;
        }
    }
<?php

// Zeige keine NOTICE Meldungen an
//error_reporting (E_ALL ^ E_NOTICE);
/* ARC2 static class inclusion */
include_once 'arc2/ARC2.php';
include_once 'response.php';
require_once './config/config.php';
/* instantiation */
$ep = ARC2::getStoreEndpoint($config);
if (!$ep->isSetUp()) {
    $ep->setUp();
    /* create MySQL tables */
}
if (!empty($_GET['url'])) {
    $origin = $_GET['url'];
    $url = str_replace("/page/", "/data/", $origin);
    $url .= ".ntriples";
    $res = extractLinkedData($url, $origin);
    print_r($res);
}
function extractLinkedData($link, $origin)
{
    global $ep;
    // Wenn es die URL im Graph schon gibt, nichts machen, TODO besser updaten?
    if (graphContainsUrl($link)) {
        $res = new Response(null, "URL {$link} already visited, skip indexing");
        return res;
    } else {
        $parser = ARC2::getTurtleParser();
        //$data = $_POST['turtle'];
Example #7
0
         error_log("DEBUG: initial RSS file does not exists", 0);
         SMOBTools::initial_rss_file();
     }
     $rssfile = fopen(FEED_FILE_PATH, 'r');
     $rss = fread($rssfile, filesize(FEED_FILE_PATH));
     fclose($rssfile);
     echo $rss;
 } elseif ($t == 'rssrdf_owner') {
     header("Content-type: text/xml");
     $tweet = new SMOBFeed();
     $tweet->rssrdf();
 } elseif ($t == 'sparql') {
     if ($_POST) {
         SMOBTools::checkAccess($_POST);
     }
     $ep = ARC2::getStoreEndpoint(SMOBTools::arc_config());
     $ep->go();
     // callback script to process the incoming hub POSTs
 } elseif ($t == 'callback') {
     if (array_key_exists('REMOTE_HOST', $_SERVER)) {
         //&& ($_SERVER['REMOTE_HOST'] == HUB_URL_SUBSCRIBE)) {
         error_log("DEBUG: request from host: " . $_SERVER['REMOTE_HOST']);
     }
     if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
         error_log("DEBUG: request from user_agent: " . $_SERVER['REMOTE_HOST']);
     }
     // Getting hub_challenge from hub after sending it post subscription
     if (isset($_GET["hub_challenge"])) {
         // send confirmation to the hub
         echo $_GET["hub_challenge"];
         error_log("DEBUG: received and sent back hub challenge:" . $_GET["hub_challenge"], 0);
function doSparqlEndpoint()
{
    global $DBCFG;
    /* Include ARC2 classes. */
    require_once T3_ABSPATH . 'common/arc2/ARC2.php';
    /* ARC2 static class inclusion */
    /* MySQL and endpoint configuration */
    $config = array('db_host' => $DBCFG["Server"], 'db_name' => $DBCFG["DBName"], 'db_user' => $DBCFG["DBLogin"], 'db_pwd' => $DBCFG["DBPass"], 'store_name' => $DBCFG["DBprefix"], 'endpoint_features' => array('select', 'construct', 'ask', 'describe', 'load'), 'endpoint_timeout' => 60, 'endpoint_read_key' => '', 'endpoint_write_key' => '', 'endpoint_max_limit' => 250);
    /* instantiation */
    $ep = ARC2::getStoreEndpoint($config);
    if (!$ep->isSetUp()) {
        $ep->setUp();
        /* create MySQL tables */
    }
    // reset the endpoint
    $ep->reset();
    // ask terms
    $sql = SQLIdTerminosValidos();
    //fetch main metadata
    $sparql_command = 'LOAD <' . $_SESSION["CFGURL"] . 'xml.php?skosMeta=1> into <' . $_SESSION["CFGURL"] . '>';
    $ep->query($sparql_command);
    while ($array = $sql->FetchRow()) {
        $i == ++$i;
        #Mantener vivo el navegador
        $time_now = time();
        if ($time_start >= $time_now + 10) {
            $time_start = $time_now;
            header('X-pmaPing: Pong');
        }
        $sparql_command = 'LOAD <' . $_SESSION["CFGURL"] . 'xml.php?skosNode=' . $array[id] . '> into <' . $_SESSION["CFGURL"] . '>';
        $ep->query($sparql_command);
    }
    //Update data about las endpoint
    $ARRAYlastUpdateEndpoint = fetchlastUpdateEndpoint();
    if ($ARRAYlastUpdateEndpoint["value"]) {
        $sql = SQL("update", " {$DBCFG['DBprefix']}values set value=now() where  value_type='DATESTAMP' and value_code='ENDPOINT_CHANGE'");
    } else {
        $sql = SQL("insert", "into {$DBCFG['DBprefix']}values (`value_type`, `value`, `value_order`, `value_code`) VALUES\r\n\t\t\t\t\t('DATESTAMP', now(), NULL, 'ENDPOINT_CHANGE')");
    }
    return array("count_nodes" => $i);
}
Example #9
0
 public function get_onto_endpoint()
 {
     foreach ($this->namespaces as $key => $uri) {
         $prefix .= "PREFIX " . $key . ": <" . $uri . ">";
     }
     if (isset($_POST['query'])) {
         $_POST['query'] = $prefix . "\n\t\t\t" . $_POST['query'];
     }
     $onto_store_config = $this->ontostore_params;
     $onto_store_config['endpoint_features'] = array('select');
     $store = ARC2::getStoreEndpoint($onto_store_config);
     $store->go();
 }