Text to Knowledge Graph (T2KG) API

T2KG API is capable of extracting more than 4000 types of entities as well as more than 400 relations from any given text.

Supported languages

Currently, T2KG API supports the following languages:

  • English - 4948 classes, 400 relations
  • German - 4016 classes, 400 relations
  • French - 2864 classes, 400 relations
  • Italian - 2729 classes, 400 relations
  • Spanish - 1974 classes, 400 relations
  • Portuguese - 2446 classes, 400 relations
  • Dutch - 2434 classes, 400 relations
  • Polish - 2758 classes, 400 relations
  • Russian - 3785 classes, 400 relations

Requesting knowledge graph generation from T2KG API

Using CURL

curl https://databorg.ai/api/knowledgeGraph \
  -H 'Authorization:"Bearer YOUR_KEY"' \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"text":"The philosopher and mathematician Leibniz was born in Leipzig in 1646 and attended the University of Leipzig from 1661-1666."}'

Using javascript

const url = 'https://databorg.ai/api/knowledgeGraph';
const apiKey = 'YOUR_KEY';
const text = 'The philosopher and mathematician Leibniz was born in Leipzig in 1646 and attended the University of Leipzig from 1661-1666.';

const result = await fetch(url, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ text }),
}).then((r) => r.text());

console.log(result);

Using python

import requests
import json

url = 'https://databorg.ai/api/knowledgeGraph'
apiKey = 'YOUR_KEY'
text = 'The philosopher and mathematician Leibniz was born in Leipzig in 1646 and attended the University of Leipzig from 1661-1666.'

result = requests.post(url, data=json.dumps({"text": text}), headers={
    "Authorization": "Bearer " + apiKey,
    "Content-Type": "application/json",
})

print(result.content)

Example response

Example response:
@prefix databorg: <https://schema.databorg.ai/>.
@prefix wkd: <http://www.wikidata.org/entity/>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.

databorg:leibniz a wkd:Q5;
  databorg:educatedAt databorg:universityOfLeipzig;
  databorg:placeOfBirth databorg:leipzig;
  rdfs:label "Leibniz".
databorg:universityOfLeipzig a wkd:Q875538;
  databorg:locatedInTheAdministrativeTerritorialEntity databorg:leipzig;
  rdfs:label "University of Leipzig".
wkd:Q5 rdfs:label "human".
databorg:educatedAt rdfs:label "educated at".
wkd:Q875538 rdfs:label "public university".
databorg:leipzig a wkd:Q1549591;
  rdfs:label "Leipzig".
wkd:Q1549591 rdfs:label "big city".
databorg:locatedInTheAdministrativeTerritorialEntity rdfs:label "located in the administrative territorial entity".
databorg:placeOfBirth rdfs:label "place of birth".