Unit-4 Enhanced Data Models for Advanced Applications

Unit-4 Enhanced Data Models for Advanced Applications. Dr. K. Raghava Rao Professor of CSE Dept. of MCA,KL University krraocse@gmail.com http://advdbms.blog.com. Active Database Concepts and Triggers. Generalized Model for Active Databases and Oracle Triggers

Share Presentation
Embed Code
Link
Download Presentation

lukas

lukas + Follow

Download Presentation

Unit-4 Enhanced Data Models for Advanced Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

Presentation Transcript

  1. Unit-4Enhanced Data Models for Advanced Applications Dr. K. RaghavaRao Professor of CSE Dept. of MCA,KL University krraocse@gmail.com http://advdbms.blog.com
  2. Active Database Concepts and Triggers Generalized Model for Active Databases and Oracle Triggers Triggers are executed when a specified condition occurs during insert/delete/update Triggers are action that fire automatically based on these conditions
  3. Event-Condition-Action (ECA) Model • Triggers follow an Event-condition-action (ECA) model • Event: • Database modification • E.g., insert, delete, update, • Condition: • Any true/false expression • Optional: If no condition is specified then condition is always true • Action: • Sequence of SQL statements that will be automatically executed
  4. Trigger Example When a new employees is added to a department, modify the Total_sal of the Department to include the new employees salary; CREATE TRIGGER Total_sal1 AFTER INSERT ON Employee FOR EACH ROW WHEN (NEW.Dno is NOT NULL) UPDATE DEPARTMENT SET Total_sal = Total_sal + NEW. Salary WHERE Dno = NEW.Dno;
  5. Trigger Example • From the previous example we can find that: • Logically this means that we will CREATE a TRIGGER, let us call the trigger Total_sal1 • This trigger will execute AFTER INSERT ON Employee table (EVENT) • It will do the following FOR EACH ROW • WHEN NEW.Dno is NOT NULL (CONDITION) • The trigger will UPDATE DEPARTMENT (ACTION) • By SETting the new Total_sal to be the sum of • old Total_sal and NEW. Salary • WHERE the Dno matches the NEW.Dno;
  6. CREATE or ALTER TRIGGER • CREATE TRIGGER • Creates a trigger if one does not exist • ALTER TRIGGER • Alters a trigger if one does exist • Works in both cases, whether a trigger exists or not
  7. Conditions Conditions can be one of the following: • AFTER • Executes after the event • BEFORE • Executes before the event • INSTEAD OF • Executes insteadof the event • Note that event does not execute in this case • INSTEAD OF triggers are used for modifying views
  8. Row-Level VS. Statement-level • Triggers can be • Row-level • FOR EACH ROW specifies a row-level trigger • Executed separately for each affected row • NEW and OLD keywords can be used here • Statement-level • Default (when FOR EACH ROW is not specified) • Execute once for the SQL statement,
  9. Condition • Any true/false condition to control whether a trigger is activated or not • Absence of condition means that the trigger will always execute for the even (True) • Otherwise, condition is evaluated • before the event for BEFORE trigger • after the event for AFTER trigger
  10. Action • Action can be • One SQL statement • A sequence of SQL statements enclosed between a BEGIN and an END • Action specifies the relevant modifications
  11. Active Database Concepts and Triggers Design and Implementation Issues for Active Databases • An active database allows users to make the following changes to triggers (rules) • Activate • Deactivate • Drop
  12. Active Database Concepts and Triggers An event can be considered in 3 ways: • Immediate consideration: • Part of the same transaction and can be one of the following depending on the situation • Before • After • Instead of • Deferred consideration: • Condition is evaluated at the end of the transaction • Detached consideration: • Condition is evaluated in a separate transaction
  13. Active Database Concepts and Triggers Potential Applications for Active Databases • Notification • Automatic notification when certain condition occurs • Enforcing integrity constraints • Triggers are smarter and more powerful than constraints • Maintenance of derived data • Automatically update derived data and avoid anomalies due to redundancy • E.g., trigger to update the Total_sal in the earlier example
  14. Active Database Concepts and Triggers Triggers in SQL-99 Can alias variables inside the REFERENCING clause
  15. Active Database Concepts and Triggers Trigger examples in SQL-99
  16. Temporal Database Concepts Time Representation, Calendars, and Time Dimensions • Time is considered ordered sequence of points in some granularity • Use the term choronon instead of point to describe minimum granularity
  17. Temporal Database Concepts • A calendar organizes time into different time units for convenience. • Accommodates various calendars • Gregorian (western), Chinese, Islamic, Etc. • Point events • Single time point event • E.g., bank deposit • Series of point events can form a time series data • Duration events • Associated with specific time period • Time period is represented by start time and end time
  18. Temporal Database Concepts • Transaction time • The time when the information from a certain transaction becomes valid • Bitemporal database • Databases dealing with two time dimensions
  19. Temporal Database Concepts Incorporating Time in Relational Databases Using Tuple Versioning • Add to every tuple • Valid start time • Valid end time
  20. Temporal Database Concepts
  21. Temporal Database Concepts
  22. Temporal Database Concepts Incorporating Time in Object-Oriented Databases Using Attribute Versioning • A single complex object stores all temporal changes of the object • Time varying attribute • An attribute that changes over time • E.g., age • Non-Time varying attribute • An attribute that does not changes over time • E.g., date of birth
  23. Deductive Databases • Declarative Language • Language to specify rules • Inference Engine (Deduction Mechanism) • Can deduce new facts by interpreting the rules • Related to logic programming • Prolog language (Prolog => Programming in logic) • Uses backward chaining to evaluate • Top-down application of the rules
  24. Deductive Databases • Specification consists of: • Facts • Similar to relation specification without the necessity of including attribute names • Rules • Similar to relational views (virtual relations that are not stored)
  25. Prolog/Datalog Notation • Predicate has • a name • a fixed number of arguments • Convention: Constants are numeric or character strings • Variables start with upper case letters • E.g., SUPERVISE(Supervisor, Supervisee) • States that Supervisor SUPERVISE(s) Supervisee
  26. Prolog/Datalog Notation • Rule • Is of the form head :- body • where “:-” is read as “if and only if” • E.g., SUPERIOR(X,Y) :- SUPERVISE(X,Y) • E.g., SUBORDINATE(Y,X) :- SUPERVISE(X,Y)
  27. Prolog/Datalog Notation • Query • Involves a predicate symbol followed by some variable arguments to answer the question • E.g., SUPERIOR(james,Y)? • E.g., SUBORDINATE(james,X)?
  28. Examples (a) Prolog notation (b) Supervisory tree
  29. Datalog Notation • Program is built from atomic formulas • Literals of the form p(a1, a2, … an) where • p predicate name • n is the number of arguments • Built-in predicates are included • E.g.,
  30. Clausal Form and Horn Clauses • A formula can have quantifiers • Universal • Existential
  31. Clausal Form and Horn Clauses • In clausal form, a formula must be transformed into another formula with the following characteristics • All variables are universally quantified • Formula is made of a number of clauses where each clause is made up of literals connected by logical ORs only • Clauses themselves are connected by logical ANDs only.
  32. Clausal Form and Horn Clauses • Any formula can be converted into a clausal form • A specialized case of clausal form are horn clauses that can contain no more than one positive literal • Datalog program are made up of horn clauses
  33. Interpretation of Rules • There are two main alternatives for interpreting rules: • Proof-theoretic • Model-theoretic
  34. Interpretation of Rules • Proof-theoretic • Facts and rules are axioms • Ground axioms contain no variables • Rules are deductive axioms • Deductive axioms can be used to construct new facts from existing facts • This process is known as theorem proving
  35. Proving a new fact
  36. Interpretation of Rules • Model-theoretic • Given a finite or infinite domain of constant values, we assign the predicate every combination of values as arguments • If this is done for every predicated, it is called interpretation
  37. Interpretation of Rules • Model • An interpretation for a specific set of rules • Model-theoretic proofs • Whenever a particular substitution to the variables in the rules is applied, if all the predicated are true under the interpretation, the predicate at the head of the rule must also be true • Minimal model • Cannot change any fact from true to false and still get a model for these rules
  38. Minimal model
  39. Datalog Programs and Their Safety • A program is safe if it generates a finite set of facts • Two main methods of defining truth values • Fact-defined predicates (or relations) • Listing all combination of values that make a predicate true • Rule-defined predicates (or views) • Head (LHS) of one or more Datalog rules, for example:
  40. Use the Relational Operations • Many operations of relational algebra can be defined in the for of Datalog rules that defined the result of applying these operations on database relations (fact predicates) • Relational queries and views can be easily specified in Datalog
  41. Evaluation of Non-recursive Datalog Queries • Define an inference mechanism based on relational database query processing concepts • Example: predicate dependencies
  42. Knowledge databases
  43. KDD: A Definition KDD is the automatic extraction of non-obvious, hidden knowledge from large volumes of data. KDD is the automatic extraction of non-obvious, hidden knowledge from large volumes of data. 106-1012 bytes: we never see the whole data set, so will put it in the memory of computers What is the knowledge? How to represent and use it? Then run Data Mining algorithms
  44. Data, Information, Knowledge We often see data as a string of bits, or numbers and symbols, or “objects” which we collect daily. Information is data stripped of redundancy, and reduced to the minimum necessary to characterize the data. Knowledge is integrated information, including facts and their relations, which have been perceived, discovered, or learned as our “mental pictures”. Knowledge can be considered data at a high level of abstraction and generalization.
  45. From Data to Knowledge Medical Data by Dr. Tsumoto, Tokyo Med. & Dent. Univ., 38 attributes . 10, M, 0, 10, 10, 0, 0, 0, SUBACUTE, 37, 2, 1, 0,15,-,-, 6000, 2, 0, abnormal, abnormal,-, 2852, 2148, 712, 97, 49, F,-,multiple,,2137, negative, n, n, ABSCESS,VIRUS 12, M, 0, 5, 5, 0, 0, 0, ACUTE, 38.5, 2, 1, 0,15, -,-, 10700,4,0,normal, abnormal, +, 1080, 680, 400, 71, 59, F,-,ABPC+CZX,, 70, negative, n, n, n, BACTERIA, BACTERIA 15, M, 0, 3, 2, 3, 0, 0, ACUTE, 39.3, 3, 1, 0,15, -, -, 6000, 0,0, normal, abnormal, +, 1124, 622, 502, 47, 63, F, -,FMOX+AMK, , 48, negative, n, n, n, BACTE(E), BACTERIA 16, M, 0, 32, 32, 0, 0, 0, SUBACUTE, 38, 2, 0, 0, 15, -, +, 12600, 4, 0,abnormal, abnormal, +, 41, 39, 2, 44, 57, F, -, ABPC+CZX, ?, ? ,negative, ?, n, n, ABSCESS, VIRUS . Numerical attribute categorical attribute missing values class labels IF cell_poly 15 THEN Prediction = VIRUS [87,5%] [confidence, predictive accuracy]
  46. Data Rich Knowledge Poor How to acquire knowledge for knowledge-based systems remains as the main difficult and crucial problem. People gathered and stored so much data because they think some valuable assets are implicitly coded within it. ? knowledge base inference engine Rawdata is rarely of direct benefit. Its true value depends on the ability to extract information useful for decision support. Tradition: via knowledge engineers Impractical Manual Data Analysis New trend: via automatic programs
  47. Benefits of Knowledge Discovery Value Disseminate DSS Generate MIS EDP Rapid Response Volume EDP: Electronic Data Processing MIS: Management Information Systems DSS: Decision Support Systems
  48. Lecture 1: Overview of KDD 1. What is KDD and Why ? 2. The KDD Process 3. KDD Applications 4. Data Mining Methods 5. Challenges for KDD
  49. Multiple process non-trivial process Justified patterns/models valid novel Previously unknown useful Can be used understandable by human and machine The KDD process The non-trivial process of identifying valid, novel, potentially useful, and ultimately understandablepatterns in data - Fayyad, Platetsky-Shapiro, Smyth (1996)
  50. Understand the domain and Define problems Collect and Preprocess Data Data Mining Extract Patterns/Models Interpret and Evaluate discovered knowledge Putting the results in practical use The Knowledge Discovery Process 5 a step in the KDD process consisting of methods that produce useful patterns or models from the data, under some acceptable computational efficiency limitations 4 3 2 1 KDD is inherently interactive and iterative Load More .

