You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "Prasad S Madugundu (JIRA)" <ji...@apache.org> on 2016/08/03 06:36:20 UTC

[jira] [Created] (ATLAS-1082) In GET method, return type of the actual referenced entity, instead of the definined type

Prasad  S Madugundu created ATLAS-1082:
------------------------------------------

             Summary: 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:


{
    "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": {
        },
    }
}



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