atlas-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shwetha G S (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ATLAS-1082) In GET method, return type of the actual referenced entity, instead of the definined type
Date Wed, 03 Aug 2016 06:38:20 GMT

     [ https://issues.apache.org/jira/browse/ATLAS-1082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shwetha G S updated ATLAS-1082:
-------------------------------
    Description: 
If I GET an entity, the type name for the target of a reference is the defined type. If the
actual target instance is a subclass of the defined type, then I would prefer to get the type
of the sub-class, so that I can correctly process the referenced entity returned by the GET
method.

For example:
I have a class definitions as follows:

{noformat}
{
    "typeName": "CommonObject",
    "definition": {
        "classTypes": [
            {
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "CommonObject",
                "attributeDefinitions": [
                    {
                        "name": "customProperties",
                        "dataTypeName": "array<PropertyValue>",
                        "multiplicity": "optional",
                        "isComposite": true,
                        "isUnique": false,
                        "isIndexable": false,
                        "reverseAttributeName": "fromObject"
                    }
                ]
            }
        ]
    },
}

{
    "typeName": "PropertyValue",
    "definition": {
        "classTypes": [
            {
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "PropertyValue",
                "attributeDefinitions": [
                    {
                        "name": "definition",
                        "dataTypeName": "PropertyDefinition",
                        "multiplicity": "required",
                        "isComposite": false,
                        "isUnique": false,
                        "isIndexable": false,
                        "reverseAttributeName": null
                    },
                ]
            }
        ]
    },
}

{
    "typeName": "CustomPropertyDefinition",
    "definition": {
        "classTypes": [
            {
                "superTypes": [
                    "PropertyDefinition"
                ],
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "CustomPropertyDefinition",
                "attributeDefinitions": [
                    {
						...
                    }
                ]
            }
        ]
    },
}
{noformat}

If I GET an instance of subtype of CommonObject, I am getting the following :
{noformat}
{
    "definition": {
        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
        "id": {
            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
            "id": "2bd5992f-2107-4863-a28e-21e5d9da2e5b",
            "version": 0,
            "typeName": "DataSet",
            "state": "ACTIVE"
        },
        "typeName": "DataSet",
        "values": {
            "customProperties": [
                {
                    "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
                    "id": {
                        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
                        "id": "c2f05c57-17be-4db3-9cf5-941b74c077eb",
                        "version": 0,
                        "typeName": "PropertyValue",
                        "state": "ACTIVE"
                    },
                    "typeName": "PropertyValue",
                    "values": {
                        "definition": {
                            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
                            "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
                            "version": 0,
                            "typeName": "PropertyDefinition",
                            "state": "ACTIVE"
                        },
                    },
                }
            ],
        },
    }
}
{noformat}

Please note the type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 in the above GET result is PropertyDefinition.

But, the actual type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 is CustomPropertyDefinition:
{noformat}
{
    "definition": {
        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
        "id": {
            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
            "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
            "version": 0,
            "typeName": "OMAS_OMRSCustomPropertyDefinition",
            "state": "ACTIVE"
        },
        "typeName": "OMAS_OMRSCustomPropertyDefinition",
        "values": {
        },
    }
}
{noformat}


  was:
If I GET an entity, the type name for the target of a reference is the defined type. If the
actual target instance is a subclass of the defined type, then I would prefer to get the type
of the sub-class, so that I can correctly process the referenced entity returned by the GET
method.

For example:
I have a class definitions as follows:


{
    "typeName": "CommonObject",
    "definition": {
        "classTypes": [
            {
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "CommonObject",
                "attributeDefinitions": [
                    {
                        "name": "customProperties",
                        "dataTypeName": "array<PropertyValue>",
                        "multiplicity": "optional",
                        "isComposite": true,
                        "isUnique": false,
                        "isIndexable": false,
                        "reverseAttributeName": "fromObject"
                    }
                ]
            }
        ]
    },
}

{
    "typeName": "PropertyValue",
    "definition": {
        "classTypes": [
            {
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "PropertyValue",
                "attributeDefinitions": [
                    {
                        "name": "definition",
                        "dataTypeName": "PropertyDefinition",
                        "multiplicity": "required",
                        "isComposite": false,
                        "isUnique": false,
                        "isIndexable": false,
                        "reverseAttributeName": null
                    },
                ]
            }
        ]
    },
}

{
    "typeName": "CustomPropertyDefinition",
    "definition": {
        "classTypes": [
            {
                "superTypes": [
                    "PropertyDefinition"
                ],
                "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
                "typeName": "CustomPropertyDefinition",
                "attributeDefinitions": [
                    {
						...
                    }
                ]
            }
        ]
    },
}

If I GET an instance of subtype of CommonObject, I am getting the following :
{
    "definition": {
        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
        "id": {
            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
            "id": "2bd5992f-2107-4863-a28e-21e5d9da2e5b",
            "version": 0,
            "typeName": "DataSet",
            "state": "ACTIVE"
        },
        "typeName": "DataSet",
        "values": {
            "customProperties": [
                {
                    "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
                    "id": {
                        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
                        "id": "c2f05c57-17be-4db3-9cf5-941b74c077eb",
                        "version": 0,
                        "typeName": "PropertyValue",
                        "state": "ACTIVE"
                    },
                    "typeName": "PropertyValue",
                    "values": {
                        "definition": {
                            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
                            "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
                            "version": 0,
                            "typeName": "PropertyDefinition",
                            "state": "ACTIVE"
                        },
                    },
                }
            ],
        },
    }
}

Please note the type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 in the above GET result is PropertyDefinition.

But, the actual type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 is CustomPropertyDefinition:
{
    "definition": {
        "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
        "id": {
            "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
            "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
            "version": 0,
            "typeName": "OMAS_OMRSCustomPropertyDefinition",
            "state": "ACTIVE"
        },
        "typeName": "OMAS_OMRSCustomPropertyDefinition",
        "values": {
        },
    }
}


> In GET method, return type of the actual referenced entity, instead of the definined
type
> -----------------------------------------------------------------------------------------
>
>                 Key: ATLAS-1082
>                 URL: https://issues.apache.org/jira/browse/ATLAS-1082
>             Project: Atlas
>          Issue Type: Improvement
>            Reporter: Prasad  S Madugundu
>
> If I GET an entity, the type name for the target of a reference is the defined type.
If the actual target instance is a subclass of the defined type, then I would prefer to get
the type of the sub-class, so that I can correctly process the referenced entity returned
by the GET method.
> For example:
> I have a class definitions as follows:
> {noformat}
> {
>     "typeName": "CommonObject",
>     "definition": {
>         "classTypes": [
>             {
>                 "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
>                 "typeName": "CommonObject",
>                 "attributeDefinitions": [
>                     {
>                         "name": "customProperties",
>                         "dataTypeName": "array<PropertyValue>",
>                         "multiplicity": "optional",
>                         "isComposite": true,
>                         "isUnique": false,
>                         "isIndexable": false,
>                         "reverseAttributeName": "fromObject"
>                     }
>                 ]
>             }
>         ]
>     },
> }
> {
>     "typeName": "PropertyValue",
>     "definition": {
>         "classTypes": [
>             {
>                 "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
>                 "typeName": "PropertyValue",
>                 "attributeDefinitions": [
>                     {
>                         "name": "definition",
>                         "dataTypeName": "PropertyDefinition",
>                         "multiplicity": "required",
>                         "isComposite": false,
>                         "isUnique": false,
>                         "isIndexable": false,
>                         "reverseAttributeName": null
>                     },
>                 ]
>             }
>         ]
>     },
> }
> {
>     "typeName": "CustomPropertyDefinition",
>     "definition": {
>         "classTypes": [
>             {
>                 "superTypes": [
>                     "PropertyDefinition"
>                 ],
>                 "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType",
>                 "typeName": "CustomPropertyDefinition",
>                 "attributeDefinitions": [
>                     {
> 						...
>                     }
>                 ]
>             }
>         ]
>     },
> }
> {noformat}
> If I GET an instance of subtype of CommonObject, I am getting the following :
> {noformat}
> {
>     "definition": {
>         "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
>         "id": {
>             "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
>             "id": "2bd5992f-2107-4863-a28e-21e5d9da2e5b",
>             "version": 0,
>             "typeName": "DataSet",
>             "state": "ACTIVE"
>         },
>         "typeName": "DataSet",
>         "values": {
>             "customProperties": [
>                 {
>                     "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
>                     "id": {
>                         "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
>                         "id": "c2f05c57-17be-4db3-9cf5-941b74c077eb",
>                         "version": 0,
>                         "typeName": "PropertyValue",
>                         "state": "ACTIVE"
>                     },
>                     "typeName": "PropertyValue",
>                     "values": {
>                         "definition": {
>                             "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
>                             "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
>                             "version": 0,
>                             "typeName": "PropertyDefinition",
>                             "state": "ACTIVE"
>                         },
>                     },
>                 }
>             ],
>         },
>     }
> }
> {noformat}
> Please note the type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 in the above GET result
is PropertyDefinition.
> But, the actual type of cd3cc767-fa82-4c8b-a5a7-0910f124f594 is CustomPropertyDefinition:
> {noformat}
> {
>     "definition": {
>         "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
>         "id": {
>             "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
>             "id": "cd3cc767-fa82-4c8b-a5a7-0910f124f594",
>             "version": 0,
>             "typeName": "OMAS_OMRSCustomPropertyDefinition",
>             "state": "ACTIVE"
>         },
>         "typeName": "OMAS_OMRSCustomPropertyDefinition",
>         "values": {
>         },
>     }
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message