/** * Add where parts to qb * @param array $frame * @param QueryBuilder $qb */ protected function fillWhere($frame, $qb) { $constructUnionWhere = array(''); foreach ($frame as $prop => $val) { if ($prop === '@type') { $qb->andWhere("?uri a " . $val); } // union for optional trick if (substr($prop, 0, 1) !== '@' && is_array($val)) { $uriChild = '?c' . ++$this->varCounter; $constructUnionWhere[] = "?uri {$prop} " . $this->addChild($val, $uriChild); } } if (count($constructUnionWhere) > 1) { $qb->addUnion($constructUnionWhere); } }