Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Apache Atlas create Relationship with SDK

avatar
New Contributor

I am trying to figure out the Apache Atlas Common Library for my Spring Boot project. To be honest, I am having a really hard time finding any documentation on this library. But, I import it in my Pom file like this:

 

    <dependency>
        <groupId>org.apache.atlas</groupId>
        <artifactId>atlas-common</artifactId>
        <version>2.2.0</version>
    </dependency> 

 I am trying to create a relationship between two entities. I know I can do this with the REST API, like this:

{
        "typeName": "MyRealtionshipName",
        "end1": {
            "guid": "c69933db-f0b5-4f9a-99d9-b5f950f58b4f",
            "typeName": "myentitytype_1",
            "uniqueAttributes": {
                "qualifiedName": "obj1@id@myentitytype_1"
            }
        },
        "end2": {
            "guid": "9ca8259f-673e-4dc5-80f2-67c8e6487cf4", 
            "typeName": "myentitytype_2",
            "uniqueAttributes": {
                "qualifiedName": "obj1@myentitytype_2"
            }
        },
        "label": "r:MyNewRelationship",
        "propagateTags": "NONE"  
}

 But, I want to do this through the Apache Atlas library. I cannot find any documentation on how to do this. Can anyone assist and/or provide documentation? On the library side, I am able to create entities like this:

     private final AtlasClientV2 atlasClient;
    
     AtlasService() {
        atlasClient = new AtlasClientV2(new String[]{"http://localhost:21000"}, new String[]{"admin", "admin"});
     }

public EntityMutationResponse createNewEntity(myOBj obj) throws AtlasServiceException  {     
      AtlasEntity newEntity= new AtlasEntity();
      newEntity.setTypeName("entity_tpye"); 
      newEntity.setAttribute("id", myOBj.getId());
      newEntity.setAttribute("name", myOBj.getName());
      AtlasEntity.AtlasEntitiesWithExtInfo entitesToCreate = new AtlasEntity.AtlasEntitiesWithExtInfo();
     entitesToCreate.setEntities(Arrays.asList(newEntity));            
     EntityMutationResponse entitiesCreated = atlasClient.createEntities(entitesToCreate); 

     //create relationship between this newEntity and a previously created entity with a given GUID
    }
0 REPLIES 0