# Comparing Graph And Relational Data Models-Books Pdf

08 Mar 2020 | 19 views | 0 downloads | 34 Pages | 1.63 MB

Share Pdf : Comparing Graph And Relational Data Models

Download and Preview : Comparing Graph And Relational Data Models

Report CopyRight/DMCA Form For : Comparing Graph And Relational Data Models

## Transcription

Introduction 3,Relational Data Model 3,Graph databases 3. Graph Schemas 4,Selecting vertex labels 4,Examples of label selection 4. Drawing a graph schema 6,Converting ER models to graph schemas 9. ER models and diagrams 9, Procedure to convert an ER model to a graph schema 10. Rule 1 Entity types become vertex types 10, Rule 2 Binary relationship types become edge types 11.
Rule 3 N ary relationship types become vertex types 12. Conversion example 12,Vertices are vertices and edges are edges 13. Summary 13,Normalizing Graph Schemas 14,Normalization of relational databases 14. Transformation rules that produce equivalent schemas 14. Rule A Renaming properties and labels 15,Rule B Reversing edge directions 16. Rule C Property displacement 17,Rule D Specialization and generalization 18. Rule E Edge promotion 19,Rule F Property promotion 20.
Rule G Property expansion 21,Summary 22,One meta rule for normalization 23. Schemas and constraints 23, Graph universes transformations and equivalence 23. Derived types 24,Meta rule Adding and removing derived types 25. Proving the meta rule 25, Proving the 7 rules Renaming Reversing Property Displacement 26. Beyond transformation rules 26,Summary 26,Validating graph schemas 27.
Pixy First order logic on graph databases 29,Background 29. On first order logic 29,On Gremlin 29,Pixy First order logic with Gremlin 30. ER models in Pixy 31, Query requirements don t usually matter while modeling 32. Conclusion 33,Introduction,Relational Data Model, The relational data model has long maintained its supremacy over other database models because of its. general purpose nature Specifically there are three pillars that support the relational data model. 1 Expressive power It is well known that conceptual models such as the entity relationship. model and UML class diagrams with some limitations can be converted to relational schemas. Such methods are integral to the subject of relational database design. 2 Strong design guidelines aka normalization A relational schema derived from a higher level. model such as an ER or UML diagram can be normalized using well defined rules These rules. provide data model designers with useful guidelines on developing schemas. 3 A powerful query language aka SQL SQL the query standard for relational databases can. convey any query expressible in first order logic The provably expressive power of SQL is a key. strength of the relational model,Graph databases, The supremacy of the relational model and SQL has been challenged recently by the NoSQL.
movement for various reasons most notably better performance The property graph model which is. supported by most graph databases is one of the non relational data models in the NoSQL movement. This document shows that the property graph model can match relational databases in terms of its. expressive power design guidelines and query methods. Graph Schemas,Selecting vertex labels, The Tinkerpop property graph model can be summarized as follows A graph has a set of vertices and a. set of edges Each edge connects an out vertex to an in vertex Vertices and edges can have properties. which are key value pairs with String keys and pretty much any value that the underlying database. So far the model looks schema less since vertices and edges can t be distinguished from other vertices. and edges without knowing what the properties mean However edges have always had labels And. with Tinkerpop 3 vertices will have labels as well The same is true with Neo4J s latest major version. If every vertex must be labeled what is the correct method to select a label What should a label say. about a vertex or an edge from the application s perspective. We think a vertex label should represent the most granular type of the vertex where each vertex type. is associated with a unique combination of,1 meaning semantics. 2 set of property key names and value types and, 3 set of outgoing edge labels where each label type is annotated with the possible directions of. the edge in out both and cardinality, Why so Because labels representing vertex types give the application the most detailed information. about the behavior of that vertex thereby ensuring that the application can process the vertex. accordingly In other words one should not be able to sub divide a vertex type to get two vertex types. that behave differently from the application s standpoint. Examples of label selection, Let s go through the label selection exercise with the classic 6 vertex tinker graph shown in the.
property graph model page Since this is a Tinkerpop 2 style graph it doesn t have vertex labels We ll. now try to come up with the vertex labels by simply looking at the vertex behavior. Figure 1 TinkerGraph example, If you look closely there are two types of vertices ones with name and age and ones with name and. lang Let us label the former vertex type as Person and the latter vertex type as Software In other. words you have persons named marko vadas peter and josh and softwares named lop and. After analyzing the edge labels and direction you could say that the Person vertex type has. Property keys name and age,Edges labeled knows in the OUT direction. Edges labeled created in the OUT direction,The Software vertex type has. Property keys name and lang,Edges labeled created in the IN direction. Now an application looking at this graph automatically knows what to expect when it reads a vertex. labeled Person or Software We can define two different indexes on name one for Person and one. for Software to make sure that software searches don t pick up people or vice versa. The label selection process can t be fully mechanical though For instance a person with no friends can. be thought of as a separate vertex type because there are no adjacent knows edges to such vertices. However unless this makes sense in the context of the application or the data model there is no point. in sub dividing the Person vertex type as Loner and Person with Friends The same argument goes for. sub dividing the person vertex type as the Developer and Non Developer based on whether that. person created a software, To recap the right way to select vertex labels for a property graph is to first figure out the vertex types.
and the behaviors of each vertex type The totality of these behaviors is the graph schema. Drawing a graph schema, The best way to represent a graph schema is of course a graph This is how the graph schema looks for. the classic Tinkerpop graph, Figure 2 Example graph schema shown as a property graph. The graph schema is pretty much a property graph The vertices correspond to vertex types and edges. correspond to edge types The property keys are named after the allowed property keys for that vertex. type Every property value in the schema graph contains the name of the most specific super class. representing the corresponding property values of the instance graph Optional properties can have a. after the class name not shown here, Edge properties are like vertex properties except that there is a special property named that holds. the cardinality from the out to in vertex types Common sense dictates that the cardinality is M N i e. many to many for both knows and created One could be misled to think that some of these. relationships are 1 N by looking at the 6 vertex graph This is another reason for not fully relying on. reverse engineering methods to derive schemas, We have gone through a similar exercise for the Grateful Dead graph As you can see the graph schema. is very simple although the visualization of the graph shown in the link looks complicated. Figure 3 Grateful Dead graph schema, Our third and final example is the schema for the Kennedy family tree graph Again the schema is.
extremely simple simplistic given recent US Supreme Court rulings. Figure 4 Family tree graph schema, Note that in the Pixy schema the property lists are the same for Man and Woman but the direction. of the wife edge is functionally dependent on the value of the sex property This is very interesting. because this means that graph schemas could be normalized using rules like relational databases We. will discuss this in later sections, This section introduced the idea of schemas for property graphs and described how the schema itself. can be represented as a property graph Furthermore it described a method to derive the graph schema. for an existing property graph by finding the most granular division of its vertices into vertex types. Graph schemas or schema graphs help application developers better understand the graph s structure. In the next section we will look at the problem the other way around Can we derive a graph schema. from a higher level conceptual model such as an Entity Relationship model Could this be a systematic. method to select vertex and edge labels and property keys when designing a graph database. application,Converting ER models to graph schemas, This section will describe a general method to convert an entity relationship model to a property graph. schema Using this method a database designer can develop ER models using standard conceptual. modeling practices but store the data in a graph database instead of a relational database. ER models and diagrams, The entity relationship model was proposed by Peter Chen in his 1976 paper titled The Entity. Relationship Model Toward a Unified View of Data The ideas in this paper are taught in most. database courses This course page gives a quick description of the ER model. Conceptual modeling is a particularly useful exercise when embarking on a project that involves a new. domain The goal of this exercise is to identify key concepts in the domain that must be captured in the. data model One of the techniques in conceptual modeling is to look at the natural language description. of an application s requirements These requirements can be analyzed to identify the entity and. relationship types using Chen s rules of thumb quoted from Wikipedia. Common noun Entity type,Proper noun Entity,Transitive verb Relationship type.
Intransitive verb Attribute type,Adjective Attribute for entity. Adverb Attribute for relationship,Let us consider the following requirements. Model a system where users create pages which they own Users can invite other users to look. at certain pages that they own A page can specify one or more tags which are then used to. recommend other sections to the authors and invited readers. You could analyze this requirement and come up with three entity types viz User Page and Tag The. relationship types Owns Invites and Tagged As capture the relationships Note that all verbs don t. become relationships like create Similarly the fact that invitations only apply to pages that a user. owns is lost in this model,Figure 5 Example ER diagram. The square shaped boxes show entity types which represent sets of similar entities The diamond. shaped boxes show relationship types which represent sets of similar relationships A relationship type. relates two or more entity types to each other, The diagram shows the cardinality of each entity s contribution to a relationship such as 1 N one to. many or N N many to many The cardinality is specified using the look across method For example a. User owns N pages and a page is owned by 1 user There are known limitations of look across. cardinality for ternary relationships like Invites. The diagram also shows some oval shaped attributes like user name These attributes must be assigned. to entity or relationships types Attributes that serve as external identifiers must be underlined. Now it is arguable whether Tag must be an entity or not in the final data model But from an ER. perspective it makes sense to model tag as an entity especially if tags are used to establish. relationships across users for recommendations, Procedure to convert an ER model to a graph schema.
The procedure to convert an ER model to a relational model is well known and discussed in the same. OSU course notes that we referenced earlier We will now go through a similar procedure the ER. diagram with the above example,Rule 1 Entity types become vertex types. Entity types such as User Page and Tag become vertex types. The name of the entity type becomes the label of the vertex type. The associated attributes become the properties of the vertex type. Here is an example showing User, Figure 6 User entity converted to a user vertex type. Note that we are drawing a graph schema not a graph instance So the User type refers to any number. of users in both the ER and the graph schema representation Hence we use the term vertex type and. not vertex The entity relationship model uses similar terms such as entity types like User and. entities like John Doe the user, Rule 2 Binary relationship types become edge types. All binary relationship types in the ER diagram can be converted to edge types in the graph schema. The name of the relationship type becomes the label of the edge type. The associated attributes become the properties of the edge type. The end points of the edge type are the vertex types corresponding to the related entity types. The direction doesn t matter, Here is an example showing the Owns relationship type translated to an owns edge type. Figure 7 Owns relationship converted to an owns edge. Note that one to many and many to many binary relationships can be modeled as edges without. introducing new vertices With relational models you would need an additional table to capture many. to many relationships, A minor point is that the cardinality is written as 1 N because the User out vertex type to Page in.
vertex type relationship is a 1 N relationship using the look across method In other words a user has. N pages and a page has 1 user If the direction of the edge were reversed the cardinality would be N 1. Rule 3 N ary relationship types become vertex types. N ary relationship types relate more than two entity types Such relationship types become vertex types. in the property graph model, The name of the relationship type becomes the label of the vertex type. The associated attributes become the properties of the vertex type. The new vertex type includes edges to the vertex types corresponding to the related entity. types see example These edge types are labeled after the role of the participating entity in the. relationship The direction doesn t matter for any of these edges. Here is an example showing the ternary relationship Invites translated to the vertex type Invitation. Figure 8 Invites relationship converted to an Invitation vertex type. The cardinality in the graph schema is N 1 because the Invitation to Page relationship is an N 1. relationship using the look across method In other words an invitation could be issued to 1 page and. a page in vertex could be part of N invitations It is possible to just reverse some of the role types like. invitee without affecting the overall model In that case the cardinality will be 1 N. We haven t shown the process for weak entity types and identifying relationship types but these are. exactly the same as entity types and relationship types Graph databases are more forgiving than. relational databases in that they allow two vertices to have the same label and property key value pairs. This simplifies the translation of weak entity types and identifying relationship types into the property. graph model,Conversion example, Here is the graph schema corresponding to the example ER diagram As you can see this diagram. provides enough information for an application developer to work with the graph database. Figure 9 Graph schema for User Page Tag ER diagram. This is the logical model for the example conceptual model introduced in the first figure We can. tweak this model further by renaming the labels changing directions of the edges and so on This will. be the topic of the next section,Vertices are vertices and edges are edges. N ary relationships are very common in conceptual models For example Joe bought a headphone at. Target is an example of a Bought relationship that relates a User to a Product to a Store Such. relationships must be modeled as vertices not edges unless you are using hypergraphs Hence we. think it is misleading to think of edges as relationships and vertices as entities. It is better to think of graphs are visualize able representations of a conceptual model We emphasize. the visual nature of graphs because drawing and thinking in terms graphs is easy For instance you go to. the Wikipedia entry for hypergraphs you will see why visualizing hypergraphs isn t as easy as visualizing. binary graphs, This section showed that it is possible to convert any entity relationship model to a property graph. schema In other words a data architect can use standard methods to model a domain as an ER diagram. and then follow this procedure to convert it to a property graph schema This type of a translation is not. obvious for other popular NoSQL models like key value stores and document stores. Normalizing Graph Schemas, This section looks at how graph schemas can be manipulated and transformed to equivalent graph.
schemas This is similar to the splitting and merging of tables in relational data models typically. performed to normalize or de normalize a relational schema. Normalization of relational databases, The goal of database normalization is make sure that relational schemas are easy to modify easy to. extend informative to users and supportive of various query patterns The various normal forms such. as 1NF 2NF and so on define constraints that a table must satisfy to be compliant with that normal. form Although the definitions of the normal forms can be mathematical the basic idea is break up. tables with duplicate information Here is an example from the Wikipedia page on 3NF. The previous figure breaks up the tournament winners table into two tables one with player details and. one with the tournament details The actual rules on functional dependencies and non prime. attributes are hard to remember but the process of splitting and merging tables comes intuitively with. experience For example if there was an existing table which had one row per player we d probably. move the date of birth to that table, Transformation rules that produce equivalent schemas. This section lists some transformation rules that produce equivalent graph schemas A graph schema is. equivalent to another graph schema if the data stored in one schema along with the applications that. access it can be ported to the other schema and vice versa These rules are like splitting and merging.