CS263 Lec. 4: Enhanced E-R Models

CS263 Lec. 4: Enhanced E-R Models

CS263 Lec. 4: Enhanced E-R Models. Basic ER model introduced in the mid 1970s Since then business relationships and business data have become more complex Enhanced Entity Relationship (EER) model refers to the extension of the original ER model

598 views • 46 slides

Enhanced Data Models for Advanced Database Applications

Enhanced Data Models for Advanced Database Applications

Conventional databases. for large amounts of current only, complex, volatile, structured data, available within an organization e.g., Relational DatabasesEnhanced Data ModelsActiveTemporalSpatialMultimediaStatisticalInformation retrieval. Active Databases. contain a set of active rules Rul

416 views • 15 slides

Advanced Applications

Advanced Applications

Advanced Applications. Universidad de los Andes-CODENSA. 1. Traveling Salesperson Problem. This classical optimization problem cannot be solved using traditional techniques. The goal is to find the shortest route for a salesperson to take in visiting N cities.

649 views • 47 slides

Unit 4: Describing Data

Unit 4: Describing Data

Unit 4: Describing Data. Central Tendency S.ID.2: Use statistics appropriate to the shape of the data distribution to compare center and spread of two or more different data sets. Essential Question: How do I find the mean, median, mode, and range in a numerical set of data?. Vocabulary:

