Neo4j and graph databases Presented By: Stephanie McIntyre
Graph Databases: The Database Model The Database Model determines the logical structure . Graph databases (GDB) have the following characteristics: Data & Schema are represented by a graph. ● Manipulation of data is expressed by graph transformations. ● The driving force of this model is the focus on the relationships between entities .
Graph Databases: Data & Schema A GDB is a directed, labelled, attributed multigraph. Nodes : connected entities ● defined by unique id ○ Edges : binary relations ● direction, start node, end node ○ Properties : descriptive information ● on nodes, sometimes on edges ○ Nodes & Edges are tagged with labels .
Graph Databases: Data & Schema No global adjacency index. ● (exception: Neo4j for starting points). Each node and edge stores a mini-index of all of the ● connected objects . No NULLs ● GDBs have an ad-hoc schema that is easily mutable. ● Neo4j supports schema-less ○
Graph Databases: Going for a Walk Query processing makes use of graph-based algorithms and retrieval of information requires graph traversal, aka “ walking ”. When retrieving information, it only looks at the objects directly connected to the node. Graph databases are typically better than relational databases at handling recursion .
Graph Databases: Example CS848 e Photo n databases r enrolled_in o s p l Arts l e r i spring 2018 d n _ g i n 2 teaches 0 1 n 8 i _ d e enrolled_in artist l l o 8 hobbyist r 1 n 0 spring 2018 e 2 g n i amateur r p s g n artist i r e friends_with friends_with f f o _ David e friends_with friends_with has_advisor s Ahmed Yue Bharath Toman r u o c Steph age: 30 student_at student_at CS_grad hired: 1998 employs s t CS_grad professor_at u d e n C t _ S a _ t g r a CS_dept t a d _ t n e d u d a t s r g _ S C UW university
Graph vs Relational Databases Some differences... Graph Databases (Neo4j) Relational Databases Mathematical Model Property Graphs N-ary Predicates Relationships Record Level Table Level Schema Schema-less or on labels Schema Based Query Processing Localized Indexes, Keys Costly Queries Find all Many-to-Many Table Joins Data Manipulation Easily Mutable Table Alterations Integrity Constraints …. ^-^
Neo4j’s Integrity Constraints Inherent Constraints : Node IDs are unique and edges are composed of labels and the nodes where the edge occurs. Node Property Uniqueness : given property is unique for nodes. Relationship Property Existence : relationships with a given label have a given property. Node Keys : existence of given properties and uniqueness of the combination thereof for a given label.
Recommend
More recommend