コード例 #1
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);
}
コード例 #2
0
 function getHTMLDocBody()
 {
     //DAF DATE of last update endpoint
     $ARRAYlastUpdateEndpoint = fetchlastUpdateEndpoint();
     return '
 	<body>
     <h1>' . $this->getHTMLDocHeading() . '</h1>
     <div class="intro">
       <p>
         <a href="?">This interface</a> implements 
         <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL</a> and
         <a href="https://github.com/semsol/arc2/wiki/SPARQL%2B">SPARQL+</a> via <a href="http://www.w3.org/TR/rdf-sparql-protocol/#query-bindings-http">HTTP Bindings</a>. 
       </p>
       <p>
         Enabled operations: ' . join(', ', $this->getFeatures()) . '
       </p>
       <p>
         ' . MSG__dateUpdatedEndpoint . ': ' . $ARRAYlastUpdateEndpoint["value"] . '
       </p>
       <p>
         Max. number of results : ' . $this->v('endpoint_max_limit', '<em>unrestricted</em>', $this->a) . '
       </p>
     </div>
     ' . $this->getHTMLDocForm() . '
     ' . ($this->p('show_inline') ? $this->query_result : '') . '
 	</body>
 ';
 }
コード例 #3
0
function HTMLformUpdateEndpoit()
{
    $ARRAYlastUpdateEndpoint = fetchlastUpdateEndpoint();
    $msg_update = $ARRAYlastUpdateEndpoint["value"] ? '<br/>' . MSG__dateUpdatedEndpoint . ': ' . $ARRAYlastUpdateEndpoint["value"] . '.' : '';
    $rows .= '<form class="" role="form" name="updateEndpoint" action="admin.php" method="post">';
    $rows .= '	<div class="row">
	    <div class="col-sm-12">
	        <legend>' . ucfirst(LABEL_updateEndpoint) . '</legend>
	    </div>
	    <!-- panel  -->

	    <div class="col-lg-7">
			<p class="alert alert-warning" role="alert">' . MSG__updateEndpoint . ' ' . $msg_update . '</p>
	        <div class="panel panel-default">
	            <div class="panel-body form-horizontal">';
    $rows .= '<div class="form-group">
													<div class="col-sm-12 text-center">
													<input type="submit" class="btn btn-primary" id="boton" name="boton" value="' . ucfirst(LABEL_actualizar) . '"/>
													 <a href="index.php" class="btn btn-default" id="boton_cancelar" title="' . ucfirst(LABEL_Cancelar) . '">' . ucfirst(LABEL_Cancelar) . '</a>
													</div>
											</div>';
    $rows .= '				</div>
											</div>
									</div>';
    $rows .= '</div> <!-- / panel  -->';
    $rows .= '<input type="hidden" name="doAdmin" id="doAdmin" value="updateEndpointNow"/>';
    $rows .= '</form>';
    return $rows;
}