721 views • 59 slides

Unit 4 : Analyzing data

Unit 4 : Analyzing data

Unit 4 : Analyzing data. Review trivia game. How it works.

270 views • 20 slides

Unit 4: Describing Data

Unit 4: Describing Data

Unit 4: Describing Data. Unit 4 Review. Summarize, represent, and interpret data on a single count or measurement variable Summarize, represent, and interpret data on two categorical and quantitative variables Interpret linear models. Unit 4: Lesson 1.

641 views • 41 slides

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models. 4.1 Probabilistic IR 4.2 Statistical Language Models (LMs) 4.2.1 Principles and Basic LMs 4.2.2 Smoothing Methods 4.2.3 Extended LMs 4.3 Latent-Concept Models. 4.2.1 What is a Statistical Language Model?. generative model for word sequence

304 views • 16 slides

Chapter 4 Data-Oriented Models

Chapter 4 Data-Oriented Models

Chapter 4 Data-Oriented Models. Chapter 4 Data-Oriented Models. 4.1. Data Models: The ERD 4.2. Entity-Relationship Modeling 4.3. Object-Oriented Models 4.4. An Introduction to Objects 4.5. Object-Oriented v.s. Object-Based 4.6. Conceptual, Logical & Physical Models

854 views • 66 slides

Advanced Optical Technologies for Data Intensive Applications

