public function getMatchingStatements(Statement $statement, Node $graph = null, array $options = [])
    {
        if (null !== $graph) {
            $graphUri = $graph->getUri();

        // no graph information given, use default graph
        } elseif (null === $graph && null === $statement->getGraph()) {
            $graphUri = 'http://saft/defaultGraph/';

        // no graph given, use graph information from $statement
        } elseif (null === $graph && $statement->getGraph()->isNamed()) {
            $graphUri = $statement->getGraph()->getUri();

        // no graph given, use graph information from $statement
        } elseif (null === $graph && false == $statement->getGraph()->isNamed()) {
            $graphUri = 'http://saft/defaultGraph/';
        }

        if (false == isset($this->statements[$graphUri])) {
            $this->statements[$graphUri] = [];
        }

        // if not default graph was requested
        if ('http://saft/defaultGraph/' != $graphUri) {
            return new StatementSetResultImpl($this->statements[$graphUri]);

        // if default graph was requested, return matching statements from all graphs
        } else {
            $_statements = [];

            foreach ($this->statements as $graphUri => $statements) {
                foreach ($statements as $statement) {
                    if ('http://saft/defaultGraph/' == $graphUri) {
                        $graph = null;
                    } else {
                        $graph = $this->nodeFactory->createNamedNode($graphUri);
                    }

                    $_statements[] = $this->statementFactory->createStatement(
                        $statement->getSubject(),
                        $statement->getPredicate(),
                        $statement->getObject(),
                        $graph
                    );
                }
            }

            return new StatementSetResultImpl($_statements);
        }
    }