0% found this document useful (0 votes)
10 views

Lec3 Advanced Data Model

Uploaded by

bnhatm216
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lec3 Advanced Data Model

Uploaded by

bnhatm216
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Lecture 3

Advanced Data
Models
Introduction
Data Model Integrated collection of concepts for describing
data, relationships between data, and constraints on the
data in an organization.
 Data Model comprises:
◦ a structural part;

◦ a manipulative part;

◦ possibly a set of integrity rules.

2
Advanced Data Models

DeductiveData Model
Graph Data Model
Document Model
 Key-Value and Wide Column Models

3
DEDUCTIVE DATA MODEL
Deductive Data Model
 The deductive data model fundamentally
involves the application of formal logic to the
problems of data definition, data manipulation
and data integrity.
 Logic can act as a formal basis for expressing in
one uniform manner these three aspects of a
data model.
 Logic also provides the capacity to extend the
idea of conventional database with deductive
facilities.
 Most of the work on deductive databases has
been done using variants of standard Prolog
known collectively as Datalog.
 Datalog is fundamentally a variant of Prolog
specifically designed for databases work. 5
PROPOSITIONS AND RELATIONS
 The fundamental data elements in the deductive data
model are propositions.
 Propositions may combine to form data structures
called relations.
 Example

suppose that we want to represent the following


assertions(‫دات‬.‫ )تاكي‬relevant to the university database
:Relational Database Systems is a module
Shehab is a student
Shehab is taking Database
In Datalog we represent such assertions as:
module(Advanced Databases Systems).
student(Shehab).
takes(Shehab, module(Advanced Databases
Systems)).
6
PROPOSITIONS(‫ ) افتراضات‬AND RELATIONS

 Within logic the terms ‘module’, ‘takes’ and


‘student’ are called predicates(‫ريح‬.‫)إعالن أو تص‬,
while the terms ‘Database’ and ‘Shehab’ are
called arguments.
 Predicates are written first followed by
arguments.
 Arguments(‫ )قيم‬are enclosed in brackets(‫بين‬
‫ين‬..‫)قوس‬, delimited(‫دد‬..‫ )تح‬by commas. The
whole assertion is concluded with a period.
 Predicates and arguments form a collection
known as a proposition, and each proposition
may take only one of two possible values,
namely, true or false.
7
CONNECTIVES
 Individual propositions are often referred to as
being ‘atomic’. By this is meant that the
internal structure and meaning of such
propositions are not determined by the logic.
 They are in a sense the primitive material from
which we build. Such atomic propositions may
however be combined by the use of logical
connectives with special symbols. These
include:
(AND), (OR), ¬ (NOT) and ⇒ IMPLIES
 lecturer (Nasser) ^ teaches(Nasser,
module(Advanced Databases Systems).
which reads, Nasser is a lecturer and Nasser
teaches module(Advanced Databases Systems
8
GRAPH Databases MODEL

9
?What is a Graph
• Formally, a graph is just a collection of vertices
and edges—or, in less intimidating(‫دا‬.‫ )تعقي‬language, a
set of nodes and the relationships that connect
them.
• Graphs represent entities as nodes and the ways in
which those entities relate to the world as relationships.
• This general-purpose, expressive structure allows us to
model all kinds of scenarios, from the construction of a
space rocket(.‫واريخ‬.‫)ص‬, to a system of roads, and from
the supply-chain or provenance(‫ادر‬......‫)مص‬ of
foodstuff(‫ة‬.......‫)األغذي‬, to medical history for
populations(‫)المجتمعات السكانية‬, and beyond.
10
Example of Graph
 For example, Twitter’s data is easily represented as a graph.
We see a small network of followers. The relationships are
key here in establishing the semantic context: namely, that
Billy follows Harry, and that Harry, in turn, follows Billy. Ruth
and Harry likewise follow each other, but sadly, although
Ruth follows Billy, Billy hasn’t (yet) reciprocated.

Publishing messages

A small social graph 11


The Property Graph Model
A property graph has the following
characteristics:
- It contains nodes and relationships
- Nodes contain properties (key-value pairs)
- Relationships are named and directed, and
always have a start and end node.
- Relationships can also contain properties.
 Most of peoples find the property graph model
intuitive easy to understand.
 Although simple, it can be used to describe the
overwhelming(‫امل‬..‫ )ش‬majority of graph use
cases in ways that yield useful insights into our
data.

12
Graph Database Model
 A graph database management system (a
graph database) is an online database
management system with Create, Read,
Update, and Delete (CRUD) methods that
expose(‫ )عرض‬a graph data model.
 Graph databases are generally built for use with
transactional(OLTP) systems.
 Accordingly, they are normally optimized for
transactional performance, and engineered with
transactional integrity and operational availability in
mind.
13
Motivations of Graph
Databases
 The necessity to represent, store and
manipulate complex data make RDBMS
somewhat obsolete
◦ Multi-valued attributes
◦ Complex attributes
◦ Complex combination of the previous two
 Accommodate(‫ )استيعاب‬Changes
◦ Appears when acquiring data from autonomous
dynamic sources or Web (eg: genexp &
restaurants).
◦ RDBMS may require schema renormalization.
 Unified representation for Data
◦ Knowledge (Schemas are a subset of this)
◦ Queries (More generally: Goals) [results + def]
◦ Models (Concepts are a particular example)
14
Data Representation in Graph
Sailors(‫()البحارة‬sid:integer,
sname:char(10),
rating(‫)تصنيفه‬: integer, age:real)
Boats(‫()قوارب‬bid:integer, bname:char(10),
color:char(10))
Reserve(‫()حجز‬sid:integer, bid:integer, day:date)

15
Document Model

16
Document Model
 Whereas relational databases store data in rows and columns,
document databases store data in documents.
 These documents typically use a structure that is like

JSON (JavaScript Object Notation),


 a format popular among developers.
 Documents provide an intuitive and natural way to model
data that is closely aligned with object-oriented programming
 Each document is effectively an object.
 Documents contain one or more fields, where each field
contains a typed value, such as a string, date, binary or array.
Document Databases Applications

Applications: Document databases are


general purpose,

useful for a wide variety of applications


due to the flexibility of the data model,
the ability to query on any field and the
natural mapping of the document data
model to objects in modern programming
languages.
18
Key-Value and Wide Column
Models

19
Key-Value and Wide Column Models

 From a data model perspective, key-value stores


are the most basic type of NoSQL database.
 Every item in the database is stored as an
attribute name, or key, together with its value.
The value, however, is entirely opaque(‫امض‬.‫ )غ‬to
the system; data can only be queried by the key.
 This model can be useful for representing
polymorphic(‫كال‬...‫دد األش‬...‫)متع‬ and unstructured
data, as the database does not enforce a set
schema across key-value pairs.
20

You might also like