コード例 #1
0
 function runQuery($infos)
 {
     $infos['query']['limit'] = 1;
     $this->infos = $infos;
     $this->buildResultVars();
     return parent::runQuery($this->infos);
 }
コード例 #2
0
 function runQuery($infos)
 {
     $ids = $infos['query']['result_iris'];
     if ($vars = $infos['query']['result_vars']) {
         $sub_r = parent::runQuery($infos);
         $rf = $this->v('result_format', '', $infos);
         if (in_array($rf, array('sql', 'structure', 'index'))) {
             return $sub_r;
         }
         $rows = $this->v('rows', array(), $sub_r);
         foreach ($rows as $row) {
             foreach ($vars as $info) {
                 $val = isset($row[$info['var']]) ? $row[$info['var']] : '';
                 if ($val && $row[$info['var'] . ' type'] != 'literal' && !in_array($val, $ids)) {
                     $ids[] = $val;
                 }
             }
         }
     }
     $this->r = array();
     $this->described_ids = array();
     $this->ids = $ids;
     $this->added_triples = array();
     $is_sub_describe = 0;
     while ($this->ids) {
         $id = $this->ids[0];
         $this->described_ids[] = $id;
         if ($this->detect_labels) {
             $q = '
       CONSTRUCT { 
         <' . $id . '> ?p ?o . 
         ?o ?label_p ?o_label . 
         ?o <http://arc.semsol.org/ns/arc#label> ?o_label .
       } WHERE { 
         <' . $id . '> ?p ?o .
         OPTIONAL {
           ?o ?label_p ?o_label .
           FILTER REGEX(str(?label_p), "(name|label|title|summary|nick|fn)$", "i") 
         }
       }
     ';
         } else {
             $q = '
       CONSTRUCT { 
         <' . $id . '> ?p ?o . 
       } WHERE { 
         <' . $id . '> ?p ?o .
       }
     ';
         }
         $sub_r = $this->store->query($q);
         $sub_index = is_array($sub_r['result']) ? $sub_r['result'] : array();
         $this->mergeSubResults($sub_index, $is_sub_describe);
         $is_sub_describe = 1;
     }
     return $this->r;
 }
 function runQuery($infos)
 {
     $this->infos = $infos;
     $this->buildResultVars();
     $this->infos['query']['distinct'] = 1;
     $sub_r = parent::runQuery($this->infos);
     $rf = $this->v('result_format', '', $infos);
     if (in_array($rf, array('sql', 'structure', 'index'))) {
         return $sub_r;
     }
     return $this->getResultIndex($sub_r);
 }