## Related Books

###### Description of Field States with Correlation Functions and ...

Description of Field States with Correlation Functions and Measurements in Quantum Optics Sergiy Lyagushyn and Alexander Sokolovsky Oles Honchar Dnipropetrovs'k National University Ukraine 1. Introduction Modern physics deals with the consistent quantum concept of electromagnetic field. Creation and annihilation operators allow describing pure quantum states of the field as excited states of ...

###### December 2014 PUbLISHeD bY KeNNeTH HAGIN mINISTrIeS

Kenneth hagin Ministries Working Together to Reach the World! 1025 W. KeNoSHA broKeN ArroW, oK 74012 VOLUMe XLiV, nUMber 4 MaY 2011 DIrecTor of commUNIcATIoNS Patty Harrison SeNIor eDITor bob murphy eDITorIAL STAff Jeff bardel Kimberly Hennenfent Peggy rice Janet Wagner GrAPHIc ArTISTS Kristen cook Lydia Galaz Jeanne Hoover J.P. Jones Amanda King Amber Warner rose Wenning PHo ToGrAPHer Phil ...

###### Julia Werner, Christian Ebel, Christian Spannagel, Stephan ...

ISBN 978-3-86793-870-9 (E-Book EPUB) Dieses Werk ist lizenziert unter einer Creative Commons Namensnennung, Weitergabe unter gleichen Bedingungen 4.0 International (CC BY-SA 4.0) Lizenz.

