diff --git a/libs/community/langchain_community/graphs/rdf_graph.py b/libs/community/langchain_community/graphs/rdf_graph.py index d1061cc697..0944981c63 100644 --- a/libs/community/langchain_community/graphs/rdf_graph.py +++ b/libs/community/langchain_community/graphs/rdf_graph.py @@ -117,6 +117,7 @@ class RdfGraph: standard: Optional[str] = "rdf", local_copy: Optional[str] = None, graph_kwargs: Optional[Dict] = None, + store_kwargs: Optional[Dict] = None, ) -> None: """ Set up the RDFlib graph @@ -130,6 +131,9 @@ class RdfGraph: :param graph_kwargs: Additional rdflib.Graph specific kwargs that will be used to initialize it, if query_endpoint is provided. + :param store_kwargs: Additional sparqlstore.SPARQLStore specific kwargs + that will be used to initialize it, + if query_endpoint is provided. """ self.source_file = source_file self.serialization = serialization @@ -174,12 +178,13 @@ class RdfGraph: self.graph.parse(source_file, format=self.serialization) if query_endpoint: + store_kwargs = store_kwargs or {} self.mode = "store" if not update_endpoint: - self._store = sparqlstore.SPARQLStore() + self._store = sparqlstore.SPARQLStore(**store_kwargs) self._store.open(query_endpoint) else: - self._store = sparqlstore.SPARQLUpdateStore() + self._store = sparqlstore.SPARQLUpdateStore(**store_kwargs) self._store.open((query_endpoint, update_endpoint)) graph_kwargs = graph_kwargs or {} self.graph = rdflib.Graph(self._store, **graph_kwargs)