QAnswer

QAnswer

  • Docs
  • API
  • Community
  • Blog

›Tutorial (API)

Introduction

  • Introduction

Quick Intro

  • Create a Playground
  • Create our first node
  • Create our first relation
  • My creativity ....
  • Learning a bit ....
  • Making it prettier
  • Free me in the WWW

Tutorial (UI)

  • Part 1 (RDF to QA)
  • Part 2 (Signup and Login)
  • Part 3 (Upload and index)
  • Part 4 (Query)
  • Part 5 (Feedback and train)
  • Part 6 (Contextual information)
  • Part 7 (Additional services)

Tutorial (API)

  • Part 1 (API)
  • Part 2 (Signup and Login)
  • Part 3 (Upload and index)
  • Part 4 (Query)
  • Part 5 (Feedback and train)
  • Part 6 (Contextual information)
  • Part 7 (Additional services)

Requirements

  • Requirements
  • Requirement 1
  • Requirement 2
  • Requirement 3 (Optional)

Terms of Use

  • Terms of use

Tutorial: Query

You can already ask the first questions on top of your dataset. For the "cocktails" dataset you could ask for example: "What is a Margarita?" or "What are the ingredients of Margarita?":

cURL
Java
JavaScript
curl -X GET \
'http://qanswer-core1.univ-st-etienne.fr/api/qa/full' \
--data-urlencode 'question= what is a margerita' \
--data-urlencode 'lang=en' \
--data-urlencode 'kb=cocktails' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ.....' --get
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url("http://qanswer-core1.univ-st-etienne.fr/api/qa/full?question=what%20is%20a%20margerita&lang=en&kb=cocktails")
.get()
.addHeader("Authorization", "Bearer eyJhbGciOiJ......")
.build();

Response response = client.newCall(request).execute();
var settings = {
"async": true,
"crossDomain": true,
"url": "http://qanswer-core1.univ-st-etienne.fr/api/qa/full?question=what%20is%20a%20margerita&lang=en&kb=cocktails",
"method": "GET",
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzUxMi.....",
}
}

$.ajax(settings).done(function (response) {
console.log(response);
});

The results looks as following:

{
    "question": "what is a margerita",
    "queries": [
        {
            "query": "SELECT DISTINCT ?s0 where { VALUES ?s0 { <http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71> }  } LIMIT 1000",
            "confidence": 0.9999999999996994,
            "kb": "cocktails"
        },
        {
            "query": "SELECT DISTINCT ?s0 where { VALUES ?s0 { <http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71> }  } LIMIT 1000",
            "confidence": 1,
            "kb": "cocktails"
        },
        {
            "query": "SELECT DISTINCT ?o1 where { <http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71>  ?p1  ?o1 . } limit 1000",
            "confidence": 0.011127059360766982,
            "kb": "cocktails"
        },
        {
            "query": "SELECT DISTINCT ?s1 where { ?s1  ?p1  <http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71> . } limit 1000",
            "confidence": 0.01182653776243101,
            "kb": "cocktails"
        },
        {
            "query": "SELECT DISTINCT ?o1 where { <http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  ?o1 . } limit 1000",
            "confidence": 2.035927837191609e-11,
            "kb": "cocktails"
        }
    ],
    "qaContexts": [
        {
            "kb": "cocktails",
            "literal": null,
            "uri": "http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71",
            "description": null,
            "links": {
                "cocktails": "http://vocabulary.semantic-web.at/cocktails/2d85fb1b-96cb-4c48-8df5-707032f34e71"
            },
            "label": "Margarita",
            "time": null,
            "images": [],
            "audio": [],
            "geo": [],
            "video": [],
            "geoJson": null,
            "pageRank": 0.3047554
        }
    ]
}

It contains the generated queries with the corresponding confidence scores and the answer. Note that for now there is no contextual information attached to the answers, like labels, descriptions, external links, maps, images and videos. How this can be achieved will be shown in Part 6.

The dataset contains some popular cocktails like: Margarita, Sex on the Beach, Long Island Iced Tea and Grasshopper.

The results that you achieve may not be satisfying. To train the machine learning model to fit your dataset check the next section.

← Part 3 (Upload and index)Part 5 (Feedback and train) →
Docs
Getting StartedAPI ReferenceTerms of use
Community
Twitter
More
GitHubStar
Us
Imprint
Copyright © 2021 QAnswer