###### AGRIC SCIENCE BASIC ELECTRONICS

YORUBA 1. Tumo awon gbolohun wonyi si ede Yoruba: i. We must always thank God for His blessing. ii. I believe him. iii. Punctuality is the soul of business. iv. Death cannot be cured but infirmity can. v. A tree does not make a forest. 2. Salaye awon wonyi ninu ebi Yoruba: a. Daodu b. Bere d. Aremo e. Obakan e. Iyekan. 6 SS2 HOLIDAY DELGHT AGRIC SCIENCE 1. Explain the following terms in forest ...

###### Prefixes and Suffixes - images.carsondellosa.com

of the prefix, suffix, or spelling change patterns. The fifth lesson in each cycle is a Word Wall lesson in which five words are added to the word wall. These words include words with prefixes or suffixes and some commonly misspelled words. The most common compound words and contractions are also included on the word wall. Following the 120 lessons are some Review and Extension Activities ...

###### Prefixes, Root Words, and Suffixes

suffix - to make new words. ful 5. Spell and prove three skill words from the word bank. 6. Rewrite two words from the word bank that already have a prefix and suffix, and then underline the prefix and suffix. 7. Spell and prove two skill words from the word bank. 8. Spell and prove two root words (+) from the word bank. Then rewrite the words ...

