%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Towards Ontology-based OLAP: Datalog-based Reasoning % % over Multidimensional Ontologies % % (Datalog Prototype) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Author(s): Bernd Neumayr*, Stefan Anderlik*, and Michael Schrefl* % % % % *) Department of Business Informatics - Data & Knowledge Engineering % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Abstract : This file contains the Datalog implementation of the % % multidimensional ontology (MDO) metamodel together with the % % Datalog representation of a sample MDO which can be found at: % % % % http://www.dke.jku.at/research/projects/semcockpit/dolap12/ % % dolap12.dlv % % % % First we have the sample MDO represented as Datalog Facts (EDB) % % followed by the implementation of the MDO metamodel as IDB % % predicates and constraints. Rules and constraints that may only % % be evaluated or enforced over a Grounded MDO are not active % % (i.e., only included in this Datalog program as a comment). % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Usage: This datalog program can be used in various ways. Some % % interesting Datalog queries are provided in section 'Queries', % % for example to query for the subsumption hierarchy of entity % % concepts using the following Datalog query: ec_s(EC,ECx)? % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % 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 dolap12.dlv % % % % Output for getting the subsumption hierarchy of entity concepts: % % % % Datalog Query: ec_s(X,Y)? % % % % ?X | ?Y % %--------------------------|-------------------------------------------------% % ec_city_small | ec_city_small % % ec_city_big | ec_city_big % % ec_country_big | ec_country_big % % ec_doctor_old | ec_doctor_old % % ec_atc4_oadGroup | ec_atc4_oadGroup % % ec_atc4_dm2Group | ec_atc4_oadGroup % % ec_atc4_dm2Group | ec_atc4_dm2Group % % ec_insurant_old | ec_insurant_old % % ec_insurant_veryOld | ec_insurant_old % % ec_insurant_veryOld | ec_insurant_veryOld % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EDB (Sample MDO represented as Facts) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MDO:FLAT % Datatype 'int' and its values dt(dt_int). v(17, dt_int). v(18, dt_int). v(21, dt_int). v(23, dt_int). v(30, dt_int). v(40, dt_int). v(48, dt_int). v(52, dt_int). v(65, dt_int). v(68, dt_int). v(70, dt_int). v(85, dt_int). v(86, dt_int). v(90, dt_int). v(96, dt_int). v(100, dt_int). v(22900, dt_int). v(38000, dt_int). v(40000, dt_int). v(83900, dt_int). v(100000, dt_int). v(191000, dt_int). v(5000000, dt_int). v(8440000, dt_int). % Dataranges % Datarange 'below40000' r(below40000, dt_int). rub(below40000, 40000). % Datarange 'between17and30' r(between17and30, dt_int). rlb(between17and30, 17). rub(between17and30, 30). % Datarange 'between18and23' r(between18and23, dt_int). rlb(between18and23, 18). rub(between18and23, 23). % Datarange 'between40and100' r(between40and100, dt_int). rlb(between40and100, 40). rub(between40and100, 100). % Datarange 'above65' r(above65, dt_int). rlb(above65, 65). % Datarange 'above85' r(above85, dt_int). rlb(above85, 85). % Datarange 'above100000' r(above100000, dt_int). rlb(above100000, 100000). % Datarange 'above5000000' r(above5000000, dt_int). rlb(above5000000, 5000000). % Entity types and entities % Entity type 'top' et(et_top). e(et_top_all, et_top). % Entity type 'country' et(et_country). a(a_country_inhabitants, dt_int, et_country). a(a_country_area, dt_int, et_country). e(et_country_austria, et_country). av(et_country_austria, a_country_inhabitants, 8440000). av(et_country_austria, a_country_area, 83900). % Entity type 'city' et(et_city). a(a_city_inhabitants, dt_int, et_city). a(a_city_area, dt_int, et_city). e(et_city_linz, et_city). av(et_city_linz, a_city_inhabitants, 191000). av(et_city_linz, a_city_area, 96). e(et_city_steyr, et_city). av(et_city_steyr, a_city_inhabitants, 38000). e(et_city_amstetten, et_city). av(et_city_amstetten, a_city_inhabitants, 22900). av(et_city_amstetten, a_city_area, 52). % Entity type 'doctor' et(et_doctor). a(a_doctor_age, dt_int, et_doctor). e(et_doctor_drHuber, et_doctor). av(et_doctor_drHuber, a_doctor_age, 68). e(et_doctor_drMaier, et_doctor). av(et_doctor_drMaier, a_doctor_age, 48). e(et_doctor_drRobert, et_doctor). av(et_doctor_drRobert, a_doctor_age, 66). % Entity type 'drug' et(et_drug). e(et_drug_metformin, et_drug). e(et_drug_phenoformin, et_drug). e(et_drug_tolbutamid, et_drug). % Entity type 'atc4' et(et_atc4). a(a_atc4_code, dt_int, et_atc4). e(et_atc4_A10BA, et_atc4). av(et_atc4_A10BA, a_atc4_code, 17). e(et_atc4_A10BB, et_atc4). av(et_atc4_A10BB, a_atc4_code, 21). % Entity type 'insurant' et(et_insurant). a(a_insurant_age, dt_int, et_insurant). e(et_insurant_frMair, et_insurant). av(et_insurant_frMair, a_insurant_age, 86). e(et_insurant_hrHubert, et_insurant). av(et_insurant_hrHubert, a_insurant_age, 90). % Entity type 'district' et(et_district). e(et_district_lowerAustria, et_district). e(et_district_upperAustria, et_district). % Entity concepts % Entity concept city:'small' ec(ec_city_small, et_city). ar(ec_city_small, a_city_inhabitants, below40000). % Entity concept city:'big' ec( ec_city_big, et_city). ar( ec_city_big, a_city_area, between40and100). ar( ec_city_big, a_city_inhabitants, above100000). % Entity concept country:'big' ec(ec_country_big, et_country). ar(ec_country_big, a_country_inhabitants, above5000000). % Entity concept doctor:'old' ec(ec_doctor_old, et_doctor). ar(ec_doctor_old, a_doctor_age, above65). % Entity concept atc4:'oadGroup' ec(ec_atc4_oadGroup, et_atc4). ar(ec_atc4_oadGroup, a_atc4_code, between17and30). % Entity concept atc4:'dm2Group' ec(ec_atc4_dm2Group, et_atc4). ar(ec_atc4_dm2Group, a_atc4_code, between18and23). % Entity concept insurant:'old' ec(ec_insurant_old, et_insurant). ar(ec_insurant_old, a_insurant_age, above65). % Entity concept insurant:'veryOld' ec(ec_insurant_veryOld, et_insurant). ar(ec_insurant_veryOld, a_insurant_age, above85). % MDO:HIERARCHICAL % Hierarchy 'doctor' h(h_doctor). l(l_doctor_top, et_top, h_doctor). n(n_doctor_all, l_doctor_top, et_top_all). l_h(L, l_doctor_top) :- l(L,_,h_doctor), L<>l_doctor_top. n_h(N, n_doctor_all) :- n(N,L,_), l(L,_,h_doctor), N<>n_doctor_all. l(l_doctor_countryOfPractice, et_country, h_doctor). l_h(l_doctor_countryOfPractice, h_doctor_l_top). n(n_austria, l_doctor_countryOfPractice, et_country_austria). l(l_doctor_cityOfPractice, et_city, h_doctor). l_h(l_doctor_cityOfPractice, l_doctor_countryOfPractice). n(n_doctor_linz, l_doctor_cityOfPractice, et_city_linz). n_h(n_doctor_linz, n_austria). n(n_steyr, l_doctor_cityOfPractice, et_city_steyr). n_h(n_steyr, n_austria). n(n_doctor_amstetten, l_doctor_cityOfPractice, et_city_amstetten). n_h(n_doctor_amstetten, n_austria). l(l_doctor_doctor, et_doctor, h_doctor). l_h(l_doctor_doctor, l_doctor_cityOfPractice). n(n_drHuber, l_doctor_doctor, et_doctor_drHuber). n_h(n_drHuber, n_steyr). n(n_drMaier, l_doctor_doctor, et_doctor_drMaier). n_h(n_drMaier, n_doctor_linz). n(n_drRobert, l_doctor_doctor, et_doctor_drRobert). n_h(n_drRobert, n_doctor_linz). % Hierarchy 'drug' h(h_drug). l(l_drug_top, et_top, h_drug). n(n_drug_all, l_drug_top, et_top_all). l_h(L, l_drug_top) :- l(L,_,h_drug), L<>l_drug_top. n_h(N, n_drug_all) :- n(N,L,_), l(L,_,h_drug), N<>n_drug_all. l(l_drug_atc4, et_atc4, h_drug). n(n_A10BA, l_drug_atc4, et_atc4_A10BA). n(n_A10BB, l_drug_atc4, et_atc4_A10BB). l(l_drug_drug, et_drug, h_drug). l_h(l_drug_drug, l_drug_atc4). n(n_metformin, l_drug_drug, et_drug_metformin). n_h(n_metformin, n_A10BA). n(n_phenoformin, l_drug_drug, et_drug_phenoformin). n_h(n_phenoformin, n_A10BA). n(n_tolbutamid, l_drug_drug, et_drug_tolbutamid). n_h(n_tolbutamid, n_A10BB). % Hierarchy 'insurant' h(h_insurant). l(l_insurant_top, et_top, h_insurant). n(n_insurant_all, l_insurant_top, et_top_all). l_h(L, l_insurant_top) :- l(L,_,h_insurant), L<>l_insurant_top. n_h(N, n_insurant_all) :- n(N,L,_), l(L,_,h_insurant), N<>n_insurant_all. l(l_insurant_district, et_district, h_insurant). n(n_lowerAustria, l_insurant_district, et_district_lowerAustria). n(n_upperAustria, l_insurant_district, et_district_upperAustria). l(l_insurant_city, et_city, h_insurant). l_h(l_insurant_city, l_insurant_district). n(n_insurant_linz, l_insurant_city, et_city_linz). n_h(n_insurant_linz, n_upperAustria). n(n_insurant_amstetten, l_insurant_city, et_city_amstetten). n_h(n_insurant_amstetten, n_lowerAustria). l(l_insurant_insurant, et_insurant, h_insurant). l_h(l_insurant_insurant, l_insurant_city). n(n_frMair, l_insurant_insurant, et_insurant_frMair). n_h(n_frMair, n_insurant_linz). n(n_hrHubert, l_insurant_insurant, et_insurant_hrHubert). n_h(n_hrHubert, n_insurant_amstetten). % Hierarchical concepts % Hierarchical concept h_doctor:'inSmallCity' hc(hc_doctor_inSmallCity, h_doctor, n_doctor_all). lr(hc_doctor_inSmallCity, l_doctor_cityOfPractice, ec_city_small). % Hierarchical concept h_doctor:'inSmallCityInAustria' hc(hc_doctor_inSmallCityInAustria, h_doctor, n_austria). lr(hc_doctor_inSmallCityInAustria, l_doctor_cityOfPractice, ec_city_small). % Hierarchical concept h_doctor:'inBigCountryAndSmallCity' hc(hc_doctor_inBigCountryAndSmallCity, h_doctor, n_doctor_all). lr(hc_doctor_inBigCountryAndSmallCity, l_doctor_countryOfPractice, ec_country_big). lr(hc_doctor_inBigCountryAndSmallCity, l_doctor_cityOfPractice, ec_city_small). % Hierarchical concept h_doctor:'atOldAgeAndInSmallCity' hc(hc_doctor_atOldAgeAndInSmallCity, h_doctor, n_doctor_all). lr(hc_doctor_atOldAgeAndInSmallCity, l_doctor_doctor, ec_doctor_old). lr(hc_doctor_atOldAgeAndInSmallCity, l_doctor_cityOfPractice, ec_city_small). % Hierarchical concept h_drug:'inDm2Group' hc(hc_drug_inDm2Group, h_drug, n_drug_all). lr(hc_drug_inDm2Group, l_drug_atc4, ec_atc4_dm2Group). % Hierarchical concept h_drug:'inOadGroup' hc(hc_drug_inOadGroup, h_drug, n_drug_all). lr(hc_drug_inOadGroup, l_drug_atc4, ec_atc4_oadGroup). % Hierarchical concept h_insurant:'atOldAge' hc(hc_insurant_atOldAge, h_insurant, n_insurant_all). lr(hc_insurant_atOldAge, l_insurant_insurant, ec_insurant_old). % Hierarchical concept h_insurant:'atVeryOldAgeAndInBigCity' hc(hc_insurant_atVeryOldAgeAndInBigCity, h_insurant, n_insurant_all). lr(hc_insurant_atVeryOldAgeAndInBigCity, l_insurant_insurant, ec_insurant_veryOld). lr(hc_insurant_atVeryOldAgeAndInBigCity, l_insurant_city, ec_city_big). % MDO:MULTIDIMENSIONAL % Dimensions d(d_prescribingDoctor, h_doctor). d(d_treatingDoctor, h_doctor). d(d_drug,h_drug). d(d_patient,h_insurant). % Multidimensional space 'medication' ms(ms_medication). ms_d(ms_medication, d_prescribingDoctor). ms_d(ms_medication, d_treatingDoctor). ms_d(ms_medication, d_drug). ms_d(ms_medication, d_patient). % Granularity 'doctor_doctor_drug_patient' g(g_doctor_doctor_drug_patient, ms_medication). gc(g_doctor_doctor_drug_patient, d_prescribingDoctor, l_doctor_doctor). gc(g_doctor_doctor_drug_patient, d_treatingDoctor, l_doctor_doctor). gc(g_doctor_doctor_drug_patient, d_drug, l_drug_drug). gc(g_doctor_doctor_drug_patient, d_patient, l_insurant_insurant). p(p1, g_doctor_doctor_drug_patient). pc(p1, d_prescribingDoctor, n_drHuber). pc(p1, d_treatingDoctor, n_drHuber). pc(p1, d_drug, n_tolbutamid). pc(p1, d_patient, n_frMair). p(p2, g_doctor_doctor_drug_patient). pc(p2, d_prescribingDoctor, n_drHuber). pc(p2, d_treatingDoctor, n_drMaier). pc(p2, d_drug, n_metformin). pc(p2, d_patient, n_hrHubert). p(p6, g_doctor_doctor_drug_patient). pc(p6, d_prescribingDoctor, n_drRobert). pc(p6, d_treatingDoctor, n_drRobert). pc(p6, d_drug, n_tolbutamid). pc(p6, d_patient, n_hrHubert). % Granularity 'city_city_atc4_district' g(g_city_city_atc4_district, ms_medication). gc(g_city_city_atc4_district, d_prescribingDoctor, l_doctor_cityOfPractice). gc(g_city_city_atc4_district, d_treatingDoctor, l_doctor_cityOfPractice). gc(g_city_city_atc4_district, d_drug, l_drug_atc4). gc(g_city_city_atc4_district, d_patient, l_insurant_district). p(p3, g_city_city_atc4_district). pc(p3, d_prescribingDoctor, n_doctor_linz). pc(p3, d_treatingDoctor, n_steyr). pc(p3, d_drug, n_A10BA). pc(p3, d_patient, n_upperAustria). p(p4, g_city_city_atc4_district). pc(p4, d_prescribingDoctor, n_doctor_linz). pc(p4, d_treatingDoctor, n_doctor_linz). pc(p4, d_drug, n_A10BB). pc(p4, d_patient, n_lowerAustria). p(p5, g_city_city_atc4_district). pc(p5, d_prescribingDoctor, n_steyr). pc(p5, d_treatingDoctor, n_steyr). pc(p5, d_drug, n_A10BB). pc(p5, d_patient, n_upperAustria). % Multidimensional base 'drugPrescription' mb(mb_drugPrescription, g_doctor_doctor_drug_patient). mb_p(mb_drugPrescription, p1). mb_p(mb_drugPrescription, p2). % Multidimensional concepts % Multidimensional concept 'dm2PrescriptionsForOldPatients' mc(mc_dm2PrescriptionsForOldPatients, mb_drugPrescription). dr(mc_dm2PrescriptionsForOldPatients, d_drug, hc_drug_inDm2Group). dr(mc_dm2PrescriptionsForOldPatients, d_patient, hc_insurant_atOldAge). % Multidimensional concept 'oadPrescriptionsForVeryOldPatientsInBigCities' mc(mc_oadPrescriptionsForVeryOldPatientsInBigCities, mb_drugPrescription). dr(mc_oadPrescriptionsForVeryOldPatientsInBigCities, d_drug, hc_drug_inOadGroup). dr(mc_oadPrescriptionsForVeryOldPatientsInBigCities, d_patient, hc_insurant_atVeryOldAgeAndInBigCity). % Multidimensional concept 'dm2PrescriptionsForVeryOldPatientsInBigCities' mc(mc_dm2PrescriptionsForVeryOldPatientsInBigCities, mb_drugPrescription). mclb(mc_dm2PrescriptionsForVeryOldPatientsInBigCities, g_doctor_doctor_drug_patient). mcub(mc_dm2PrescriptionsForVeryOldPatientsInBigCities, g_city_city_atc4_district). dr(mc_dm2PrescriptionsForVeryOldPatientsInBigCities, d_drug, hc_drug_inDm2Group). dr(mc_dm2PrescriptionsForVeryOldPatientsInBigCities, d_patient, hc_insurant_atVeryOldAgeAndInBigCity). % Multidimensional concept 'oldDoctorsInSmallCities' mc(mc_oldDoctorsInSmallCities, mb_drugPrescription). dr(mc_oldDoctorsInSmallCities, d_prescribingDoctor, hc_doctor_atOldAgeAndInSmallCity). dr(mc_oldDoctorsInSmallCities, d_treatingDoctor, hc_doctor_atOldAgeAndInSmallCity). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % IDB % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % For the following rules and constraints we indicate in brackets, e.g. by % % 'Transitive closure (16,17) ...', the line number of the rule within the % % DOLAP'12 paper. Rules which are not described in the paper, because of % % space limitations, are labelled with '(not shown in the paper)'. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MDO:FLAT % Dataranges (not shown in the paper) :- r(R,DT), rlb (R,V), not v(V,DT). :- r(R,DT), rub (R,V), not v(V,DT). rlb_(R) :- rlb (R,_). rub_(R) :- rub (R,_). :- r(R,_), not rlb_(R), not rub_(R). % Attribute restrictions (not shown in the paper) :- ar(EC,A,R), a(A,DT,_), r(R,DTx), DT<>DTx. :- ar(EC,A,_), ec(EC,ET), a(A,_,ETx), ET<>ETx . % Membership of dataranges (not shown in the paper) not_v_of(V,R) :- r(R,DT), rlb(R,Vlo), v(V,DT), VVup . v_of(V,R) :- v(V,DT), r(R,DT), not not_v_of(V,R). % Subsumption of dataranges (not shown in the paper) not_r_s(R,Rx) :- rlb(R,Vlo), rlb(Rx,Vlox), VloVupx. not_r_s(R,Rx) :- rub_(Rx), r(R,_), not rub_(R). r_s(R,Rx) :- r(R,DT), r(Rx,DT), not not_r_s(R,Rx). % Attributes (1-4) :- a(A,DT,_), a(A,DTx,_), DT<>DTx . :- a(A,DT,_), not dt(DT). :- a(A,_,ET), a(A,_,ETx), ET<>ETx . :- a(A,_,ET), not et(ET). % Attribute values (5) :- av(E,A,_), e(E,ET), a(A,_,ETa), ET<>ETa. % Grounded MDO % Entity: one value for each attribute of the entity type (6,7) %:- e(E,ET), a(A,_,ET), not av_(E,A). av_(E,A) :- av(E,A,_). % Membership of entity concepts (8-10) e_of(E,EC) :- e(E,ET), ec(EC,ET), not not_e_of(E,EC). not_e_of(E,EC) :- ar(EC,A,R), av(E,A,V), not v_of(V,R). not_e_of(E,EC) :- ar(EC,A,R), e(E,_), not av_(E,A). % Subsumption of entity concepts (11-14) ec_s(EC,ECx) :- ec(EC,ET), ec(ECx,ET), not not_ec_s(EC,ECx). not_ec_s(EC,ECx) :- ar(EC,A,R), ar(ECx,A,Rx), not r_s(R,Rx). not_ec_s(EC,ECx) :- ec(EC,_), ar_(ECx,A), not ar_(EC,A). ar_(EC,A) :- ar(EC,A,_). % MDO:HIERARCHICAL % Rollup levels (15), transitive closure of levels (16,17), transitive % reflexive closure of levels (18,19) and acyclic level hierarchies (20) :- l(L,_,H), l_h(L,Lx), l(Lx,_,Hx), H<>Hx. l_h_t(L,Lx) :- l_h(L,Lx). l_h_t(L,Lx) :- l_h_t(L,Ly), l_h(Ly,Lx). l_h_tr(L,Lx) :- l_h_t(L,Lx). l_h_tr(L,L) :- l(L,_,_). :- l_h_t(L,L). % Rollup nodes (21), node and entities (22), transitive closure of nodes % (23,24), transitive reflexive closure of nodes (25,26), acyclic node % hierarchies (27), and ancestor nodes (28,29). :- n(N,L,E), e(E,ET), l(L,ETl,_), ET<>ETl . :- n(N,L,E), n(Nx ,L,E), N<>Nx. n_h_t(N,Nx) :- n_h(N,Nx). n_h_t(N,Nx) :- n_h_t(N,Ny), n_h(Ny,Nx). n_h_tr(N,Nx) :- n_h_t(N,Nx). n_h_tr(N,N) :- n(N,_,_). :- n_h_t(N,N). :- n_h(N,Nx), n(N,L,_), n(Nx,Lx,_), not l_h_t(L,Lx). :- n_h_t(N,Nx), n_h_t(N,Ny), n(Nx,L,_), n(Ny,L,_), Nx<>Ny. % Grounded MDO % Node: rolls up to a node at every ancestor level of its level (30,31) n_h_t_l(N,L) :- n(N,_,_), n_h_t(N,Nx), n(Nx,L,_). %:- n(N,L,_), l_h(L,Lx), not n_h_t_l(N,Lx). % Hierarchical concepts (32-35) :- hc(_,H,N), n(N,L,_), l(L,_,Hl), H<>Hl. :- hc(HC,H,_), lr(HC,L,_), l(L,_,Hl), H<>Hl. :- lr(_,L,EC), l(L,ETl,_), ec(EC,ETc ), ETl<>ETc . :- hc(HC,_,N), lr(HC,Lr,_), n(N,Ln,_), not l_h_t(Lr,Ln). % Membership of hierarchical concepts (36-39) not_n_of(N,HC) :- n(N,_,_), lr(HC,Lx,EC), n(Nx,Lx,Ex), n_h_tr(N,Nx), not e_of(Ex,EC). not_n_of(N,HC) :- n(N,_,_), lr(HC,Lx,EC), not n_h_tr_l(N,Lx). n_h_tr_l(N,L) :- n_h_tr(N,Nx), n(Nx,L,_). n_of(N,HC) :- n(N,L,_), l(L,_,H), hc(HC,H,Nt), n_h_tr(N,Nt), not not_n_of(N,HC). % Subsumption of hierarchical concepts (40-43) hc_s(HC,HCx) :- hc(HC,H,N), hc(HCx,H,Nx), n_h_tr(N,Nx), not not_hc_s(HC,HCx). not_hc_s(HC,HCx) :- hc(HC,_,_), lr(HCx,L,ECx), not hc_s_lec(HC,L,ECx). hc_s_lec(HC,L,ECx) :- lr(HC,L,EC), ec_s(EC,ECx). hc_s_lec(HC,L,ECx) :- hc(HC,_,N), n(Ny,L,Ey), n_h_tr(N,Ny), e_of(Ey,ECx). % MDO:MULTIDIMENSIONAL % Granularity (44-47) :- gc(G,D,L), d(D,H), not l_(L,H). :- g(G,MS), ms_d(MS,D), not gc_(G,D). l_(L,H) :- l(L,_,H). gc_(G,D) :- gc(G,D,_). % Rollup hierarchy of granularities (48,49) g_h_tr(G,Gx) :- g(G,_), g(Gx,_), not not_g_h_tr(G,Gx). not_g_h_tr(G,Gx) :- gc(Gx,D,Lx), gc(G,D,L), not l_h_tr(L,Lx). % Points (50-53) :- p(P,G), pc(P,D,N), n(N,L,_), gc(G,D,Lx), L<>Lx. :- p(P,G), gc(G,D,_), not pc_(P,D). pc_(P,D) :- pc(P,D,_). :- p(P,G), mb_p(MB,P), not mb(MB,G). % Rollup hierarchy of points (54,55) p_h_tr(P,Px) :- p(P,_), p(Px,_), not not_p_h_tr(P,Px). not_p_h_tr(P,Px) :- pc(Px,D,Nx), pc(P,D,N), not n_h_tr(N,Nx). % Rollup point (56) mb_p_up(MB,P) :- p_h_tr(Px,P), mb_p(MB,Px). % Multidimensional concept (57-61) :- dr(MC,D,_), mc(MC,MB), mb(MB,G), g(G,MS), not ms_d(MS,D). :- dr(MC,D,HC), hc(HC,H,_), d(D,Hx), H<>Hx. :- mc(MC,MB), mb(MB,G), mclb(MC,Glb), not g_h_tr(G,Glb). :- mc(MC,MB), mb(MB,G), mcub(MC,Gub), not g_h_tr(G,Gub). :- mclb(MC,Glb), mcub(MC,Gub), not g_h_tr(Glb,Gub). % Membership of multidimensional concepts (62-65) p_of(P,MC) :- mc(MC,MB), mb_p_up(MB,P), not not_p_of(P,MC). not_p_of(P,MC) :- p(P,G), mcub(MC,Gx), not g_h_tr(G,Gx). not_p_of(P,MC) :- p(P,G), mclb(MC,Gx), not g_h_tr(Gx,G). not_p_of(P,MC) :- dr(MC,D,HC), pc(P,D,N), not n_of(N,HC). % Subsumption of multidimensional concepts (66-75) mc_s(MC,MCx) :- mc(MC,MB), mc(MCx,MB), not not_mc_s(MC,MCx). not_mc_s(MC,MCx) :- dr_(MCx,D), mc(MC,_), not dr_(MC,D). dr_(MC,D) :- dr(MC,D,_). not_mc_s(MC,MCx) :- dr(MC,D,HC), dr(MCx,D,HCx), not hc_s(HC,HCx ). not_mc_s(MC,MCx) :- mc(MC,_), mcub_(MCx), not mcub_(MC). mcub_(MC) :- mcub(MC,_). not_mc_s(MC,MCx) :- mcub(MC,G), mcub(MCx,Gx), not g_h_tr(G,Gx). not_mc_s(MC,MCx) :- mc(MC,_), mclb_(MCx), not mclb_(MC). mclb_(MC) :- mclb(MC,_). not_mc_s(MC,MCx) :- mclb(MC,G), mclb(MCx,Gx), not g_h_tr(Gx,G). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Queries % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Membership of dataranges % v_of(V,R)? % Subsumption hierarchy of dataranges % r_s(R,Rx)? % Membership of entity concepts % e_of(E,EC)? % Subsumption hierarchy of entity concepts % ec_s(EC,ECx)? % Membership of hierarchical concepts % n_of(N,HC)? % Subsumption hierarchy of hierarchical concepts % hc_s(HC,HCx)? % Membership of multidimensional concepts % p_of(P,MC)? % Subsumption hierarchy of multidimensional concepts % mc_s(MC,MCx)? % Rollup points for measures mb_p_up(MB,P)?