Skip to content
/ SQG Public

Query Generation for Question Answering over Knowledge Bases

License

Notifications You must be signed in to change notification settings

AskNowQA/SQG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d09c367 · Apr 13, 2020
Aug 29, 2017
Feb 6, 2019
Sep 10, 2019
Feb 20, 2018
Feb 12, 2019
Nov 6, 2017
Sep 3, 2019
Feb 6, 2019
May 2, 2019
Feb 12, 2019
May 2, 2019
Feb 20, 2018
Apr 13, 2020
Apr 13, 2020
Feb 6, 2019
Sep 10, 2018
Nov 15, 2017
Feb 27, 2018
Nov 15, 2017
Sep 13, 2017
Sep 7, 2019
Feb 6, 2018
Feb 12, 2019
Oct 15, 2019
Sep 10, 2019

Repository files navigation

Query Generation

Question answering (QA) systems over Knowledge Graph often consist of several components such as Named Entity Disambiguation (NED), Relation Extraction (RE), and Query Generation (QG). The main objective of this project is to generate SPARQL query for a given question which is annotated by its linked entities and relations.

SQG is a SPARQL Query Generator with modular architecture, enabling easy integration with other components for the construction of a fully functional QA pipeline. To increase the chance constructthe correct query, SQG is able to handle a set of annotations including several incorrect ones. It also benefits from Tree-LSTM model to deal with syntactic ambiguity of the input questions. Special adjustment is considered in order to cope with large-scale knowledge base.

Supported Questions

Currently the following questions are supported:

  • Single entity relation questions
  • Compound questions
  • Count questions
  • Boolean questions

Cite

If you would use the codebase, please cite our paper as well:

@inproceedings{zafar2018formal,
  title={Formal query generation for question answering over knowledge bases},
  author={Zafar, Hamid and Napolitano, Giulio and Lehmann, Jens},
  booktitle={European Semantic Web Conference},
  pages={714--728},
  year={2018},
  organization={Springer}
}

How-to

Data

Getting Started

You can find the list of required packages in here.

To run it (python 2.7 is required):

python sqg_webserver.py

Consume Web API

SQG provides a RESTfull api for the query generator.

Here is an example of how to use the api:

curl -i -H "Content-Type: application/json" -X POST -d '{"question":"What is the hometown of Nader Guirat, where Josef Johansson was born too?","relations":[{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/property/birthPlace"}]},{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/ontology/hometown"}]}],"entities":[{"surface":"","uris":[{"confidence":0.7,"uri":"http://dbpedia.org/resource/Josef_Johansson"},{"confidence":0.3,"uri":"http://dbpedia.org/resource/Barack_Obama"}]},{"surface":"","uris":[{"confidence":1,"uri":"http://dbpedia.org/resource/Nader_Guirat"}]}],"kb":"dbpedia"}' http://localhost:5000/qg/api/v1.0/query

License

This program is subject to the terms of the General Public License (GPL), Version 3.0.

About

Query Generation for Question Answering over Knowledge Bases

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages