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


PHP Convert::array_copy方法代码示例

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


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

示例1: queryFile

 public static function queryFile($modelFile, $e, &$rPointer, &$fPointer)
 {
     global $conf;
     global $lodspk;
     global $results;
     global $firstResults;
     global $uri;
     $data = array();
     $strippedModelFile = str_replace('endpoint.', '', str_replace('.query', '', $modelFile));
     if (!is_dir($modelFile)) {
         require_once $conf['home'] . 'lib/Haanga/lib/Haanga.php';
         Haanga::configure(array('cache_dir' => $conf['home'] . 'cache/', 'autoescape' => FALSE));
         //Haanga supports the dot (.) convention only for objects
         if (is_array($lodspk)) {
             $lodspkObj = Convert::array_to_object($lodspk);
             $lodspk = $lodspkObj;
         }
         $r2 = Convert::array_copy($results);
         $models = Convert::array_to_object($r2);
         $f2 = Convert::array_copy($firstResults);
         $first = Convert::array_to_object($f2);
         $vars = compact('uri', 'lodspk', 'conf', 'models', 'first');
         $q = file_get_contents($modelFile);
         if ($q == false) {
             HTTPStatus::send500("<br/>I can't load " . $modelFile . " in " . getcwd());
         }
         $fnc = Haanga::compile($q);
         $query = $fnc($vars, TRUE);
         if (is_object($lodspk)) {
             $lodspkObj = Convert::object_to_array($lodspk);
             $lodspk = $lodspkObj;
         }
         $query = Utils::addPrefixes($query);
         if ($lodspk['transform_select_query'] == true) {
             include_once $conf['home'] . 'lib/arc2/ARC2.php';
             $parser = ARC2::getSPARQLParser();
             $parser->parse($query);
             $sparqlConstruct = array();
             if (!$parser->getErrors()) {
                 $resultVars = array();
                 $q_infos = $parser->getQueryInfos();
                 foreach ($q_infos['query']['result_vars'] as $v) {
                     if ($v['type'] == 'var') {
                         $resultVars[$v['value']] = 1;
                     }
                 }
                 $x = Utils::extractObj($q_infos['query']['pattern']);
                 foreach ($x as $v) {
                     if ($resultVars[$v['s']] && $v['s_type'] == 'var' || $resultVars[$v['p']] && $v['p_type'] == 'var' || $resultVars[$v['o']] && $v['o_type'] == 'var') {
                         array_push($sparqlConstruct, $v);
                     }
                 }
                 $construct = "";
                 foreach ($sparqlConstruct as $v) {
                     if ($v['s_type'] == 'uri') {
                         $construct .= "<" . $v['s'] . "> ";
                     } elseif ($v['s_type'] == 'var') {
                         $construct .= '?' . $v['s'] . ' ';
                     } else {
                         $construct .= $v['s'] . " ";
                     }
                     if ($v['p_type'] == 'uri') {
                         $construct .= "<" . $v['p'] . "> ";
                     } elseif ($v['p_type'] == 'var') {
                         $construct .= '?' . $v['p'] . ' ';
                     } else {
                         $construct .= $v['p'] . " ";
                     }
                     if ($v['o_type'] == 'uri') {
                         $construct .= "<" . $v['o'] . "> ";
                     } elseif ($v['o_type'] == 'literal') {
                         $construct .= '"' . $v['o'] . '" ';
                     } elseif ($v['o_type'] == 'var') {
                         $construct .= '?' . $v['o'] . ' ';
                     } else {
                         $construct .= $v['o'] . " ";
                     }
                     $construct .= ".\n";
                 }
                 if ($construct == "") {
                     if (sizeof($q_infos['query']['result_vars']) > 0) {
                         //For now, assuming variables are in the GRAPH ?g
                         $query = "CONSTRUCT {?g ?x ?y} WHERE{GRAPH ?g{?g ?x ?y}}";
                     } else {
                         if (!preg_match('/construct/i', $query)) {
                             HTTPStatus::send500();
                         }
                     }
                 } else {
                     $query = preg_replace('/select\\s*[^{]*\\s*(where)?\\s*{/i', 'CONSTRUCT {' . $construct . '} WHERE{', $query);
                 }
             } else {
                 return;
                 //HTTPStatus::send500("invalid query: " . var_export($parser->getErrors(), true)."\n\nQUERY:\n".$query);
             }
         }
         if ($conf['debug']) {
             Logging::log($modelFile . " against " . $e->getSparqlUrl());
             Logging::log($query);
             Logging::log("Running query from " . $modelFile . " on endpoint " . $e->getSparqlURL(), E_USER_NOTICE);
//.........这里部分代码省略.........
开发者ID:OpenDataServices,项目名称:lodspeakr,代码行数:101,代码来源:Utils.php


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