[ 
https://issues.apache.org/jira/browse/ATLAS-2523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16460725#comment-16460725
 ] 

Graham Wallis commented on ATLAS-2523:
--------------------------------------

Thanks [~ashutoshm]. I think what I am trying to achieve might be slightly 
different - but maybe not. If there is a better way to achieve it I would be 
keen to use the better way. Let me explain what I think I need to achieve and 
how I am currently doing it - it is not all contained in the currently attached 
patch, which has just one part of it.

I need to be able to save reference copies of entities and/or relationships 
that have been read from another repository. In both cases, the existing object 
will have a GUID that was assigned by the other repository. The GUID may or may 
not conform to the Java UUID formatting that we use and enforce in Atlas. The 
externally assigned GUID could be (almost*) any string (*only 'almost' because 
I preclude strings starting with '-' as explained below).

This is what I am actually doing currently (most of it not yet contained in the 
patch):
 * In the case of an entity to be saved, I use the entity store's import API 
which accepts  an external GUID, provided it is of an acceptable format (see 
below).
 * For a relationship to be saved, the relationship store (currently) always 
assigns a new GUID - which will overwrite the external GUID. So I am changing 
the relationship store to detect if there is a supplied GUID and to use that 
instead of generating a new GUID every time.
 * I have also made a change to AtlasTypeUtil to relax the UUID format checking 
so it will accept any non-empty string as a valid (assigned) GUID provided it 
does not start with '-'. If a GUID starting with '-' is supplied it is still 
treated as an unassigned GUID and is replaced.
 * I have also added a system attribute to AtlasEntity (and will do the same to 
AtlasRelationship) so that we can save the identity of the repository that is 
the home repository for the entity or relationship. This is the identity of the 
repository that the enterprise OMRS uses as the master for the object. I am 
calling this system attribute homeId, and it should sit alongside 'guid' - the 
two attributes together will allow the master object to be located, whilst the 
'guid' (which contains the GUID assigned by the home repository) can be used 
for searches and references to the object. The addition of the homeId system 
attribute is the part that I am least confident about at the moment because I 
there are lots of places in the Atlas code that process all the system 
attributes - so I will need to augment all of them to include the homeId. I can 
do that - but will need to be careful not to miss any.

That should be all the changes I was envisaging - they logically form a set 
that I aim to include in an update to the patch.

Does that look like a sensible and consistent approach? Or it there a better 
way to achieve it?

 

[A little further background which is just for completeness:...]

I experimented with packaging the external repository id and the GUID into a 
structured string field and storing it as the GUID inside Atlas - but it very 
quickly became apparent that this would be a bad idea - as all references to 
the GUIDs by external systems and applications would need to be mapped to the 
structured form. So I decided it was preferable to keep the GUID field as 
containing just the supplied GUID (whether internally or externally generated). 
I thought about adding the external GUID and home repository identity as 
externally defined properties of the instances - but that would really mess up 
the type system, so I also rejected that in favour of using a system attribute.

> Import relationship, preserving existing GUID
> ---------------------------------------------
>
>                 Key: ATLAS-2523
>                 URL: https://issues.apache.org/jira/browse/ATLAS-2523
>             Project: Atlas
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Graham Wallis
>            Priority: Major
>             Fix For: 1.0.0
>
>         Attachments: ATLAS-2523-2018-04-09.patch
>
>
> To add a relationship defined externally (in another metadata repository), I 
> want to be able to add the relationship and maintain the existing GUID.
> This is possible for an entity by performing an import. It does not seem to 
> be possible for relationships., because the relationship store always 
> generates a new GUID, which overwrites the existing GUID.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to