当前位置: 首页>>代码示例>>PHP>>正文


PHP ARC2::getSPARQLPlusParser方法代码示例

本文整理汇总了PHP中ARC2::getSPARQLPlusParser方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getSPARQLPlusParser方法的具体用法?PHP ARC2::getSPARQLPlusParser怎么用?PHP ARC2::getSPARQLPlusParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ARC2的用法示例。


在下文中一共展示了ARC2::getSPARQLPlusParser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBlockUpdateWithoutGraph

 public function testBlockUpdateWithoutGraph()
 {
     global $prefixSparql, $graph1;
     $q = $prefixSparql . " \n\t\t\tINSERT DATA { \n\t\t\t\ta:A b:Name \"Test2\" . \n    \t\t}";
     $p = ARC2::getSPARQLPlusParser();
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     $err = $p->getErrors();
     if ($err) {
         print_r($err);
         $this->assertTrue(true);
     } else {
         $this->assertTrue(false);
     }
     $q = $prefixSparql . " \n\t\t\tDELETE DATA { \n\t\t\t\ta:A b:Name \"Test2\" . \n    \t\t}";
     $p = ARC2::getSPARQLPlusParser();
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     $err = $p->getErrors();
     if ($err) {
         print_r($err);
         $this->assertTrue(true);
     } else {
         $this->assertTrue(false);
     }
 }
开发者ID:BorderCloud,项目名称:arc2,代码行数:28,代码来源:ARC2_SPARQLParserTest.php

示例2: __construct

 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;
 }
开发者ID:rdfio,项目名称:RDFIO,代码行数:11,代码来源:SpecialSPARQLEndpoint_body.php

示例3: __construct

    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;
        }
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:21,代码来源:SpecialSPARQLEndpoint_body.php

示例4: query

 /**
  * This function parse a SPARQL query, send the query and parse the SPARQL result in a array. 
  * You can custom the result with the parameter $result_format : 
  * <ul>
  * <li>rows to return array of results
  * <li>row to return array of first result
  * <li>raw to return boolean for request ask, insert and delete
  * </ul>
  * @param string $q : Query SPARQL 
  * @param string $result_format : Optional,  rows, row or raw
  * @return array|boolean in function of parameter $result_format
  * @access public
  */
 public function query($q, $result_format = '')
 {
     if ($this->_debug) {
         print date('Y-m-d\\TH:i:s\\Z', time()) . ' : ' . $q . '' . "\n\n";
     }
     $p = ARC2::getSPARQLPlusParser();
     $p->parse($q);
     $infos = $p->getQueryInfos();
     $t1 = ARC2::mtime();
     if (!($errs = $p->getErrors())) {
         $qt = $infos['query']['type'];
         $r = array('query_type' => $qt, 'result' => $this->runQuery($q, $qt, $infos));
     } else {
         $r = array('result' => '');
         if ($this->_debug) {
             print date('Y-m-d\\TH:i:s\\Z', time()) . ' : ERROR ' . $q . '' . "\n\n";
             print_r($errs);
         }
         return $this->_arc2_RemoteStore->addError($p->getErrors());
     }
     $t2 = ARC2::mtime();
     $r['query_time'] = $t2 - $t1;
     /* query result */
     if ($result_format == 'raw') {
         return $r['result'];
     }
     if ($result_format == 'rows') {
         return $this->_arc2_RemoteStore->v('rows', array(), $r['result']);
     }
     if ($result_format == 'row') {
         if (!isset($r['result']['rows'])) {
             return array();
         }
         return $r['result']['rows'] ? $r['result']['rows'][0] : array();
     }
     return $r;
 }
开发者ID:BorderCloud,项目名称:4store-php,代码行数:50,代码来源:Endpoint.php


注:本文中的ARC2::getSPARQLPlusParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。