Guide
Knowledge Graph
Retrieve keywords for an entity of interest
This example shows how to retrieve keywords related to an entity of interest for a list of properties
POST /kg/browse
Input parameters
entity_of_interest
: Unique identifier of the looked-up entity.- Value depends on the
source
param (permalink for the corporate knowledge graph and Qid for the general knowledge graph).- Example:
apple
for the corporate knowledge graph.Q312
for the general knowledge graph.
- Example:
- Required.
- Value depends on the
uuid
: Unique identifier of the entity in the corporate knowledge graph.properties_list
: List of properties of interest separated with a comma.- Default value depends on
source
:corporate_kg
["chief_executive_officer", "domain", "founders", "legal_name", "subsidiaries", "ticker"]
.
general_kg
- Uses the full list of properties returned by the
/kg/entities/<entity_id>/properties
route.
- Uses the full list of properties returned by the
- Default value depends on
source
: The type of the knowledge graph you want to request.- Accepted values:
general_kg
,corporate_kg
. - Defaults:
corporate_kg
- Accepted values:
- Either
entity_of_interest
oruuid
must be provided
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']
entity_of_interest = 'apple'
properties_list = ['subsidiaries', 'chief_executive_officer', 'domain', 'founders', 'legal_name']
source = 'corporate_kg'
token = get_token(config)
endpoint = f'{host}/api/2.0/kg/browse'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
payload = json.dumps({
'entity_of_interest': entity_of_interest,
'source': source,
'properties_list': properties_list
})
response = requests.post(endpoint, headers=headers, data=payload)
print(response.json())
Result
A JSON object with aliases
, labels
and a list of properties
when available.
result.json
{
"aliases": {
"en": ["Apple Computer"]
},
"labels": {
"en": "Apple"
},
"properties": {
"subsidiaries": {
"labels": [
{
"en": "AC Wellness"
},
{
"en": "FileMaker"
},
{
"en": "Braeburn Capital"
}
]
}
}
}