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

Pierre Padovani edited comment on ATLAS-2178 at 9/28/17 6:54 PM:
-----------------------------------------------------------------

Update: If I set the property 'atlas.ui.editable.entity.types=*' to allow for 
custom types to be created from the UI, and create two entities (one on each 
side of the CustomerOwned defined relationship type) I can properly define the 
relationship on each side, and the data is set correctly.


{code:java}
{
    "referredEntities": {
        "1f85676c-b0a5-45b3-b528-8420e5cae066": {
            "typeName": "SorSystem",
            "attributes": {
                "owner": null,
                "tables": null,
                "qualifiedName": "sor@cust1",
                "name": "sor",
                "description": null,
                "customer": {
                    "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
                    "typeName": "Customer"
                }
            },
            "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
            "status": "ACTIVE",
            "createdBy": "admin",
            "updatedBy": "admin",
            "createTime": 1506624242409,
            "updateTime": 1506624364249,
            "version": 0,
            "relationshipAttributes": {
                "tables": [],
                "sourceToProcesses": [],
                "sinkFromProcesses": [],
                "customer": {
                    "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
                    "typeName": "Customer",
                    "displayText": "cust1",
                    "relationshipGuid": "ad2bb1bb-9da1-4fc5-9ca6-25d09b583541",
                    "relationshipAttributes": {
                        "typeName": "CustomerOwnership"
                    }
                }
            },
            "classifications": []
        }
    },
    "entity": {
        "typeName": "Customer",
        "attributes": {
            "owner": null,
            "systems": [
                {
                    "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
                    "typeName": "SorSystem"
                }
            ],
            "qualifiedName": "cust1",
            "name": "cust1",
            "description": null
        },
        "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
        "status": "ACTIVE",
        "createdBy": "admin",
        "updatedBy": "admin",
        "createTime": 1506624164918,
        "updateTime": 1506624332364,
        "version": 0,
        "relationshipAttributes": {
            "systems": {
                "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
                "typeName": "SorSystem",
                "displayText": "sor",
                "relationshipGuid": "e63c1d2b-08c4-483a-a345-c2d6d8cb7bb7",
                "relationshipAttributes": {
                    "typeName": "CustomerOwnership"
                }
            }
        },
        "classifications": []
    }
}
{code}


I would assume that this is due to the UI using the V1 API rather than making a 
call to the V2 Relationship API. That being said, my assumption was that if I 
set the legacy flag on the RelationshipDef the attributes that correspond to 
the field names in each end would be set correctly when the relationship 
instance was created. Tracing through the code during a create relationship 
call via the REST api, I see nothing that honors the legacy flag. (unless it is 
happening under the covers in the titan code.)


was (Author: ppadovani):
Update: If I set the property 'atlas.ui.editable.entity.types=*' to allow for 
custom types to be created from the UI, and create two entities (one on each 
side of the CustomerOwned defined relationship type) I can properly define the 
relationship on each side, and the data is set correctly.

```{
    "referredEntities": {
        "1f85676c-b0a5-45b3-b528-8420e5cae066": {
            "typeName": "SorSystem",
            "attributes": {
                "owner": null,
                "tables": null,
                "qualifiedName": "sor@cust1",
                "name": "sor",
                "description": null,
                "customer": {
                    "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
                    "typeName": "Customer"
                }
            },
            "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
            "status": "ACTIVE",
            "createdBy": "admin",
            "updatedBy": "admin",
            "createTime": 1506624242409,
            "updateTime": 1506624364249,
            "version": 0,
            "relationshipAttributes": {
                "tables": [],
                "sourceToProcesses": [],
                "sinkFromProcesses": [],
                "customer": {
                    "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
                    "typeName": "Customer",
                    "displayText": "cust1",
                    "relationshipGuid": "ad2bb1bb-9da1-4fc5-9ca6-25d09b583541",
                    "relationshipAttributes": {
                        "typeName": "CustomerOwnership"
                    }
                }
            },
            "classifications": []
        }
    },
    "entity": {
        "typeName": "Customer",
        "attributes": {
            "owner": null,
            "systems": [
                {
                    "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
                    "typeName": "SorSystem"
                }
            ],
            "qualifiedName": "cust1",
            "name": "cust1",
            "description": null
        },
        "guid": "bec94ddc-dec3-42cb-b1c3-b19dff655693",
        "status": "ACTIVE",
        "createdBy": "admin",
        "updatedBy": "admin",
        "createTime": 1506624164918,
        "updateTime": 1506624332364,
        "version": 0,
        "relationshipAttributes": {
            "systems": {
                "guid": "1f85676c-b0a5-45b3-b528-8420e5cae066",
                "typeName": "SorSystem",
                "displayText": "sor",
                "relationshipGuid": "e63c1d2b-08c4-483a-a345-c2d6d8cb7bb7",
                "relationshipAttributes": {
                    "typeName": "CustomerOwnership"
                }
            }
        },
        "classifications": []
    }
}```

I would assume that this is due to the UI using the V1 API rather than making a 
call to the V2 Relationship API. That being said, my assumption was that if I 
set the legacy flag on the RelationshipDef the attributes that correspond to 
the field names in each end would be set correctly when the relationship 
instance was created. Tracing through the code during a create relationship 
call via the REST api, I see nothing that honors the legacy flag. (unless it is 
happening under the covers in the titan code.)

> Type Inheritance in conjunction with RelationshipDef fails to set legacy 
> attributes
> -----------------------------------------------------------------------------------
>
>                 Key: ATLAS-2178
>                 URL: https://issues.apache.org/jira/browse/ATLAS-2178
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>    Affects Versions: 1.0.0
>            Reporter: Pierre Padovani
>         Attachments: entities.json, rel1.json, rel2.json, rel3.json, 
> rel4.json, rel5.json, types.json
>
>
> If a type inherits from another that has an old style reference attribute, 
> and a new style RelationshipDef defined, creating the relationship instance 
> fails to set the legacy attributes and in some cases fails to create the 
> relationship itself.
> Steps to reproduce:
> * create a type, say my_table, that inherits from the hive_table
> * Create an instance of the new type my_table
> * Create an instance of a hive_column
> * Create the containment relationship between the two models.
> This behavior causes odd and inconsistent behavior and fully breaks lineage 
> reports for process types that inherit from the built in Process.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to