To create a link between two Tags because one includes the other, you can create a Tag Edge from one to the other. As such you are creating a DAG (directed acyclic graph) of Tags. For performance purposes, when you create an Edge we will create a bunch of indirect edges to fully describe the graph.
For instance we will work with these two tags:
Object resources
Property | Type | Description |
ancestor_id | Integer | The target Tag of the current Edge |
descendant_id | Integer | The source Tag of the current Edge |
tag_set_id | Integer | The Tag Set the Tag Edge belongs to |
direct | Boolean | If the edge is direct or indirect |
instance_id | Integer | The instance the knowledge graph belongs to |
hops | Integer | The number of different ways between the ancestor and descendant tags |
created_at | Timestamp | The creation date of the object |
updated_at | Timestamp | The last update date of the object |
Create (POST)
Method | POST |
URL | /tag_edges |
Parameters (*Requiered parameters)
Property | Type | Description |
ancestor_id* | Integer | The target Tag of the current Edge |
descendant_id* | Integer | The source Tag of the current Edge |
{
ancestor_id: 3,
descendant_id: 1
}
Get the response (JSON output example)
{
id: 1,
ancestor_id: 3,
descendant_id: 1,
tag_set_id:1,
direct : true,
hops : 1,
instance_id : 1,
created_at : 2014-09-17 09:21:03,
updated_at : 2014-09-17 09:21:03
}
Fetch (GET)
Method | GET |
URL | /tag_edges/{tag_edge_id} |
If no tag_edge_id is provided it will fetch all Tag Edges for your instance. Be aware that for each Edge you created, we also created a lot of indirect Edges to build the graph. Hence, you will have fetch your “direct” Edges but also the “indirect” Edges.
Get the response (JSON output example)
With ID provided
{
id : 1,
ancestor_id : 3,
descendant_id : 1,
direct : true,
count : 1,
instance_id : 1,
created_at : 2014-09-17 09:21:03,
updated_at : 2014-09-17 09:21:03
}