Professional Documents
Culture Documents
AAUsidebartheme
AAUsidebartheme
Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Agenda
Predicates 2
Why are they useful?
Usage/Implementation
Alternative Implementation
I Why are they useful?
I Usage/Implementation
I Alternative Forms of Implementation
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Why are they useful?
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Why are they useful?
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Why are they useful?
I Regression testing
I Business Rules
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Why are they useful?
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Why are they useful?
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Functional Dependency
Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation
6 Functional Dependency - Why is it useful?
I A, B –> C
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Functional Dependency
Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation
6 Functional Dependency - Why is it useful?
I A, B –> C
I DW holds certain hierarchical properties
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Functional Dependency
SQL querie:
1 SELECT DISTINCT t1 . country , t2 . city
2 FROM countrydim NATURAL JOIN authordim AS t1 , countrydim
NATURAL JOIN authordim AS t2
3 WHERE t1 . city = t2 . city
4 AND t1 . country <> t2 . country
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Functional Dependency
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Functional Dependency
SQL querie:
1 SELECT DISTINCT t1 . country , t2 . city
2 FROM countrydim NATURAL JOIN authordim AS t1 , countrydim
NATURAL JOIN authordim AS t2
3 WHERE t1 . city = t2 . city
4 AND t1 . country <> t2 . country
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Functional Dependency
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Referential Integrity
Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation
11 Referential Integrity - Why is it useful?
I Most DBMS’s have various referential integrity rules
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Referential Integrity
Predicates
Why are they useful?
Usage/Implementation
Alternative Implementation
11 Referential Integrity - Why is it useful?
I Most DBMS’s have various referential integrity rules
I Not removing the correct data from all tables
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - Referential Integrity
SQL querie:
1 SELECT *
2 FROM facttable
3 WHERE NOT EXISTS (
4 SELECT NULL FROM author_dim
5 WHERE facttable . aid = author_dim . aid
6 )
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Referential Integrity
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Referential Integrity
Predicates 1 else :
Why are they useful?
2 f o r x i n beta :
i f i s i n s t a n c e (x , s t r ):
Usage/Implementation 14
3
Alternative Implementation
4 b. append ( dw_rep .
5 get_data_representation (x
))
6 else :
7 r a i s e ValueError ( ' Expected string ' + '
in refs , got : ' + s t r ( type (x )))
8 refs [a ] = t u p l e (b)
9 self . refs = refs
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - Referential Integrity
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - RuleRowPredicate
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - RuleRowPredicate
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Usage - RuleRowPredicate
Predicates
Setup:
Why are they useful?
Usage/Implementation 18
Alternative Implementation
1 d e f no_autobios ( name , title ):
2 r e t u r n not name == title
3
4 RuleRowPredicate ( table_name =[ ' AuthorDim ',' FactTable ','
BookDim ']
5 constraint_function = no_autobios ,
6 column_names =[ ' name ', ' title '],
7 constraint_args =[] ,
8 column_names_exclude = False )
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - RuleRowPredicate
Predicates 1 # Gets the attribute names for columns needed for test
Why are they useful?
2 column_arg_names = self . setup_columns ( dw_rep , self .
Usage/Implementation
Alternative Implementation
19
table_name , self . column_names , self .
column_names_exclude )
3
4 func_args = inspect . getargspec ( self . constraint_function ).
args
5 i f l e n ( func_args ) != l e n ( column_arg_names ) + l e n ( self .
constraint_args ) :
6 r a i s e ValueError ( """Number of columns and number of
arguments do not match""" )
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Implementation - RuleRowPredicate
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Alternative Implementation - row_count_predicate
Department of Computer
Science
Aalborg University
Denmark 22
Predicates
Alternative Implementation - row_count_predicate
Department of Computer
Science
Aalborg University
Denmark 22
Thank you for using this theme!