Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RDF Graph and RDF QA Chain #6050

Closed
wants to merge 4 commits into from

Conversation

lifan0127
Copy link

This pull request adds support for RDF Graph-based QA Chain. It uses the same signature and provides similar functionalities as the current Neo4j and Nebula implementations.

In theory, any RDF stores that support the W3C SPARQL Query Language 1.1 standard can be used, although only a few were tested during the development.

https://github.com/lifan0127/langchain/blob/rdf-graph/docs/modules/chains/examples/graph_rdf_qa.ipynb

This approach will not scale well for large, public RDF databases such as Wikidata, but that is a more general problem that requires more research.

cc @hwchase17

@suraj-ranganath
Copy link

suraj-ranganath commented Jun 28, 2023

@lifan0127 @hwchase17 are you still working on this?

@lifan0127
Copy link
Author

Hello @hwchase17, Let me know how I can help incorporate this feature.

@felixocker felixocker mentioned this pull request Jul 4, 2023
hwchase17 pushed a commit that referenced this pull request Jul 5, 2023
# [SPARQL](https://www.w3.org/TR/rdf-sparql-query/) for
[LangChain](https://github.com/hwchase17/langchain)

## Description
LangChain support for knowledge graphs relying on W3C standards using
RDFlib: SPARQL/ RDF(S)/ OWL with special focus on RDF \
* Works with local files, files from the web, and SPARQL endpoints
* Supports both SELECT and UPDATE queries
* Includes both a Jupyter notebook with an example and integration tests

## Contribution compared to related PRs and discussions
* [Wikibase agent](#2690) -
uses SPARQL, but specifically for wikibase querying
* [Cypher qa](#5078) - graph
DB question answering for Neo4J via Cypher
* [PR 6050](#6050) - tries
something similar, but does not cover UPDATE queries and supports only
RDF
* Discussions on [w3c mailing list](mailto:semantic-web@w3.org) related
to the combination of LLMs (specifically ChatGPT) and knowledge graphs

## Dependencies
* [RDFlib](https://github.com/RDFLib/rdflib)

## Tag maintainer
Graph database related to memory -> @hwchase17
@baskaryan baskaryan added the 03 enhancement Enhancement of existing functionality label Jul 13, 2023
@baskaryan baskaryan self-assigned this Jul 13, 2023
@baskaryan
Copy link
Collaborator

hey @lifan0127, apologies for the delay and thanks for the contribution!

seems like there's some overlap with #7165, curious if that covers this use case or if there's extra functionality in this pr

@lifan0127
Copy link
Author

@baskaryan Hey, note that this PR was created long before #7165. Nevertheless, I think we can close it now that #7165 has been merged.

@lifan0127 lifan0127 closed this Jul 13, 2023
aerrober pushed a commit to aerrober/langchain-fork that referenced this pull request Jul 24, 2023
# [SPARQL](https://www.w3.org/TR/rdf-sparql-query/) for
[LangChain](https://github.com/hwchase17/langchain)

## Description
LangChain support for knowledge graphs relying on W3C standards using
RDFlib: SPARQL/ RDF(S)/ OWL with special focus on RDF \
* Works with local files, files from the web, and SPARQL endpoints
* Supports both SELECT and UPDATE queries
* Includes both a Jupyter notebook with an example and integration tests

## Contribution compared to related PRs and discussions
* [Wikibase agent](langchain-ai#2690) -
uses SPARQL, but specifically for wikibase querying
* [Cypher qa](langchain-ai#5078) - graph
DB question answering for Neo4J via Cypher
* [PR 6050](langchain-ai#6050) - tries
something similar, but does not cover UPDATE queries and supports only
RDF
* Discussions on [w3c mailing list](mailto:semantic-web@w3.org) related
to the combination of LLMs (specifically ChatGPT) and knowledge graphs

## Dependencies
* [RDFlib](https://github.com/RDFLib/rdflib)

## Tag maintainer
Graph database related to memory -> @hwchase17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
03 enhancement Enhancement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants