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

knowledge graph example #934

Merged
merged 43 commits into from
Apr 8, 2021
Merged

knowledge graph example #934

merged 43 commits into from
Apr 8, 2021

Conversation

julian-risch
Copy link
Member

@julian-risch julian-risch commented Mar 31, 2021

This PR adds:

  • GraphDBKnowledgeGraph, which stores a knowledge graph in the form of triples and executes SPARQL queries
    • and its base class BaseKnowledgeGraph
  • Text2SparqlRetriever, which uses a pre-trained model to translate text queries to SPARQL queries
    • and its base class BaseGraphRetriever
  • Tutorial10_Knowledge_Graph, which shows how to do question answering on a knowledge graph with the help of a pre-trained model and a knowledge graph extracted from https://harrypotter.fandom.com/

closes #917 #918 #919

Limitations:
Unfortunately, there seems to be no easy way to run the tutorial in google colab notebooks because GraphDB cannot be installed automatically. GraphDB requires filling out a form to download installer files: https://www.ontotext.com/products/graphdb/graphdb-free/

The number of beams in beam search num_beams is not parameterized but fixed to 5.
The Text2SparqlRetriever is fixed to BartForConditionalGeneration models and could be generalized so that it works with any seq2seq model.

oryx1729 and others added 30 commits April 7, 2021 16:37
Copy link
Contributor

@Timoeller Timoeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, once the proposed changes are in (or dismissed) I am fine from the Text2Sparql side. Lets get @oryx1729 feedback for the KG part.

haystack/graph_retriever/text_to_sparql.py Show resolved Hide resolved
haystack/graph_retriever/text_to_sparql.py Outdated Show resolved Hide resolved
haystack/graph_retriever/text_to_sparql.py Outdated Show resolved Hide resolved
tutorials/Tutorial10_Knowledge_Graph.py Outdated Show resolved Hide resolved
tutorials/Tutorial10_Knowledge_Graph.py Outdated Show resolved Hide resolved
tutorials/Tutorial10_Knowledge_Graph.py Show resolved Hide resolved
@Timoeller Timoeller requested a review from oryx1729 April 7, 2021 17:37
Copy link
Contributor

@oryx1729 oryx1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@julian-risch julian-risch changed the title WIP: knowledge graph example knowledge graph example Apr 8, 2021
@julian-risch julian-risch marked this pull request as ready for review April 8, 2021 11:49
@julian-risch julian-risch merged commit d38c07e into master Apr 8, 2021
@julian-risch julian-risch deleted the knowledge-graph-example branch April 8, 2021 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Knowledge Graph database
3 participants