%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Multi-dimensional Navigation Modeling using BI Analysis Graphs % % Datalog Protoype (Readme) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Author(s): Thomas Neuböck*, Bernd Neumayr°, Thomas Rossgatterer*,% % Stefan Anderlik°, and Michael Schrefl° % % % % °) solvistas GmbH and *) Department of Business Informatics - % % Data & Knowledge Engineering (DKE) % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Abstract : This demo file demonstrates the implementation of % % BI Analysis Graph Templates described in the paper % % 'Multi-dimensional Navigation Modeling using BI % % Analysis Graphs' submitted to the ER'12-Workshop % % MoreBI'12. The content model (EDB, extensional % % database) is implemented as datalog facts % % (e.g. directlyRollsUpTo) and graph templates (e.g., % % template 'G' from Fig. 3 on page 9) are implemented % % as datalog predicates (IDB, intensional database) to % % (i) check consistency and (ii) to find all possible % % instantiations of the example BI Analysis Graph % % Template 'G'. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Requirements: DLV (with or without ODBC support). Download from: % % % % http://www.dlvsystem.com/dlvsystem/index.php/DLV#Download % % % % Execute with Option: -CAUTIOUS % % % % Example Execution (in Windows): % % % % dlv.mingw.exe -CAUTIOUS morebi12.dlv % % % % Output: (each row is a possible instantiation of the BI Analysis % % Graph Template 'G', IDB predicate 'graph') % % % % ?m | ?g | ?o | ?q % %-----------|---------|-------------|------------------------------% % % % drugCosts, province, upperAustria, dm2oad % % drugCosts, province, lowerAustria, dm2oad % % drugCosts, tau, upperAustria, dm2oad % % drugCosts, tau, lowerAustria, dm2oad % % avgNrOfAnnualContacts, province, upperAustria, dm2oad % % avgNrOfAnnualContacts, province, lowerAustria, dm2oad % % avgNrOfAnnualContacts, tau, upperAustria, dm2oad % % avgNrOfAnnualContacts, tau, lowerAustria, dm2oad % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EDB % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Dimension Nodes % Dimension 'location' node(upperAustria). node(lowerAustria). node(austria). node(locationAll). % Dimension 'time' node(q1_2012). node(q2_2012). node(q3_2012). node(q4_2012). node(y2012). node(timeAll). % Dimension Levels % Dimension 'location' level(province). level(country). level(locationTop). % Dimension 'time' level(quarter). level(year). level(timeTop). % Predicates predicate(thing). predicate(dm2). predicate(dm2oad). % Measures measure(drugCosts). measure(avgNrOfAnnualContacts). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Every node belongs to a level % Rollup-Hierarchy of dimension 'location' atLevel(upperAustria, province). atLevel(lowerAustria, province). atLevel(austria, country). atLevel(locationAll, locationTop). % Rollup-Hierarchy of dimension 'time' atLevel(q1_2012, quarter). atLevel(q2_2012, quarter). atLevel(q3_2012, quarter). atLevel(q4_2012, quarter). atLevel(y2012, year). atLevel(timeAll, timeTop). % Rollup-Hierarchies of nodes % Rollup-Hierarchy of dimension 'location' directlyRollsUpTo(upperAustria, austria). directlyRollsUpTo(lowerAustria, austria). directlyRollsUpTo(austria, locationAll). % Rollup-Hierarchy of dimension 'time' directlyRollsUpTo(q1_2012, y2012). directlyRollsUpTo(q2_2012, y2012). directlyRollsUpTo(q3_2012, y2012). directlyRollsUpTo(q4_2012, y2012). directlyRollsUpTo(y2012, timeAll). % Rollup-Hierarchies of levels % Rollup-Hierarchy of dimension 'location' directlyRollsUpToLevel(province, country). directlyRollsUpToLevel(country, locationTop). % Rollup-Hierarchy of dimension 'time' directlyRollsUpToLevel(quarter, year). directlyRollsUpToLevel(year, timeTop). % Subsumption-Hierarchy of predicates directlySubsumedBy(dm2,thing). directlySubsumedBy(dm2oad,thing). directlySubsumedBy(dm2oad,dm2). % Multi-dimensional domain of measures % Measure: drugCosts scope(drugCosts, locationAll, timeAll). minGranularity(drugCosts, province, quarter). maxGranularity(drugCosts, locationTop, timeTop). % Measure: avgNrOfAnnualContacts scope(avgNrOfAnnualContacts, locationAll, timeAll). minGranularity(avgNrOfAnnualContacts, province, year). maxGranularity(avgNrOfAnnualContacts, locationTop, timeTop). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % IDB % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Subsumption-Hierarchy of predicates is transitive and reflexive subsumedBy(X,X):- predicate(X). subsumedBy(X,Y):- directlySubsumedBy(X,Y). subsumedBy(X,Y):- subsumedBy(X,Z),subsumedBy(Z,Y). % Rollsup-Hierarchy of nodes is transitive and reflexive rollsUpTo(X,X):- node(X). rollsUpTo(X,Y):- directlyRollsUpTo(X,Y). rollsUpTo(X,Y):- rollsUpTo(X,Z), rollsUpTo(Z,Y). % Rollsup-Hierarchy of levels is transitive and reflexive rollsUpToLevel(X,X):- level(X). rollsUpToLevel(X,Y):- directlyRollsUpToLevel(X,Y). rollsUpToLevel(X,Y):- rollsUpToLevel(X,Z), rollsUpToLevel(Z,Y). % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % Predicates for consistency of analysis situations implemented for % % a fixed number n of dimensions (with n=2). % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % Is a point in the scope of measure M? pointInScope(M,N1,N2) :- scope(M,M_N1,M_N2), rollsUpTo(N1,M_N1), rollsUpTo(N2,M_N2), measure(M). % Grouping granularity = Dimensionality and granularity of the % resulting cube . % Value granularity = Granularity of measure values in the % resulting cube. groupingToValueGranularity(N,G,G) :- atLevel(N,L), rollsUpToLevel(G,L). groupingToValueGranularity(N,tau,L) :- atLevel(N,L). % Is a value granularity within the bounds of measure M? valueGranularityWithinBounds(M,L1,L2) :- minGranularity(M,Min_L1,Min_L2), maxGranularity(M,Max_L1,Max_L2), rollsUpToLevel(L1,Max_L1), rollsUpToLevel(Min_L1,L1), rollsUpToLevel(L2,Max_L2), rollsUpToLevel(Min_L2, L2). % Is a value granularity finer than the granularity of % point ? rollsUpToPoint(L1,L2,N1,N2) :- atLevel(N1,N1_L), rollsUpToLevel(L1,N1_L), atLevel(N2,N2_L), rollsUpToLevel(L2,N2_L). % Is an analysis situation M,Q consistent? gamma(N1,N2,M,Q,G1,G2) :- pointInScope(M,N1,N2), groupingToValueGranularity(N1,G1,L1), groupingToValueGranularity(N2,G2,L2), valueGranularityWithinBounds(M,L1,L2), rollsUpToPoint(L1,L2,N1,N2), predicate(Q). % BI Analysis Graph Template 'G' from Figure 3 graph(M,G,O,Q) :- gamma(austria,y2012,M,dm2,G,tau), gamma(O,y2012,M,dm2,G,tau), gamma(O,y2012,M,Q,G,tau), O<>austria, rollsUpTo(O,austria), Q<>dm2, subsumedBy(Q,dm2). % Get all possible instantiations of BI Analysis Graph Template 'G' graph(M,G,O,Q)?