1 / 41

PDR607: XML Modeling with PowerDesigner

PDR607: XML Modeling with PowerDesigner. Matt Creason Senior Systems Consultant mcreason@sybase.com Xiao-Yun WANG PowerDesigner Chief Architect xwang@sybase.com August 15-19, 2004. The Enterprise. Unwired. The Enterprise. Unwired. Industry and Cross Platform Solutions. Manage

jason-booth
Télécharger la présentation

PDR607: XML Modeling with PowerDesigner

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PDR607: XML Modeling with PowerDesigner Matt Creason Senior Systems Consultant mcreason@sybase.com Xiao-Yun WANG PowerDesigner Chief Architect xwang@sybase.com August 15-19, 2004

  2. The Enterprise. Unwired.

  3. The Enterprise. Unwired. Industry and Cross Platform Solutions Manage Information Unwire Information Unwire People • Adaptive Server Enterprise* • Adaptive Server Anywhere • Sybase IQ* • Dynamic Archive • Dynamic ODS • Replication Server* • OpenSwitch • Mirror Activator* • PowerDesigner • Connectivity Options • EAServer* • Industry Warehouse Studio • Unwired Accelerator • Unwired Orchestrator* • Unwired Toolkit* • Enterprise Portal • Real Time Data Services* • SQL Anywhere Studio* • M-Business Anywhere • Pylon Family (Mobile Email) • Mobile Sales • XcelleNet Frontline Solutions • PocketBuilder* • PowerBuilder Family* • AvantGo Sybase Workspace * = Products supported by PowerDesigner

  4. Topics • Introduction to XML • XML Modeling in PowerDesigner • Elements, Groups (Element or Attribute), Group Particles (Sequence, Choice, All and Any), Simple and Complex Types • Import, Include and Redefine • Mapping • Reverse Engineering • Generation • From Physical Data Model • From Object Model • XML in the Database • ASA, ASE, Oracle 9i, MS SQL 2000, DB2 • SQL/XML • XML wizard • Web Service in database • Validate XML documents

  5. Introduction to XML • XML – Extensible Markup Language • Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML. Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere. • Well-formed – document conforms to a number of syntactical rules • Valid - An XML document is valid if it has an associated document type declaration and if the document complies with the constraints expressed in it.

  6. Introduction to XML • DTD – Document Type Declaration • The DTD defines the constraints on the structure of an XML document. It declares all of the document's element types, children element types, and the order and number of each element type. It also declares any attributes, entities, notations, processing instructions, and comments in the document. • Internal, external or both • part of XML 1.0 specification • Element type declarations • Attribute list declarations • Entity declarations • Notation declarations • Comments • Recognized by most XML parsers / readers / validators

  7. Introduction to XML • Problems with DTD’s • Weak Data Typing • Document Structure is not stored in an XML document • Inheritance is not supported • Parameter Entities is a cumbersome method to accomplish code reuse • Weak Self-Documentation Facilities

  8. Introduction to XML • XML Schema Definition 1.0 • a mechanism somewhat analogous to DTD’s for constraining document structure (order, occurrence of elements, attributes) • Specific goals beyond DTD functionality are: • integration with namespaces • definition of incomplete constraints on the content of an element type • integration of structural schemas with primitive data types • Inheritance support • W3C Recommendation May 2001 • XML – Data Reduced • An XML Schema dialect proposed by Microsoft and submitted to the World Wide Web Consortium (W3C) in 1998. Like XML-Data, XDR is a syntax for Extensible Markup Language (XML) schemas that define the characteristics of an XML document. XDR is a subset of XML-Data. • Note submitted to W3C

  9. Introduction to XML • SQL/XML • SQL/XML is an ANSI and ISO standard that provides support for using XML in the context of an SQL database system. • SQL/XML makes it possible to store your XML documents in your SQL database, to query those documents using XPath and XQuery, and to "publish" your existing SQL data in the form of XML documents.

  10. XML Modeling in PowerDesigner • PowerDesigner XML Model allows you to graphically design, generate and reverse engineer: • XML Schema • DTD • XDR • PowerDesigner XML Model allows you to define mappings: • XML / Objects • XML / Relational

  11. XML Modeling in PowerDesigner • Elements • Basic building blocks of XML • Hierarchical structure of parents and children • Global and Local elements • Attributes – provide additional detail about elements <xs:element name="Customer"> <xs:complexType> <xs:attribute name="Name" type="xs:string"> </xs:attribute> <xs:attribute name="Telephone" type="xs:string"> </xs:attribute> </xs:complexType> </xs:element>

  12. XML Modeling in PowerDesigner • Constraints • Unique – Element or attribute value must be unique within specified scope • Key - Element or attribute value must be key (unique, not null and present) within specified scope • KeyRef – Element or attribute value is a reference to a Key or Unique constraint <xs:element name="PROJECT"> <xs:complexType> <xs:sequence> <xs:element name="EMPLOYEE"> <xs:complexType> <xs:attribute name="NUMEMPLOYEE" type="xs:string"> </xs:attribute> </xs:complexType> </xs:element> <xs:element name="PRODUCT"/> </xs:sequence> </xs:complexType> <xs:unique name="UNIQUENUM"> <xs:selector xpath="employee"/> <xs:field xpath="@numEmployee"/> </xs:unique> </xs:element>

  13. XML Modeling in PowerDesigner • Linking objects • XML is a hierarchy of elements • No standard link like in other PowerDesigner models • Links are created graphically by creating them on top of their parent • Cursor will change based on availability of the option No Link Created

  14. XML Modeling in PowerDesigner • Scope • Global objects have no parent object in a diagram. They are directly linked to the <schema> tag (root element) in a schema. They can be reused in the model through referencing elements. • Local object have a parent object in a diagram. They are unique within their parent scope. They can be defined by reference to a global element.

  15. XML Modeling in PowerDesigner • Groups • Global groups are directly created in a diagram without a parent symbol. In a schema, they are directly linked to the <schema> tag (root element). They can be reused within any element or complex type of the model through references. • Referencing groups are created in a diagram within an element, a complex type or a global group. You must select a global group for their Reference property. • An attribute group is a set of attributes. You define an attribute group globally (with the Model menu) and then you reuse it locally (with only its reference) in the definition of an element, a complex type or another attribute group. • Does not have a graphical symbol

  16. XML Modeling in PowerDesigner • Group particles indicate how child elements are related with their parent element. • Sequence - Child elements must appear at least once in the order of their declaration • Choice - Only one child element can be linked to the parent element • All - Child elements can appear in any order and each of them once or not • ANY Elements and Attributes - Any allows you to attach any type of object to a choice or a sequence group particle.

  17. XML Modeling in PowerDesigner • Simple Type • A simple type is a data type definition for elements or attributes with text-only content. • A simple type cannot contain elements or attributes. • A simple type is defined by derivation of an existing simple type (built-in data type or derived simple type). • There are three kinds of derivation for a simple type: • List - The simple type contains a white space-separated list of values of an inherited simple type • Restriction - The simple type has a range of values restricted to a subset of those of an inherited simple type • Union - The simple type contains a union of values of two or more inherited simple types

  18. XML Modeling in PowerDesigner • Complex Type • A complex type is a data type definition used to define attributes and child elements of a parent element. It is a template for a data type definition that can be reused and derived by extension or restriction. • A complex type has a global scope when it has no parent element in the diagram and when it is directly linked to the <schema> tag. It can then be reused or derived, by extension or restriction, in other parts of the schema. • It has a local scope when integrated into an <element> tag. It applies only to its containing element. • There are two kinds of derivation for a complex type: • Extension - You derive a complex type by extension when you want to extend the values of its base type. • Restriction – restrict the complex type to a specified simple type.

  19. XML Modeling in PowerDesigner • Derivations - when you want to extend or restrict the values of simple and complex types. • Extension - You derive a complex type by extension when you want to extend the values of its base type. • Restriction - You derive a simple type or a complex type by restriction when you want to restrict the values of their base type. • Facets - Facets are the constraints on the set of values of a simple type. (Length, Min, Max, Enumerations and Patterns) • List - You derive a simple type by list when you want to define it as a list of values of a specified data type. • Union - You derive a simple type by union when you want to define it as a collection of built-in and simple data types.

  20. XML Modeling in PowerDesigner • Import - An import identifies a namespace whose schema components are referenced by the current schema. • Include - An include allows you to include a specified schema file in the target namespace of the current schema. • Redefine - A redefine allows you to redefine simple and complex types, groups and attribute groups from an external schema file in the current schema.

  21. Object Mapping - You create a mapping between XML Model objects and PDM or OOM objects to setup a structure for data movement and transformation. Data comes from a data source and is loaded in an XML model. Allowed mappings between objects are shown in table below XML Modeling in PowerDesigner

  22. Reverse Engineering • You can reverse engineer an existing XSD, a DTD or a XDR file • To have a global view of the XSD, DTD or XDR file through a diagram • To check, delete or improve the XSD, DTD or XDR file through the graphic interface • Add mapping information to a model to gain database support or generate necessary database files • Reverse engineer into a new model or update and existing model • Update will display standard PowerDesigner Merge screen • Graphic options • Show Symbols • Expand Nodes • Show elements • Show groups • Show complex types • Show simple types • Convert unique references to elements

  23. From Physical Data Model Objects mapped according to the table below Generating XML Models

  24. Generating XML Models • From Physical Data Model • Two methods to generate • Tools > Generate XML Model • Limited control over generation process • Generation option for use of elements or attributes • Generation option for mapping • Tools > XML Builder Wizard • Flexible object selection • Dynamic building of XML Hierarchy • Mix and match elements and attributes • Automatic Mapping generated • Automatic attachment of SQL/XML extended model definition

  25. From Object Oriented Model Objects mapped according to the table below Generating XML Models

  26. XML in the database • Most of relational databases (RDB) now support XML so that you can store or retrieve data through XML files. • Some databases support SQLX • With an XML model, you can generate an annotated schema that will allow you to store or retrieve data in a relational database supporting XML. • Supported via the use of Extended Model Definitions (XEM) • Additional information added via extended attributes • An annotated schema is an XML-coded file, targeted with an XML language and tagged with specific DBMS annotations, that allows you to store or retrieve data in an XML format, from relational databases supporting XML. • Some databases require that a mapping to a PDM be established

  27. XML in the database • Supported Databases • ASA 9 • ASE 15 (future) • Microsoft SQL Server 2000 • Oracle 9i2 • IBM DB2 v8.1 (or higher)

  28. XML in the database - Microsoft SQL Server 2000 • Microsoft SQL Server 2000 is an XML-enabled database server • Supports annotations that can be used on XSD or XDR files, to map XML data to relational data. • Mapping to a Physical Data Model is required • Need to attach the Microsoft SQL Server extended model definition • Complete the mapping by defining extended attributes to XML objects.

  29. XML in the database - Oracle 9i2 • Oracle 9i2 is a database server with a native XML storage and retrieval technology called Oracle XML DB. • There is no mapping between XML data and relational data. • Tables, columns and abstract data types (ADT) are created from annotated schemas (XSDs). • Need to attach the Oracle 9i2 extended model definition. • Oracle 9i2 uses by default the name of the XML elements present in the annotated schema to generate SQL objects. • You can override the creation of SQL objects by defining extended attributes for elements, complex types and the XML model.

  30. XML in the database - IBM DB2 v8.1 (or higher) • IBM DB2 v8.1 (or higher) is a database server with an add-in for XML storage and retrieval called IBM DB2 Extender. • XML data (elements, attributes) are mapped to relational data (tables, columns) through Document Access Definition files (.DAD). • Xcolumn - The global element is mapped to a table, and its attributes or child elements are mapped to columns identified by an Xpath • Xcollection - The DAD file starts with a SQL statement for the table mapped to the global element, and each child element or attribute is mapped to a column or a table name • Xcollection - A Relational DataBase node, with a table and a column name, is associated with each attribute or child element of the global element • XML Model mapped to a Physical Data Model is required. • Need to attach the IBM DB2 DAD extended model definition. • Extended attributes specify the type of DAD file generated for each global element. • DAD files are generated with the DTD file and a SQL file for stored procedures.

  31. XML in the database - SQL/XML • SQL/XML is an XML extension of the Structured Query Language. With SQL/XML, you retrieve relational data using extended SQL syntax, and produce a result using XML. • An XML model allows you to generate SQL/XML queries for global elements. • XML Wizard • XML Builder Wizard • XML Model mapped to a Physical Data Model is required. • Need to attach the SQL/XML extended model definition. • Supported databases: • ASA 9 • ASE 15 (future) • Oracle • DB2

  32. XML in the database – XML Wizard for SQLX • The XML Wizard allow you to generate SQLX queries • You can customize the hierarchy, elements and attributes

  33. XML in the database – XML Wizard for SQLX • Example of a SQLX query

  34. XML in the database – XML Wizard for SQLX • Example of the XML Result

  35. XML in the database – XML Builder Wizard • The XML Builder Wizard allows you to select tables, define hierarchy, elements and attributes then generate a XML Model. • You can use the generated XML Model to produce both XML Schema and SQLX query.

  36. XML Document Template • There a XML Document XEM for XML Model that allows you to generate a XML Document Template. • You can use the XML Document Template to create sample XML documents.

  37. Validate XML documents • Ability to validate an XML document against a DTD, XSD or XDR model • Accomplished via an ActiveX add-in • Demo

  38. Conclusion • Why use PowerDesigner to model XML • Metadata control – PowerDesigner’s functionality allows you to maintain and document all metadata efficiently • Central Repository • Version control • Access control • Descriptions and Annotations on every object • Business Rules • Impact Analysis and Requirements model added in version 11 allow better visibility into how changes made to a model will impact the rest of the organization • Interoperability with other PowerDesigner models. • Mapping XML objects to Physical Data models or Object Models • Generation from Physical Data Models and Object Models • Integration with XML functionality in the target DBMS

  39. More Information • PowerDesigner Web Site: • http://www.sybase.com/powerdesigner • CodeXChange: • http://powerdesigner.codexchange.sybase.com • PowerDesigner Newsgroup: • news://forums.sybase.com/sybase.public.powerdesigner.general • PowerDesigner Advanced Documentation • Accessible from PowerDesigner help menu • PowerDesigner VBScript online help • Accessible from PowerDesigner help menu • Microsoft Windows Script online help • Can be downloaded from http://msdn.microsoft.com • OLE Automation samples • OLE Automation\*.* • PowerDesigner Metamodel • Examples\MetaModel.oom

  40. Conclusion QUESTIONS ???

  41. PDR607: XML Modeling with PowerDesigner

More Related