Lines Matching refs:type

24         'type'      => '(?:\[\s*[a-z0-9]+\s*(?:::[^\]]*)?\])',
37 'type' => array('\[\s*([a-z0-9]+)\s*(?:::([^\]]*))?\]', array('type', 'hint')),
54 * Extracts information from a fragment, based on the type.
173 * @param type string the type of the variable
174 * @param hint string the type hint of the variable
176 function updateTypemap(&$typemap, $var, $type, $hint=null) {
177 if(empty($typemap[$var]) && $type) {
178 $typemap[$var] = array('type'=>$type,'hint'=>$hint);
189 return array('type'=>'literal', 'text'=>$val);
197 return array('type'=>'variable', 'text'=>$var);
216 * @param typemap array the type information collected so far
224 'type'=>'select',
349 * @param typemap array the type information
388 'type'=>'and',
401 'type'=>'optional',
415 if($f['lhs']['type'] == 'variable' && !in_array($f['lhs']['text'], $scope)) {
418 if($f['rhs']['type'] == 'variable' && !in_array($f['rhs']['text'], $scope)) {
424 'type'=>'filter',
436 'type'=>'minus',
450 * @param typemap array the type information
474 'type'=>'union',
488 * @param typemap array the type information
507 if(preg_match("/^({$p->variable}|{$p->reflit})\s+({$p->variable}|{$p->predicate})\s*({$p->type})?\s*:\s*({$p->any})$/S",$line,$match)) {
508 list(, $subject, $predicate, $type, $object) = $match;
533 // match a proper type variable
534 if(preg_match("/^({$p->variable})\s*({$p->type})?$/",$object,$captures)!=1) {
544 // try direct type first, implied type second
545 $vtype = $p->type($vtype);
546 $type = $p->type($type);
547 if (isset ($type))
549 $this->updateTypemap($typemap, $object['text'], $vtype->type, $vtype->hint);
550 $this->updateTypemap($typemap, $object['text'], $type->type, $type->hint);
557 if(!$type) {
558 list($type, $hint) = $this->util->getDefaultType();
560 $type = $p->type($type);
561 $hint = $type->hint;
562 $type = $type->type;
564 $type = $this->util->loadType($type);
565 $object = $this->literal($type->normalize($object,$hint));
568 $triples[] = array('type'=>'triple','subject'=>$subject, 'predicate'=>$predicate, 'object'=>$object);
571 } elseif(preg_match("/^({$p->variable})\s*({$p->type})?\s*({$p->operator})\s*({$p->variable})\s*({$p->type})?$/S",$line, $match)) {
579 // do type information propagation
580 $rtype = $p->type($rtype);
581 $ltype = $p->type($ltype);
584 // left has a defined type, so update the map
585 $this->updateTypemap($typemap, $lhs['text'], $ltype->type, $ltype->hint);
589 $this->updateTypemap($typemap, $rhs['text'], $ltype->type, $lhint->hint);
593 // right has a defined type, so update the map
594 $this->updateTypemap($typemap, $rhs['text'], $rtype->type, $rtype->hint);
598 $this->updateTypemap($typemap, $lhs['text'], $rtype->type, $rtype->hint);
602 $filters[] = array('type'=>'filter', 'lhs'=>$lhs, 'operator'=>$operator, 'rhs'=>$rhs, '_line'=>$lineNode);
605 } elseif(preg_match("/^({$p->variable})\s*({$p->type})?\s*({$p->operator})\s*({$p->any})$/S",$line, $match)) {
612 // update typemap if a type was defined
613 list($type,$hint) = $p->type($ltype);
614 if($type) {
615 $this->updateTypemap($typemap, $lhs['text'],$type,$hint);
617 // use the already declared type if no type was defined
621 list($type, $hint) = $this->util->getDefaultType();
630 // special case: the right hand side of the 'in' operator always normalizes with the 'text' type
633 $type = 'text';
638 $type = $this->util->loadType($type);
639 $rhs = $this->literal($type->normalize($rhs,$hint));
641 $filters[] = array('type'=>'filter','lhs'=>$lhs, 'operator'=>$operator, 'rhs'=>$rhs, '_line'=>$lineNode);
644 } elseif(preg_match("/^({$p->any})\s*({$p->operator})\s*({$p->variable})\s*({$p->type})?$/S",$line, $match)) {
649 // update typemap if a type was defined
650 list($type, $hint) = $p->type($rtype);
651 if($type) {
652 $this->updateTypemap($typemap, $rhs['text'],$type,$hint);
654 // use the already declared type if no type was defined
658 list($type, $hint) = $this->util->getDefaultType();
667 // special case: the left hand side of the 'in' operator always normalizes with the 'page' type
670 $type = 'page';
675 $type = $this->util->loadType($type);
676 $lhs = $this->literal($type->normalize($lhs,$hint));
678 $filters[] = array('type'=>'filter','lhs'=>$lhs, 'operator'=>$operator, 'rhs'=>$rhs, '_line'=>$lineNode);
721 if(preg_match("/^({$p->variable})\s*({$p->aggregate})?\s*({$p->type})?(?:\s*(:)\s*({$p->any})?\s*)?$/S",$line, $match)) {
726 list($type,$hint) = $p->type($vtype);
729 $this->updateTypemap($typemap, $variable, $type, $hint);
730 $result[] = array('variable'=>$variable,'caption'=>$caption, 'aggregate'=>$agg, 'aggregateHint'=>$agghint, 'type'=>$type, 'hint'=>$hint);
747 if(preg_match_all("/\s*({$p->variable})\s*({$p->aggregate})?\s*({$p->type})?\s*(?:(\")([^\"]*)\")?/",$line,$match, PREG_SET_ORDER)) {
756 list($type, $hint) = $p->type($vtype);
759 $this->updateTypemap($typemap, $variable, $type, $hint);
760 $result[] = array('variable'=>$variable,'caption'=>$caption, 'aggregate'=>$agg, 'aggregateHint'=>$agghint, 'type'=>$type, 'hint'=>$hint);
775 return "(?:\s*{$p->variable}\s*{$p->aggregate}?\s*{$p->type}?".($captions?'\s*(?:"[^"]*")?':'').")";