def query(self, query_object, processor='sparql',
              result='sparql', initNs=None, initBindings=None,
              use_store_provided=True, **kwargs):
        """
        Query this graph.

        A type of 'prepared queries' can be realised by providing
        initial variable bindings with initBindings

        Initial namespaces are used to resolve prefixes used in the query,
        if none are given, the namespaces from the graph's namespace manager
        are used.

        :returntype: rdflib.query.QueryResult

        """

        initBindings = initBindings or {}
        initNs = initNs or dict(self.namespaces())

        if hasattr(self.store, "query") and use_store_provided:
            try:
                return self.store.query(
                    query_object, initNs, initBindings,
                    self.default_union
                    and '__UNION__'
                    or self.identifier,
                    **kwargs)
            except NotImplementedError:
                pass  # store has no own implementation

        if not isinstance(result, query.Result):
            result = plugin.get(result, query.Result)
        if not isinstance(processor, query.Processor):
            processor = plugin.get(processor, query.Processor)(self)

        return result(processor.query(
            query_object, initBindings, initNs, **kwargs))
dataset/ETHPy150Open RDFLib/rdflib/rdflib/graph.py/Graph.query/original