Abhishek Pal created ATLAS-4755:
-----------------------------------

             Summary: Associating term to entities of custom type gives error
                 Key: ATLAS-4755
                 URL: https://issues.apache.org/jira/browse/ATLAS-4755
             Project: Atlas
          Issue Type: Bug
          Components:  atlas-core
            Reporter: Abhishek Pal


Currently when we try to associate terms to entities of user-defined/custom 
types it throws the error:
{code}
{
    "errorCode": "ATLAS-400-00-036",
    "errorMessage": "invalid relationshipDef: AtlasGlossarySemanticAssignment: 
end type 1: Referenceable, end type 2: AtlasGlossaryTerm"
}
{code}
----
h3. Steps to reproduce the scenario:
{code}
1. Create type from definition: 
[POST] <atlas-url>/api/atlas/v2/entity
Body:
{
    "enumDefs": [],
    "structDefs": [],
    "classificationDefs": [],
    "entityDefs": [
        {
            "attributeDefs": [
                {
                    "name": "name",
                    "typeName": "string",
                    "isOptional": true,
                    "cardinality": "SINGLE",
                    "valuesMinCount": 0,
                    "valuesMaxCount": 1,
                    "isUnique": false,
                    "isIndexable": false
                },
                {
                    "name": "type_str",
                    "typeName": "string",
                    "isOptional": true,
                    "cardinality": "SINGLE",
                    "valuesMinCount": 0,
                    "valuesMaxCount": 1,
                    "isUnique": false,
                    "isIndexable": false
                }
            ],
            "description": "description",
            "name": "test_type_for_term",
            "category": "ENTITY",
            "superTypes": []
        }
    ],
    "relationshipDefs": [],
    "businessMetadataDefs": []
}
==========================================================

2. Create entity of type 'test_type_for_term':
[POST] <atlas-url>/api/atlas/v2/entity
Body:
{
    "referredEntities": {},
    "entity": {
        "typeName": "test_type_for_term",
        "attributes": {
            "name": " test_type_for_term_entity_0",
            "type_str": "str1"
        },
        "classifications": [],
        "superTypes": []
    }
}
==========================================================

3. Create glossary def:
[POST] <atlas-url>/api/atlas/v2/glossary
Body:
{
    "name": "test_term_glossary",
    "shortDescription": "SD",
    "longDescription": "Long Description"
}
Reponse:
{
    "guid": "<glossary-guid>",
    "qualifiedName": "test_term_glossary",
    "name": "test_term_glossary",
    "shortDescription": "SD",
    "longDescription": "Long Description"
}
==========================================================

4. Create term for the glossary:
[POST] <atlas-url>/api/atlas/v2/glossary/term
Body:
{
    "name": "test_term",
    "anchor": {
        "glossaryGuid": "<glossary-guid>"
    }
}
Response:
{
    "guid": "<term-guid>",
    "qualifiedName": "test_term@test_term_glossary",
    "name": "test_term",
    "anchor": {
        "glossaryGuid": "<glossary-guid>",
        "relationGuid": "<relationship-guid>"
    },
    "glossaryTermHeader": {
        "termGuid": "<term-guid>",
        "qualifiedName": "test_term@test_term_glossary"
    }
}
==========================================================

5. Associate term to the entity:
[POST] <atlas-url>/api/atlas/v2/glossary/terms/<term-guid>/assignedEntities
Body:
[{"guid": "<entity-guid>"}]

This will return the error in response:
{
    "errorCode": "ATLAS-400-00-036",
    "errorMessage": "invalid relationshipDef: AtlasGlossarySemanticAssignment: 
end type 1: Referenceable, end type 2: AtlasGlossaryTerm"
}
{code}
\\
{color:red}*Note:*{color}  Text in angular brackets (<>) are placeholders and 
contain guids or other related info from the previous steps



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to