InterSystems Caché bij de TU/e Marleen Vandervelden, Johan Kenens InterSystems Corporation Agenda Inleiding Historiek Post-relational database Caché Applicatie-ontwikkeling met Caché Demo’s Q&A Historiek = M(UMPS) M(UMPS) (mid ’60) (Masschusetts general hospital Multi Utility Programming System) ANSI standaard (einde ’70) Ontstaan van M implementaties (DSM, DTM) Enkel nog gecommercialiseerd en geevolueerd door InterSystems ------------------------------------------------------------------------ Programmeertaal Data opslag in Globals (boomstructuur) Deel 1 Post-relational database Caché 1. De storage manager Multi-Dimensional Storage Manager = Geoptimaliseerd voor performantie = Opslag van complexe datastructuren Complexe data-structuur: ^Globals Set ^Global = “fruit” ^Global = fruit ^Global gedraagt zich als een gewone type-less variable… Complexe data-structuur: ^Globals Set ^Global(1) = “appel” ^Global = (1) appel Set ^Global(2) = “peer” ^Global = (1) appel (2) peer set ^Global(2, “aantal”) = 45 Subscripts zijn eveneens untyped, en kunnen ook tekst (en dus data !) zijn … ^Global = (1) appel (2) peer (aantal) 45 set ^Global(2, “naam”) = “Jefke” Subscripts zijn eveneens untyped, en kunnen ook tekst (en dus data !) zijn … ^Global = (1) appel (2) peer (aantal) 45 (naam) Jefke Global subscripts zijn ook sparse… vb. Set ^Global(2, “leverancier”) = “Fruit&co” ^Global = (1) appel (2) peer … … (leveranc.) Fruit&co Global subscripts zijn ook sparse… Set ^Global(2, “leverancier”, “adres”, “straat”) = “perziklaan” ^Global = ( ) … (2) … ( ) … ()… (adr.) ( ) … (str.) = perziklaan ( ) …( ) … (abc) (lev...) ()… Global subscripts zijn ook sparse… $Data(2, “leverancier) = 11 $Data(2, “leverancier”, “adres”) = 10 ^Global = ( ) … (2) … ( ) … ()… (adr.) ( ) … (str.) = perziklaan ( ) …( ) … (abc) (lev...) ()… ^Globals: een n-dimensionele ruimte ^Global 1 = “appel” 2 = “peer” naam leverancier =“Fruit&co” = “Jefke” aantal = 45 adres = Ø straat = “perziklaan” 2. Unified Data Architecture (UDA) Caché SQL interface Caché Object interface Dictionary Multi-Dimensional Storage Manager 1 dictionary voor 2 access paths Automatische projectie van definities in beide richtingen. Geen supplementaire laag voor O/R mapping 3. Platforms Caché SQL interface Caché Object interface Dictionary Multi-Dimensional Storage Manager Platforms Database = 1 uitwisselbaar physisch bestand Caché Platforms Platform Alpha / OpenVMS Alpha / Tru64 Unix AViiON HP IBM P Series Linux (Red Hat & SuSE) Sun Solaris (SPARC) Sun Solaris (Intel) Windows 95, 98, ME, NT, 2000, XP Apple MACOS X (aangekondigd) 32-Bit 64-Bit 4. Tools and standaarden Tools en standaarden (zie RAD) Caché SQL interface Caché Objects Dictionary Multi-Dimensional Storage Manager Platforms 5. Integratie mogelijkheden InterSystems Caché COM Gateway Bestaande Windows applicaties (Word, Excel,...) SQL Gateway MQ Series Gateway Bestaande DB • Informix • Sybase • Oracle • Elke ODBC Bericht gebaseerde applicaties Ensemble InterSystems Ensemble Modeling (Studio) Business Process Business Operation Adapter Business Operation Adapter Business Operation Adapter Business Operation Adapter Message Transformation Message Queue (Caché) SAP – SIEBEL – FILE - .... SAP – SIEBEL – FILE - .... Adapter Business Service Divided World of Database Optimized for Users Database Transaction Processing Business Intelligence Repetitive “simple” requests Infrequent complex queries Many Few Dynamic Static The Wall Caché Bit Map Indices • In a bit-map index, a property of a class is described by a string of bits Deel 2 Applicatie-ontwikkeling met Caché Object georienteerde omgeving Encapsulation Inheritance Polymorphism Objects / Relational Mismatch User Interface Objects Logic Objects Expensive Transformation Traditional Database Tables Objects in the Database User Interface Objects Logic Objects Consistent Representation End to End Caché Database Objects Database Scripting Caché Object Script Basic Virtual Machine Data & Objects Any developer that knows VB knows Caché UML Composition (One to One) /// This is the container class in the composition Class Person Extends %Persistent [ ClassType = persistent, ProcedureBlock,] { Property firstName As %String; Property lastName As %String; /// The container contains an Address, the Address /// class in embedded in the Person class Property personAddress As Address; } /// This is the contained class in the composition /// and should be of type "serial" Class Address Extends %SerialObject [ ClassType = serial, ProcedureBlock ] { Property city As %String; Property number As %String; Property street As %String; Property zip As %String; } Serial embedded in %Persistent set adr = ##class(Address).%New() set adr.street = “Kippenlaan“ set adr.number = “24“ set adr.city = “Vilvoorde“ set adr.zip = “1800“ set per = ##class(Person).%New() set per.firstName = “Jean-luc“ set per.lastName = “Dehaene” set per.personAddress = adr do per.%Save() // Create an Address object // Populate street // Populate number // Populate city // Populate zip // Create a Person object // Populate firstName // Populate lastName // Populate personAddress // Save the Person object UML Composition (One to Many) /// This is the container class in the composition Class Person Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Property firstName As %String; Property lastName As %String; /// The container contains Addresses, the Addresses /// are embedded in the Person class as a /// ListOfObjects class Property personAddresses As Address [ Collection = list ]; } /// This is the contained class in the composition /// and should be of type "serial" Class Address Extends %SerialObject [ ClassType = serial, ProcedureBlock ] { Property city As %String; Property number As %String; Property street As %String; Property zip As %String; } Collection embedded in %Persistent set list = ##class(%Library.ListOfObjects).%New() set adr1 = ##class(Address).%New() set adr2 = ##class(Address).%New() set adr1.street = "Acaciastraat“ set adr1.number = "20“ set adr1.city = "Brussel“ set adr1.zip = "1000“ set adr2.street = "Jozef Plateaustraat“ set adr2.number = "24“ set adr2.city = "Gent“ set adr2.zip = "9000“ do list.Insert(adr1) do list.Insert(adr2) set per = ##class(Composition0toN.Person).%New() set per.firstName = "Freya“ set per.lastName = "Vandenbossche“ set per.personAddresses = list do per.%Save() // Create a collection of objects // Create a first new Address object // Create a second new Address object // Populate first Address object // … // … // … // Populate second Address object // … // … // … // Insert first Address in the collection // Insert first Address in the collection // Create a new Person object // Populate the Person object // … // Populate the collection // Save the person object UML Association (Relations = RI) (1) (One to Many = Restrict delete) Class Department Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Relationship Employees As Employee [ Cardinality = many, Inverse = Department ]; Property deptCode As %String; Property deptName As %String; } Class Employee Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Relationship Department As Department [ Cardinality = one, Inverse = Employees ]; Index employeeDepartmentIndex On Department; Property firstName As %String; Property hireDate As %Library.Date; Property lastName As %String; } UML Association (Relations = RI) (2) (Parent - Children = Cascaded delete) Class Invoice Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Relationship invoiceLines As ParentChild.InvoiceLine [ Cardinality = children, Inverse = invoice ]; Property invoiceDate As %Date; Property invoiceDescription As %String; Property invoiceNr As %String; } Class ParentChild.InvoiceLine Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Relationship invoice As ParentChild.Invoice [ Cardinality = parent, Inverse = invoiceLines ]; Property taxRate As %Float; Property units As %Integer; } 4. Tools and standaarden Tools en standaarden Caché SQL interface Caché Objects Dictionary Multi-Dimensional Storage Manager Platforms Caché Objects Multi-Dimensional Storage Manager C++ Java COM High-performance links to all major object architectures .NET Caché Object Connectivity Caché for Web Applications Web Server ASP .Net JSP J2EE • Native connectivity to all major Web development technologies + • CSP for optimized development speed and scalability Caché CSP Code { Based Development } < Tag Based Development > Compiler Caché Server Pages • High performance compiled objects • Single box to n-tier deployment with no modification Web Page Objects Caché & Java Java App. App. Server • “Classic” Java and EJB • Simultaneous object Object + SQL Caché J2EE and relational access Caché Objects Multi-Dimensional Storage Manager COM Java C++ EJB Bi-directional conversion between objects and multiple XML formats XML Caché XML Caché Web Services WSDL SOAP Web Server Web Service Adaptor Any Caché Class Caché • High performance Web Service for any Caché method • No middleware Caché COM Java .Net Caché Objects Web Server Caché SQL interface C++ EJB XML Native link JDBC ODBC Your applications J2EE CSP SOAP Dictionary Multi-Dimensional Storage Manager COM Gateway SQL Gateway MQ Series Gateway Your Web applications Others’ Applications Deel 3 Demo’s Demo’s Populate XML SOAP Documentatie generatie Bitmap indexen ...(op aanvraag)... Q&A UML Association (Zonder RI) (Referentiële integriteit via callback methods/methods) • Deel 4 Class Employee Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Property manages As Department [ Required ] Property firstName As %String; Property hireDate As %Library.Date; Property lastName As %String; } Class Department Extends %Persistent [ ClassType = persistent, ProcedureBlock ] { Property manager As Employee [ Required ]; Property deptCode As %String; Property deptName As %String; }