# This file is governed by the Creative Commons license # Attribution-NonCommercial 4.0 Unported # http://creativecommons.org/licenses/by-nc/4.0/ # http://creativecommons.org/licenses/by-nc/4.0/legalcode # # Extended licenses, in particular commercial licenses, can be obtained from the # author of the source code. # Any re-distribution as source code must acknowledge the original author of this file. # # File: deeptelos-products-entities2.cbs # Author: Manfred Jeusfeld, manfred.jeusfeld@acm.org # Date: 2016-03-03 (2016-08-15) #---------------------------------------------------------------- # This CBShell script creates an example database where # both the productcategory-productmodel-product and # the entitytype-entity MGI hierarchies coexist. # This is a variant of deeptelos-products-entities.cbs, which # declares 'ProductModel' as specialization of EntityType'. cbserver -port 4411 -t low -new PRODENT2DB tellModel deeptelos.sml.txt tellModel deeptelos-GTs.sml.txt #mkdir MLOs #cd MLOs # MGI hierarchy for Entity tell " EntityType with end Domain end Entity with IN c: EntityType end Value with IN c: Domain end " # Properties for Entity tell " EntityType with attribute property: Domain end Entity with attribute value: Value end String in Domain end Real in Domain end Integer in Domain end Entity!value with IN c: EntityType!property end " # MGI hierarchy for Product tell " ProductCategory with end ProductModel with IN c: ProductCategory end Product with IN c: ProductModel end CarModel in ProductCategory with end Car with IN c1: CarModel end " # properties of products tell " ProductCategory with attribute categoryMgr: Person {* 3-1 *} end ProductModel with attribute listPrice: Integer {* 2-1 *} end CarModel with categoryMgr c: peter {* 2-0 *} attribute numberOfDoors: Integer {* 2-1 *} end Car with attribute mileage: Integer; {* 1-1 *} owner: AdultPerson {* 1-1 *} end Person in EntityType with property age: Integer end AdultPerson in EntityType isA Person end peter in Person end PhoneModel in ProductCategory end Product with attribute owner: Person end ProductModel isA EntityType end {* link Entity and Product hierarchy *} Project in EntityType with property budget: Real end p346 in Project with budget pbudget: 1.5 end " mkdir PRODUCTS cd PRODUCTS # product models tell " Porsche911 in CarModel with numberOfDoors d: 2 {* 1-0 *} listPrice p: 120000 {* 1-0 *} end GalaxyS3 in PhoneModel end " mkdir EXAMPLE cd EXAMPLE # example products tell " mary in AdultPerson end marysS3 in GalaxyS3 with owner o: mary {* 0-0 *} end marysCar in Porsche911 with mileage m: 27000 {* 0-0 *} owner o: mary {* 0-0 *} end "