AgensGraph can support inheritance between labels like OOP (Object oriented Programming). ‘Label Inherits ‘ help to make decreasing entities to modeling when modeling real-world to graph-model. But that don’t mean that child label inherits properties of parent. (AgensGraph is based on key-value model)

Above image show simple label model using inherits. For example, Data created with label ‘c’ can be access by label ‘a’ or label ‘c’.
create vlabel a; -- parent 'a'
create vlabel b; -- parent 'b'
create vlabel c inherits (a, b); -- child 'c'
Label of graph data (vertex or edge) can be retrieved using label and labels function. (ref. AgensGraph manual)
- label(data) : show lowest label of data
- labels(data) : show all labels of data with array format
This is another example about label modeling. When you want data fabric of merging from DB1 and DB2, each DB have tables having same name. If you need to access all data of table having same name and sub-data of one DB, what can you do? Let’s see this query.

We first make label about two datasource. And label ‘Person’ is the real label we want for importing data from two datasource. But importing data must be distinguished each other. So we create two child labels inherited label ‘Person’ and datasources’ labels.
From now, imported data with child label can be accessed by label ‘Person’ and label ‘DB1’/’DB2’. And you can access all person data by label ‘Person’ or all data from DB1 by label ‘DB1’.

Label ‘Person’ means entity what you want describe in Graph model. You can query graph-search using cypher about all ‘Person’ data. Label ‘DB1’ and ‘DB2’ means datasource what you import data from. You can register new datasource and import data from that and drop all data of that datasource. If you want preprocessing specific person data of one datasource, you should access data by child label.
Enjoy graph-query with AgensGraph.