You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Mandy Chessell <ma...@uk.ibm.com> on 2017/05/18 08:56:52 UTC

Composition relationships

Hello Madhan,
I am working my way through the open metadata model and working out how to 
stitch it to the existing structures.  I wanted to be sure I am 
understanding the JSON properly

I am looking in addons/models/0030-hive_model.json at the relationships 
between hive_table and hive_column, hive_db.  All of these are entities. 

Firstly, hive_table declares an attribute called db of type hive_db: There 
is no ownedRef entry nor a matching entry in the hive_db definition so I 
am assuming that db is just a complex atribute and there is no navigation 
from hive_db to hive_table?   What is the difference between defining 
hive_db as an entity rather than a struct? 

        {
            "name": "hive_table",
            "superTypes": [
                "DataSet"
            ],
            "typeVersion": "1.0",
            "attributeDefs": [
                {
                    "name": "db",
                    "typeName": "hive_db",
                    "cardinality": "SINGLE",
                    "isIndexable": false,
                    "isOptional": false,
                    "isUnique": false
                },
                :
         }

Next, hive_table seems to have a 2 way composition relationships between 
itself and hive_column called columns<->table.  These are definitions for 
the relationship in these entities:

        {
            "name": "hive_table",
            "superTypes": [
                "DataSet"
            ],
            "typeVersion": "1.0",
            "attributeDefs": [
                :
                {
                    "name": "columns",
                    "typeName": "array<hive_column>",
                    "cardinality": "SINGLE",
                    "constraints": [
                        {
                            "type": "ownedRef"
                        }
                    ],
                    "isIndexable": false,
                    "isOptional": true,
                    "isUnique": false
                },
                :
                : 
            ]
        },

      {
            "name": "hive_column",
            "superTypes": [
                "DataSet"
            ],
            "typeVersion": "1.0",
            "attributeDefs": [
                :
                {
                    "name": "table",
                    "typeName": "hive_table",
                    "cardinality": "SINGLE",
                    "constraints": [
                        {
                            "type": "inverseRef",
                            "params": {
                                "attribute": "columns"
                            }
                        }
                    ],
                    "isIndexable": false,
                    "isOptional": true,
                    "isUnique": false
                }
            ]
        },

However, a similar definition in hive_table for partitionKeys does not 
have an inverseRef entry in hive_column - does that make it one way?  What 
does the "OwnedRef" declaration do in this case?

 {
            "name": "hive_table",
            "superTypes": [
                "DataSet"
            ],
            "typeVersion": "1.0",
            "attributeDefs": [
                :
                :
                {
                    "name": "partitionKeys",
                    "typeName": "array<hive_column>",
                    "cardinality": "SINGLE",
                    "constraints": [
                        {
                            "type": "ownedRef"
                        }
                    ],
                    "isIndexable": false,
                    "isOptional": true,
                    "isUnique": false
                },
                :
                : 
            ]
        },

Is there any difference in the behaviour of the relationship called db (to 
hive_db) and the one called partitionKeys?

This is the UML I have derived 



Also, do you have example JSON structures for classifications?

Many thanks for your help

All the best
Mandy
___________________________________________
Mandy Chessell CBE FREng CEng FBCS
IBM Distinguished Engineer

Master Inventor
Member of the IBM Academy of Technology
Visiting Professor, Department of Computer Science, University of 
Sheffield

Email: mandy_chessell@uk.ibm.com
LinkedIn: http://www.linkedin.com/pub/mandy-chessell/22/897/a49

Assistant: Janet Brooks - jsbrooks12@uk.ibm.com