Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 7.87 KB

README.md

File metadata and controls

90 lines (60 loc) · 7.87 KB

Exercise 5: Qanary Framework

Context

Many of the common tasks in Knowledge Graph Question Answering are already solved or have a typical solution. In this regard, to help developers not to reinvent the wheel — frameworks come in to play (which is true not only for KGQA but for software engineering in general). There exist several frameworks for Question Answering & Chatbots. In general, they can be divided in to two types — low-code frameworks (e.g., Dialogflow, Bot Framework), and traditional frameworks (e.g., Rasa, DeepPavlov, Qanary). The aforementioned Qanary Framework stands out among the others because of the following reasons:

  • the framework helps you to facilitate KGQA system with multiple independent components;
  • each component is implemented as a microservice and agnostic to the used programming language;
  • the components interact with each other by writing and reading standardized RDF annotations from a common triplestore;
  • a user of the framework may reuse components, developed and deployed by other users without having access the source code;
  • the question answering process becomes transparent, interpretable, and explainable because all the data generated by components is stored in a triplestore (i.e., the process can be traced).

The Qanary framework has two major sub-systems:

  1. Qanary pipeline, and
  2. Qanary components.

The first one serves a similar to API gateway function which is to execute components with certain parameters in a certain order. The second sub-system is actually a set of components that were developed and deployed by the Qanary community (note: be aware that this is just an open collection, there might be many more components out there). One can reuse both of the ecosystems in order to implement his/her question answering system.

Learning Objectives

  • Learn how to integrate your QA components with the Qanary Framework;
  • Learn how to use UI template to work with your QA system.

Task

Integrate the Qanary Framework into your Simple Question Answering system developed in the previous exercise. Hence, each of your components has be to wrapped up according to the example, s.t., it becomes a Qanary component. Exclude API Gateway from your system, now Qanary pipeline will take care of calling the components. Use our general chatbot frontend for testing your system.

Sketch a component-oriented solution

In any component oriented system, you need to make sure that the purpose of a component is clear (cf. your Software Engineering). Hence, in a Qanary system, this is also the first step.

  1. Sketch the components you plan to establish in your system (and give them names) — use material from the previous exercise.
  2. Define 3 examples of questions for which your system should be capable to provide answers.
  3. For each example, execute the QA process manually (on a sheet of paper or on a whiteboard) and hereby create Qanary annotations to express the information created by each of your components. In the last process, check the following: Are all required information availale to create a query and retrieve the answer? Can the final component (typically: Query Builder) decide if the information is valide, and hence reject false
  4. Test your system with 3 examples that should not be answered by your QA system (i.e., the system should recognize that the input is not sufficient).

Note: This process was also done in the lecture.

Transforming components to Qanary framework

In a Qanary system, the components are independent and run in a standalone process. They register themselves in the Qanary pipeline (and can be activated. To do this, the pipeline needs to "see" your components, so if you don't have external IP address of your PC, you probably need such tool as ngrok to expose the corresponding ports to the internet.

  1. Download and unpack ngrok;
  2. Run ./ngrok http YOUR_PORT in the directory of the ngrok (if you use Windows, check documentation of ngrok);
  3. Use the the example to implement and run your components (hint: please, add your surname or similar to the component's name, s.t., it is easy to find them);
  4. Go to public Qanary Admin panel of our Qanary example installation to see if your components are running: image
  5. If all the components are recognized, move to the next part.

NOTE: adjust the functionality of your SPARQL Generator/Executor as follows — the component just generates the query and stores it in the triplestore (see the example for this).

Asking questions with Qanary pipeline

  1. Navigate to the Qanary pipeline;
  2. Select the components to be executed and adjust the order by dragging them;
  3. Insert a textual question in the field and click "start Question Answering..."
  4. If everything is good, then you will see the following output, it corresponds to the graph id, where all your execution annotations are stored: image
  5. Check the console of your components, there should be no errors.

Using general chatbot frontend

  1. Navigate to the general chatbot frontend
  2. Open settings modal window, and put there your components in the corresponding execution order, at the end put SparqlExecutor: image
  3. Ask any question that is supported by your system via the frontend and see the answer: image

Submission check

In this exercise, submission check will be performed in two steps:

  1. You send the code with your solution and the README with a description of files to Moodle (as usual). Then, it will be check for the formal requirements. If everything is OK, we move to the second step.
  2. On the exercise, you perform a system demonstration.

After completion of these two steps, you pass the exercise.

Guidance / Tutorials