Advanced Optical Technologies for Data Intensive Applications

Advanced Optical Technologies for Data Intensive Applications. Kim Roberts iGrid 2005. How do I optically switch my Lightpaths?. Need to have each wavelength arriving at a node be able to leave via any of four other optical lines, or drop locally. Must be low cost. Local Add Drop.

268 views • 14 slides

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models. 4.1 Probabilistic IR 4.2 Statistical Language Models (LMs) 4.3 Latent-Concept Models 4.3.1 Foundations from Linear Algebra 4.3.2 Latent Semantic Indexing (LSI) 4.3.3 Probabilistic Aspect Model (pLSI). Key Idea of Latent Concept Models. Objective:

474 views • 32 slides

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models

Chapter 4: Advanced IR Models. 4.1 Probabilistic IR 4.1.1 Principles 4.1.2 Probabilistic IR with Term Independence 4.1.3 Probabilistic IR with 2-Poisson Model (Okapi BM25) 4.1.4 Extensions of Probabilistic IR 4.2 Statistical Language Models 4.3 Latent-Concept Models.

505 views • 22 slides

Enhanced Data Models for Advanced Applications

Enhanced Data Models for Advanced Applications

Enhanced Data Models for Advanced Applications. Nguyễn Toàn Nguyễn Hữu Vũ. 1. 2. 3. 4. Active Database and Triggers. Temporal Database Concepts. Multimedia Database. Deductive Database. Contents. Active Database AND Triggers. What are “Rules”?

