Guide
Knowledge Graph
Spot an entity of interest
This example shows how to spot an entity of interest with a fuzzy keyword
POST /kg/candidates
Input parameters
keyword_of_interest
: The fuzzy key you want to search.- Example:
apple
. - Required.
- Example:
max_result
: The maximum number of candidates you want to retrieve. We use a pagerank score to sort results.- Defaults:
5
.
- Defaults:
source
: The type of the knowledge graph you want to request.- Accepted values:
general_kg
,corporate_kg
. - Defaults:
corporate_kg
- Accepted values:
example_request.py
import json
import requests
# Functions found in the section "Quick start" under "Getting started"
from connect_v2 import read_config, get_token
config = read_config()
host = config['api']['host']
keyword_of_interest = 'apple'
max_results = 5
source = 'corporate_kg'
token = get_token(config)
endpoint = f'{host}/api/2.0/kg/candidates'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
payload = json.dumps({
'keyword_of_interest': keyword_of_interest,
'max_results': max_results,
'source': source
})
response = requests.post(endpoint, headers=headers, data=payload)
print(response.json())
Result
The sorted entities found relating to the keyword. The entities are sorted by their level of importance represented by:
- The presence of a ticker.
- Their revenue.
Result description:
item_id
: The unique identifier of the entity.itemDescription
: The description of the entity.label
: The label of the entity.ticker
: The ticker of the entity (optional).FIGI
: The FIGI identifier of the entity (optional).
result.json
[
{
"itemDescription":"Apple is a multinational corporation that designs, manufactures, and markets consumer electronics, personal computers, and software.",
"item_id":"apple",
"label":"Apple",
"uuid":"7063d087-96b8-2cc1-ee88-c221288acc2a",
"ticker":"AAPL",
"FIGI":["BBG000B9XRY4"]
},
{
"itemDescription":"Apple Hospitality REIT is a publicly traded REIT that owns one of the largest portfolios of upscale, rooms-focused hotels.",
"item_id":"apple-hospitality-reit-inc",
"label":"Apple Hospitality REIT Inc",
"uuid":"5ee62a78-8d1a-4c50-936f-21df4ddc5969",
"ticker":"APLE",
"FIGI":["BBG006473QX9"]
},
{
"itemDescription":"Apple Flavor & Fragrance Group produces flavorings, fragrance, and food additives.",
"item_id":"apple-group",
"label":"Apple Group",
"uuid":"e00d5dda-0318-49ac-8fb1-8a1aeb24ae53",
"ticker":"603020"
},
{
"itemDescription":"Apple International is an automobile exporter company.",
"item_id":"apple-international-56e9",
"label":"Apple International",
"uuid":"4bc20bc0-517d-4493-929f-9199d3ac56e9",
"ticker":"2788"
},
{
"itemDescription":"Apple Orthodontix is the largest provider of orthodontic care in the Dallas and Ft. Worth,",
"item_id":"apple-orthodontix",
"label":"Apple Orthodontix",
"uuid":"010bc163-1570-8f32-2ad1-2dea523a200f",
"ticker":"AOI"
}
]