{@inheritdoc}

@param FlowQuery $flowQuery
@param array $arguments
@return void
@throws FizzleException
@throws \Neos\Eel\Exception
420
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $subject = $arguments[0];
        if (!isset($subject) || empty($subject)) {
            $flowQuery->setContext([]);
            return;
        }

        $filteredContext = [];
        $context = $flowQuery->getContext();
        if (is_string($subject)) {
            foreach ($context as $contextElement) {
                $contextElementQuery = new FlowQuery([$contextElement]);
                $contextElementQuery->pushOperation('children', $arguments);
                if ($contextElementQuery->count() > 0) {
                    $filteredContext[] = $contextElement;
                }
            }
        } else {
            if ($subject instanceof FlowQuery) {
                $elements = $subject->get();
            } elseif ($subject instanceof \Traversable) {
                $elements = iterator_to_array($subject);
            } elseif (is_object($subject)) {
                $elements = [$subject];
            } elseif (is_array($subject)) {
                $elements = $subject;
            } else {
                throw new FizzleException('supplied argument for has operation not supported', 1332489625);
            }
            foreach ($elements as $element) {
                if ($element instanceof TraversableNodeInterface) {
                    $parentsQuery = new FlowQuery([$element]);
                    foreach ($parentsQuery->parents([])->get() as $parent) {
                        /** @var TraversableNodeInterface $parent */
                        foreach ($context as $contextElement) {
                            /** @var TraversableNodeInterface $contextElement */
                            if ($contextElement === $parent) {
                                $filteredContext[] = $contextElement;
                            }
                        }
                    }
                }
            }
            $filteredContext = array_unique($filteredContext);
        }

        $flowQuery->setContext($filteredContext);
    }
108654
public function pushQuery($q, $p = array())
    {
        if (!is_array($p)) {
            throw new CommandException('Cypher query parameters should be of type array or null');
        }
        $this->statements[] = array(
            'statement' => $q,
            'parameters' => $p,
        );

        return $this;
    }
1322595
protected function branchFlowCheck(FlowInterface $flow)
    {
        if (
            // this flow has parent already
            $flow->hasParent() ||
            // adding root flow in itself
            $this->getRootFlow($flow)->getId() === $this->getRootFlow($this)->getId()
        ) {
            throw new NodalFlowException('Cannot reuse Flow within Branches', 1, null, [
                'flowId'             => $this->getId(),
                'BranchFlowId'       => $flow->getId(),
                'BranchFlowParentId' => $flow->hasParent() ? $flow->getParent()->getId() : null,
            ]);
        }
    }
210310
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        if (count($flowQuery->getContext()) === 0) {
            return;
        }

        if (!isset($arguments[0]) || empty($arguments[0])) {
            if ($flowQuery->peekOperationName() === 'filter') {
                $filterOperation = $flowQuery->popOperation();
                if (count($filterOperation['arguments']) === 0 || empty($filterOperation['arguments'][0])) {
                    throw new FizzleException('Filter() needs arguments if it follows an empty children(): children().filter()', 1332489382);
                }
                $selectorAndFilter = $filterOperation['arguments'][0];
            } else {
                throw new FizzleException('children() needs at least a Property Name filter specified, or must be followed by filter().', 1332489399);
            }
        } else {
            $selectorAndFilter = $arguments[0];
        }

        $parsedFilter = FizzleParser::parseFilterGroup($selectorAndFilter);

        if (count($parsedFilter['Filters']) === 0) {
            throw new FizzleException('filter needs to be specified in children()', 1332489416);
        } elseif (count($parsedFilter['Filters']) === 1) {
            $filter = $parsedFilter['Filters'][0];

            if (isset($filter['PropertyNameFilter'])) {
                $this->evaluatePropertyNameFilter($flowQuery, $filter['PropertyNameFilter']);
                if (isset($filter['AttributeFilters'])) {
                    foreach ($filter['AttributeFilters'] as $attributeFilter) {
                        $flowQuery->pushOperation('filter', [$attributeFilter['text']]);
                    }
                }
            } elseif (isset($filter['AttributeFilters'])) {
                throw new FizzleException('children() must have a property name filter and cannot only have an attribute filter.', 1332489432);
            }
        } else {
            throw new FizzleException('children() only supports a single filter group right now, i.e. nothing of the form "filter1, filter2"', 1332489489);
        }
    }
1007056
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $output = [];
        $outputNodePaths = [];

        $filter = isset($arguments[0]) ? $arguments[0] : null;

        /** @var NodeInterface $contextNode */
        foreach ($flowQuery->getContext() as $contextNode) {
            /** @var NodeInterface $childNode */
            foreach ($contextNode->getChildNodes($filter) as $childNode) {
                if (!isset($outputNodePaths[$childNode->getPath()])) {
                    $output[] = $childNode;
                    $outputNodePaths[$childNode->getPath()] = true;
                }
            }
        }
        $flowQuery->setContext($output);
    }
271676
private function waterfall (array $tasks, array $args)
    {
        $index = 0;

        $next = function () use (&$index, &$tasks, &$next, &$args) {
            if ($index == count($tasks)) { 
                return;
            }
            
            $callback = $this->callOnce(function () use (&$next) {
                $next();
            });

            $tasks[$index++]($callback, ...$args);
        };

        $next();
    }
