Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Atlas API to create Entitities have nested objects with out using GUID

Atlas API to create Entitities have nested objects with out using GUID

Explorer
Type: Organization
{ "enumTypes": [],
    "structTypes": [],
    "traitTypes": [],
    "classTypes": [{
        "superTypes": ["DataSet"],
        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
        "typeName": "Organization",
        "typeDescription": Organization,
        "attributeDefinitions": [
        {
            "name": "organizationName",
            "dataTypeName": "string",
            "multiplicity": "required",
            "isComposite": false,
            "isUnique": false,
            "isIndexable": true,
            "reverseAttributeName": null
        }]
    }]
}

Type: Employee


{
    "enumTypes": [],
    "structTypes": [],
    "traitTypes": [],
    "classTypes": [{
        "superTypes": ["DataSet"],
        "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
        "typeName": "Employee",
        "typeDescription": null,
        "attributeDefinitions": [
        {
            "name": "organization",
            "dataTypeName": "Organization",
            "multiplicity": "required",
            "isComposite": false,
            "isUnique": false,
            "isIndexable": true,
            "reverseAttributeName": null
        }]
    }]
}





Here in the above example there exists a type Employee and type Organization is a nested object to it.

If lets say there exists an organization instance called "ABCD" and If I need to create a new employee and link exisitng organization to the newly created employee as nested Object I'm using the ID as shown below. Is this the only way? As we may have to store this guid some where which is not a good approach. Is there a way to create Employee by using only qualified name of the Organization thus avoiding the use of IDs?

{
    "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
    "id": {
        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
        "version": 0,
        "typeName": "Employee"
    },
    "typeName": "Employee",
    "values": {
	 "name": "tom",
	 "qualifiedName":"tom",
	 "organization":{
					"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
					"id":"f246b041-e87e-497c-a0d2-ecb90532934f",
					"version": 0,
					"typeName": "Organization",
					"state": "ACTIVE",

					"values":{
							 "qualifiedName": "ABCD"
						}
				}
    		
    },
    "traitNames": [],
    "traits": {}
}



Don't have an account?
Coming from Hortonworks? Activate your account here