GAnswer system is a natural language QA system developed by Institute of Computer Science & Techonology Data Management Lab, Peking University, led by Prof. Zou Lei. GAnswer is able to translate natural language questions to query graphs containing semantic information. Then, the system can further turn query graphs into standard SPARQL query, which will be executed in graph databases, in order to attain answers for the users. We apply an innovative data-driven method for semantic disambiguation. In details, while generating query graphs, we maintain multiple plans for entities and predicate mappings and we conduct semantic disambiguation in the query execution phrase according to entities and predicate matches ( incorrect mappings ).
This is an implementation for TKDE 2018 paper Answering Natural Language Questions by Subgraph Matching over Knowledge Graphs
**For help document, click here 中文(ZH), English
First you must download necessary data files dbpedia16.rar here. The extaction code is 1mcr. This is a Baidu Netdisk link. If you have trouble opening it, please try this google drive link.You should unzip the file into directory named data.Since the complete data require at least 20 GB of main memory, you may try a smaller dataset (5GB required). The extract code is zuue. Please notice that the system performance is limited on the small data. We make sure that this data set is capable for example questions on our official website as well as in QALD data set. Otherwise, you should choose suitable question for testing based on the data files.
We recommend you to deploy GAnswer using the jar files we supply. The specific procedure is as follows:
jar -xvf Ganswer.jar
unrar x dbpedia16.rar ./data/
Main_project_directory
Ganswer.jar
unzipped files from Ganswer.jar
dataunzipped files from dbpedia16.rar
java -jar Ganswer.jar
About GAnswer Http API, information can be found in Chapter 2.1.1 in help document.
Here is an example of how to call GAnswer service via http request.
Having started GAnswerHttp, you can activate GAnswer by url as follow:
http://[ip]:[port]/gSolve/?data={maxAnswerNum:1, maxSparqlNum:2, question:Who is the wife of Donald Trump?}
Here,[ip] and [port] is the ip and port number of GAnswerHttp service (the default port is 9999). By the "data" parameter in the url, you can send a json string to GAnswer.
In this example, you are actually sending the following json data:
{
"maxAnswerNum":"1",
"maxSparqlNum":"2",
"question":"Whos is the wife of Donald Trump?"
}
Here, maxAnswerNum and maxSparqlNum respetively limit the number of answers and sparql the system will return. Both of them are optional. If everything goes well, GAnswer will return a json string containing system-generated sparql and corresponding answer.
{
"question":"Who is the wife of Donald Trump?",
"vars":["?wife"],
"sparql":["select DISTINCT ?wife where { <Donald_Trump>\t<spouse>\t?wife. } LIMIT 1","select DISTINCT ?wife where { ?wife\t<spouse>\t<Donald_Trump>. } LIMIT 1"],
"results":{"bindings":[{"?wife":{"type":"uri","value":"<Ivana_Trump>"}}]},
"status":"200"
}
For more detail, please check Chapter 2.1.1 of the user guide.
If you would like to run GAnswer in Eclipse, you need to clone or download the source code and import the project into Eclipse. Afterwards, the jar files in lib directory should be added to Build Path. Due to the sizes, these jar files can not be uploaded to github. Therefore, you can download them here. The extract code is 64jd. You can also download the lib zip through Google Drive. Meanwhile, dbpedia16.rar is also needed. Please unzipped it into directory named data under the project main directory. Parameters about data path can be found in qa.Globals.localPath.
To run GAnswer, you have to deal with multiple dependencies involving jar, data files and external API. Related information is in Chapter 2.4 in the help document. Having generated sparql querires, by default the system will access a remote gStore for answer, which means extra time may be needed.Therefore, we strongly recommend you to deploy gStore on your own server for best performance.
You are welcome to use GAnswer and tell us your valuable advice or bug report.
If your advice or report are accepted, your contribution will be recorded in our help document.
We have published some paper about GAnswer and QA task, which you can find in Chapter 3.2 in help document.
You may have your own set of triples and want to put them into gAnswer.Then you should generate a new set of fragments from your own triples. We have a detailed tutorial to help you out.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model