432323
function runQuery(client, queryString, args, callback) {
  if (activeBackend === 'mysql') {
    queryString = queryString.replace(/\$\d+/, '?');
  }

  client.query(queryString, args, function (err, result) {
    if (err) {
      callback(err, null);
      return;
    }
    if (activeBackend === 'mysql') {
      callback(err, result);
    }
    else if (activeBackend === 'pgsql') {
      var rows = [];
      if (result.rows) {
        rows = result.rows;
      }
      callback(err, rows);
    }
  });
}
1078424
public static <T> void invoke(List<QueryExprMeta> queries,
                                  QueryExprInvoker<T> invoker,
                                  ExprApplier<T> exprApplier) {
        for (QueryExprMeta expr : queries) {
            exprApplier.apply(invoker.invoke(expr));
        }
    }
1132294
public function suggestQuery($arguments)
    {
        $this->query = $this->getConnection()->createSuggester();
        $results = [];
        if (array_key_exists('q', $arguments)) {
            $this->query->setQuery($arguments['q']);
            if ($arguments['dictionary']) {
                $this->query->setDictionary($arguments['dictionary']);
            }

            $this->addFacetFilters($arguments);
            $solrResults = $this->getConnection()->execute($this->query)->getResults();
            foreach ($solrResults as $suggestions) {
                $results = array_merge($results, $suggestions->getSuggestions());
            }
        } else {
            // TODO: Error message in JSON?
        }

        return $results;
    }
524814
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $output = [];
        $outputNodeAggregateIdentifiers = [];
        foreach ($flowQuery->getContext() as $contextNode) {
            $parentNodes = $this->getParents($contextNode);
            if (isset($arguments[0]) && !empty($arguments[0] && isset($parentNodes[0]))) {
                $untilQuery = new FlowQuery([$parentNodes[0]]);
                $untilQuery->pushOperation('closest', [$arguments[0]]);
                $until = $untilQuery->get();
            }

            if (isset($until) && is_array($until) && !empty($until) && isset($until[0])) {
                $parentNodes = $this->getNodesUntil($parentNodes, $until[0]);
            }

            foreach ($parentNodes as $parentNode) {
                if ($parentNode !== null && !isset($outputNodeAggregateIdentifiers[(string)$parentNode->getNodeAggregateIdentifier()])) {
                    $outputNodeAggregateIdentifiers[(string)$parentNode->getNodeAggregateIdentifier()] = true;
                    $output[] = $parentNode;
                }
            }
        }

        $flowQuery->setContext($output);

        if (isset($arguments[1]) && !empty($arguments[1])) {
            $flowQuery->pushOperation('filter', $arguments[1]);
        }
    }
1334634
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $context = $flowQuery->getContext();
        if ($context instanceof \Iterator) {
            $context = iterator_to_array($context);
        }
        if (isset($arguments[0]) && isset($arguments[1])) {
            $context = array_slice($context, (integer)$arguments[0], (integer)$arguments[1] - (integer)$arguments[0]);
        } elseif (isset($arguments[0])) {
            $context = array_slice($context, (integer)$arguments[0]);
        }

        $flowQuery->setContext($context);
    }
171758
public function displayQueries(array $queries = array(), $useColor = false, $useTemplate = false)
    {
        if (!$this->output) {
            throw new \RuntimeException('No output is defined');
        }
        $this->formatQueries($queries, $useColor);

        if ($useTemplate) {
            $content = $this->templateParser->parse($queries)->getContent();
        } else {

            $content = implode('', $queries);
        }

        $this->output->write($content);
    }
1029192
protected function multiQuery(string $queries): void
  {
    if ($this->logQueries)
    {
      $time0 = microtime(true);

      $tmp = $this->mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException($this->mysqli->errno, $this->mysqli->error, $queries);
      }

      $this->queryLog[] = ['query' => $queries, 'time' => microtime(true) - $time0];
    }
    else
    {
      $tmp = $this->mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException($this->mysqli->errno, $this->mysqli->error, $queries);
      }
    }
  }
1268891
private function combine(array $args, $by)
    {
        $args = $this->arrayFlatten($args);

        if (count($args) < 1) {
            throw new QueryException(
                "The expression '{$by}' expected at least 1 argument but none provided."
            );
        }

        if (count($args) === 1) {
            return $args[0];
        }

        return '( ' . implode($by, $args) . ' )';
    }
1201988
public function executeCommand(array $arguments, $processBuilderCallback = null)
    {
        $processBuilder = clone $this->processBuilder;
        $processBuilder->setArguments($arguments);

        if (is_callable($processBuilderCallback)) {
            $processBuilderCallback($processBuilder);
        }

        $process = $processBuilder->getProcess();
        $process->run();

        if (!$process->isSuccessful()) {
            if (127 === $process->getExitCode()) {
                throw new ExecutableNotFoundException($process);
            }

            throw new ProcessFailedException($process);
        }

        return $process;
    }
787156
def AckFlowProcessingRequests(self, requests, cursor=None):
    """"""
    if not requests:
      return

    query = "DELETE FROM flow_processing_requests WHERE "

    conditions = []
    args = []
    for r in requests:
      conditions.append(
          "(client_id=%s AND flow_id=%s AND timestamp=FROM_UNIXTIME(%s))")
      args.append(db_utils.ClientIDToInt(r.client_id))
      args.append(db_utils.FlowIDToInt(r.flow_id))
      args.append(mysql_utils.RDFDatetimeToTimestamp(r.timestamp))

    query += " OR ".join(conditions)
    cursor.execute(query, args)
58116
public function evaluate(FlowQuery $flowQuery, array $arguments)
    {
        $output = [];
        foreach ($flowQuery->getContext() as $element) {
            $output[] = $element;
        }
        if (isset($arguments[0])) {
            if (is_array($arguments[0]) || $arguments[0] instanceof \Traversable) {
                foreach ($arguments[0] as $element) {
                    $output[] = $element;
                }
            } else {
                $output[] = $arguments[0];
            }
        }
        $flowQuery->setContext($output);
    }