Member since
01-20-2021
1
Post
0
Kudos Received
0
Solutions
12-24-2021
04:02 AM
Hopefully the OP is sorted out by now, but for anyone else who comes across this: one of the best step-by-step instructions on Atlas relationships I've found is this comment by Vinayak Marriaya on the Atlas Jira; re-producing here, in case that link dies: Following are the json's to create relationships 1. Creating EntityDef json 2. Creating Entity json 3. Creating RelationshipDef json 4. Creating Relationship instance json Step-1 Creating EntityDef POST - http://localhost:21000/api/atlas/v2/types/typedefs {
"entityDefs": [
{
"category": "ENTITY",
"name": "type_a"
},
{
"category": "ENTITY",
"name": "type_b"
}
]
} Step-2 Creating Entity POST - http://localhost:21000/api/atlas/v2/entity/bulk {
"entities": [
{
"typeName": "type_a",
"guid": "-72ddefefS2UY"
},
{
"typeName": "type_b",
"guid": "-JL1HddDOfdf"
}
]
} Step-3 Creating RelationshipDef POST - http://localhost:21000/api/atlas/v2/types/typedefs {
"relationshipDefs": [
{
"propagateTags": "ONE_TO_TWO",
"description": "description ASSOCIATION between type5 and type6",
"relationshipCategory": "ASSOCIATION",
"typeVersion": "1.0",
"attributeDefs": [
{
"name": "LinkInformation",
"typeName": "string",
"isOptional": true,
"cardinality": "SINGLE",
"valuesMinCount": 0,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1
}
],
"endDef2": {
"name": "type_b_rel_attribute",
"isLegacyAttribute": false,
"isContainer": false,
"cardinality": "SINGLE",
"type": "type_b",
"description": "description with name: type_2_rel_attribute"
},
"endDef1": {
"name": "type_a_rel_attribute",
"isLegacyAttribute": false,
"isContainer": false,
"cardinality": "SET",
"type": "type_a",
"description": "description with name: type_1_rel_attribute"
},
"guid": "-2fsdfjhsewl04",
"name": "association_type_a_and_type_b"
}
]
}
Step-4 Creating Relationship instance POST- http://localhost:21000/api/atlas/v2/relationship {
"typeName": "association_type_a_and_type_b",
"end1": {
"typeName": "type_a",
"guid": "b4dae5e8-a606-4e41-9ce3-8f35245f389e" (guid of type_a entity)
},
"propagateTags": "NONE",
"provenanceType": 0,
"propagatedClassifications": [],
"end2": {
"typeName": "type_b",
"guid": "23c2f3c1-dd74-4190-a6d1-b012c44cbb6d" (guid of type_b entity)
},
"blockedPropagatedClassifications": [],
"guid": "-bjbfdfddfeffef",
"attributes": {
"LinkInformation": "TestingInformation"
}
} Following is the output of the above API call. Output of type_a entity GET - http://localhost:21000/api/atlas/v2/entity/guid/\{guid of type_a entity} {
"referredEntities": {},
"entity": {
"typeName": "type_a",
"guid": "b4dae5e8-a606-4e41-9ce3-8f35245f389e",
"isIncomplete": false,
"status": "ACTIVE",
"createdBy": "admin",
"updatedBy": "admin",
"createTime": 1632121151626,
"updateTime": 1632121151626,
"version": 0,
"relationshipAttributes": {
"type_a_rel_attribute": [
{
"guid": "23c2f3c1-dd74-4190-a6d1-b012c44cbb6d",
"typeName": "type_b",
"entityStatus": "ACTIVE",
"relationshipType": "association_type_a_and_type_b",
"relationshipGuid": "ec64783a-58d7-4265-87d6-c1535ce2d9b7",
"relationshipStatus": "ACTIVE",
"relationshipAttributes": {
"typeName": "association_type_a_and_type_b",
"attributes": {
"LinkInformation": "TestingInformation"
}
}
}
]
},
"labels": []
}
}
Output of type_b entity GET - http://localhost:21000/api/atlas/v2/entity/guid/\{guid of type_b entity} {
"referredEntities": {},
"entity": {
"typeName": "type_b",
"guid": "23c2f3c1-dd74-4190-a6d1-b012c44cbb6d",
"isIncomplete": false,
"status": "ACTIVE",
"createdBy": "admin",
"updatedBy": "admin",
"createTime": 1632121151626,
"updateTime": 1632121151626,
"version": 0,
"relationshipAttributes": {
"type_b_rel_attribute": {
"guid": "b4dae5e8-a606-4e41-9ce3-8f35245f389e",
"typeName": "type_a",
"entityStatus": "ACTIVE",
"relationshipType": "association_type_a_and_type_b",
"relationshipGuid": "ec64783a-58d7-4265-87d6-c1535ce2d9b7",
"relationshipStatus": "ACTIVE",
"relationshipAttributes": {
"typeName": "association_type_a_and_type_b",
"attributes": {
"LinkInformation": "TestingInformation"
}
}
}
},
"labels": []
}
} As you can see, LinkInformation is specified under "attributes" and when you search for the entity using GUID as you mentioned in jira, you will be able to see the value of "LinkInformation".
... View more