1.11k views • 45 slides

Chapter 4 Data-Oriented Models

Chapter 4 Data-Oriented Models

Chapter 4 Data-Oriented Models. 4.1. Data Models: The ERD 4.2. Paradigm Shift 4.3. Entity-Relationship Modeling 4.4. Object-Oriented Models 4.5. An Introduction to Objects 4.6. Object-Oriented vs Object-Based 4.7. Conceptual, Logical & Physical Models

1.57k views • 108 slides

CE215 Unit 4 Curriculum Models

CE215 Unit 4 Curriculum Models

CE215 Unit 4 Curriculum Models. Feel free to chat informally until seminar begins at the top of the hour. Instructor: Elizabeth Crosby (Prof. Beth). Unit 4 Focus.

498 views • 21 slides

COMP5338 – Advanced Data Models

COMP5338 – Advanced Data Models

COMP5338 – Advanced Data Models. Week 12: Temporal Data Models. Richard T. Snodgrass, Time-Oriented Database Applications, Chapter 2,Chapter 5. Outline. Motivation Time and Temporal Database Concept Implementation using SQL Temporal Queries.

591 views • 35 slides

COMP5338 – Advanced Data Models

COMP5338 – Advanced Data Models

COMP5338 – Advanced Data Models. Week 11: Spatial Data Model, Query and Index. ( S. Shekhar / S.Chawla (2002): chapter 1-3; Garcia-Molina/Ullman/ Widom (2009): chapter 14). Outline. Spatial Data Model Spatial Query Concepts Spatial Index Motivation Hash Structure Tree Structure

733 views • 50 slides

Advanced Data Modeling Minimal Models

Advanced Data Modeling Minimal Models

Advanced Data Modeling Minimal Models. Steffen Staab. TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A. Overview. Logic as query language. Grounding. Minimal Herbrand models. Completion. Logic as query language. Given:

461 views • 36 slides

Advanced Alg – Unit One Data Analysis

Advanced Alg – Unit One Data Analysis

Advanced Alg – Unit One Data Analysis. Finding data that will give z-score. Z Score. z score =. Data – Mean σ σ : standard deviation Gives exact standard deviation of a piece of data. Find the z score. Given: Data = 93 Mean = 90 σ = 2 z score = (93 – 90) ÷ 2 = 1.5

210 views • 10 slides

Advanced Data Types and New Applications

Advanced Data Types and New Applications

Advanced Data Types and New Applications. These slides are a modified version of the slides of the book “Database System Concepts” (Chapter 24), 5th Ed ., McGraw-Hill , by Silberschatz, Korth and Sudarshan. Original slides are available at www.db-book.com. Temporal Databases.

531 views • 52 slides

Data Analytics for Enhanced Consumer

Data Analytics for Enhanced Consumer

This blog explores how Data Analytics Training in Noida empowers organizations to enhance consumer experience, increase satisfaction levels, and drive long-term success.