###### The Dynamic Advertising Effect of Collegiate Athletics final

The Dynamic Advertising Effect of Collegiate Athletics Doug J. Chung* April 2013 * Doug J. Chung is an assistant professor of business administration at Harvard Business School (dchung@hbs.edu). The author would like to thank the editor, associate editor, and two anonymous reviewers, as well as Neil Bendle,

###### LAPORAN PRAKTEK KERJA PROFESI APOTEKER DI APOTEK MITRASANA ...

2.3 Tugas dan Fungsi Apotek Berdasarkan Peraturan Pemerintah No. 51 Tahun 2009, tugas dan fungsi apotek adalah: a. Tempat pengabdian profesi seorang apoteker yang telah mengucapkan sumpah jabatan apoteker b. Sarana farmasi yang melaksanakan peracikan, pengubahan bentuk, pencampuran dan penyerahan obat atau bahan obat. c. Sarana penyalur perbekalan farmasi yang harus menyebarkan obat yang ...

###### Pengertian Fungsi Bahasa - Perpustakaan UT

Pengertian Fungsi Bahasa Dr. Setiawati Darmojuwono, M.Phil. atakuliah ini berisi materi dasar tentang fungsi bahasa dilihat dari aspek struktural, aspek kognitif dan aspek komunikatif. Dalam mata kuliah ini diuraikan konsep-konsep dasar yang terkait dengan beberapa model utama fungsi bahasa dalam komunikasi. Di samping itu juga diberikan contoh peran fungsi bahasa dalam proses penerjemahan ...

###### FUNGSI DAN PERANAN TEORI DALAM PRAKTEK KONSELING

5 Makalah: FUNGSI TEORI DLM KONSELING, Sunardi, PLB FIP UPI, 2008 Teeori adalah kebenaran yang tidak terbantahkan, sebelum muncul teori baru yang dapat menumbangkan teori tersebut. Keyakinan terhadap kebenaran toeri ini menjadikan fungsi toeri adalah menjelaskan kebanaran dalam menerangkan suatu gejala yang dapat dipertanggungjawabkan secara ilmiah, karena didukung oleh fakta-fakta empirik ...