Home
September 2008 Copyright page Copyright (c) 2008 Sybase, Inc
Contents
1. DEPARTMENT GDEPNAME Occurrences NO orderBy EMPID DEPNUM FIRSTNAME LASTNAME DEPNUM INTEGER DEPARTMENT EMPLOYEE GDEPNUM NO gt EMPID INTEGER DEPARTMENT EMPLOYEE GEMPID Occurrences NO gt FIRSTNAME CHAR C12 DEPARTMENT EMPLOYEE GFIRSTNAME Occurrences NO gt LASTNAME CHAR CI DEPARTMENT EMPLOYEE GLASTNAME _occurrence No gt The following generation options are available Option Description Character ending an instruction Generates proce dures deployment Path of DAD dtd Schema validation Character ending instructions in the SQL file for stored procedures Generation of a SQL script for stored procedures enabling XML data storage and facilitating XML data retrieval Path of the DTD file installed with IBM DB2 Extender and describing the specific syntax of DAD files Validation tag in the DAD files to check the conformity of DAD files with the DAD syntax 151 Generating a DAD File for IBM DB2 152 Index A All group particle annotated schema Microsoft SQL Server 2000 Oracle 912 annotation application information check model create documentation global local properties any create namespace process contents properties any attribute namespace process contents application information create properties attribute AttributeType XDR check model create data type default default
2. Name unavailable to references to attribute groups Name of the attribute group It must be a no colon name See Glossary Required when the attribute group is global Code unavailable to references to attribute groups Code of the attribute group It must be a no colon name Required when the attribute group is global Comment Descriptive label of the attribute group Stereo Sub classification used to extend the semantics of an object type without changing its structure It can be predefined or user defined Reference for references to attribute groups only Name of an attribute group from the current model or any model opened in the workspace It must be a qualified name See Glossary If you select an attribute group from another model a shortcut is created with the referencing attribute group A reference allows you to reuse an attribute group with all its properties without having to define it again When a reference is defined the name and code properties are grayed The name and code are those of the target attribute group ID ID of the attribute group Its value must be of type ID and unique within the model containing this attribute group Attribute group property sheet Attributes tab The Attributes tab lists the attributes and attribute groups associated with the attribute group For information about the tools available on this tab for adding attributes and attribute groups see Creating an attribute on pa
3. Attribute namespace local processcontents skip gt lt xs comp lexType gt xs element xs schema Caution Any Attribute only is displayed in a schema see the Preview tab of a model property sheet The Any Attribute feature is available via a check box in the bottom left corner of an Attributes tab G Element Properties product PRODUCT olx Rules Dependencies Extended Dependencies VersionInfo Preview General Detail Attributes Constraints Annotation Mapping Notes 5 x em Ln eestor Object Type EXPIRY DATE None Attribute Any Attribute lt lt Less bd Cancel Apply Help To display an Any Attribute property sheet select the Any Attribute check box and then click the Properties tool Any attribute property sheet General tab 52 The General tab contains the following properties Chapter 2 Building XML Models Property Description ID ID of the Any Attribute Its value must be of type ID and unique within the model containing the Any Attribute Names Namespaces containing the attributes that can be used If you pace select fHtany attributes from any namespace can be used If you select other attributes from any namespace other than the target namespace of the schema can be used If you select local attributes that are not qualified with a namespace can be used If you select targetNamespace attributes f
4. You can use derivations to extend or restrict the values of elements and simple and complex types An XML model allows you to derive Elements by extension restriction list or union Simple types by restriction list or union Complex types by extension or restriction Derivation in element property sheet When you define a derivation in an element property sheet a simple or a complex type is automatically created within the element declaration See Preview tab The Embedded type property is automatically set to Simple or Complex and the Content property to Simple or Complex in the case of an embedded complex type Deriving by extension You can derive an element or complex type by extension to extend the values of its base type For example country string USaddress state T USaddress is a derivation by extension of the address complex type Generated schema 79 Derivations Extensions Restrictions Lists and Unions XSM lt xml version 1 0 encoding UTF 8 gt lt xs schema xmins xs http www w3 arg 2001 xMLschema gt xs complexType name ADDRESS gt xs sequence lt xs element name STREET types xs string xs element name CITY type xs string xs element name COUNTRY types xs string xs segqguence Ss xs complexType name USADDRESS gt lt xs complexcontent gt xs extension base ADDRESS gt lt xs 1s
5. xs schema xmlns xse http www w3 0rg 2001 xMLschema lt xs element name PROJECT xs complexType xs seguence lt xs element_name EMPLOYEE gt xs complexType xs attribute name NUMEMPLOYEE types xs string xs attribute xs complexType xs element lt xs element name PRODUCT gt 4 xs sequence xs complexType xs unique name UNIQUENUM gt xs selector xpathe employee gt lt xs field xpath numemployee gt xs unique xs element xs schema employee numEmployee xsistring The UNIQUENUM unique constraint defined on the project element specifies that the numEmployee attribute must be unique or null within the employee element A Key constraint specifies that an element or an attribute value or set of values must be a key within a specified scope the data must be unique not null and always present within a specified scope For example project 5 PROJECT product code xs positivelnteger Chapter 2 Building XML Models Generated schema xml versionsz 1 0 encoding UTF 8 xs schema xmlns xss http www w3 0rg 2001 xMLSchema xs element name PROJECT gt xs complexType lt xs Sequence gt lt xs element name EMPLOYEE gt lt xs element_name PRODUCT gt xs complexType xs attribute name CODE type xs positivelnteger gt x xs attribute xs complexType xs element
6. xs sequence xs complexType xs key name KEYCODE gt xs selector xpath product gt xs field xpathz code lt xs ikey gt xs element xs schema The KEYCODE key constraint defined on the project element specifies that the code attribute must be unique not null and always present within the product element A KeyRef constraint specifies that an element or attribute value or set of values corresponds to the value of a specified key or unique constraint A keyRef is a reference to a key or a unique constraint For example product fm S PRODUCT Generated schema 55 Constraints Keys Uniques and KeyRefs XSM lt xml versionsz 1 0 encoding UTF 8 xs schema xmins xs http www W3 org 2001 xMLSchema xmlns k keyRef namespace gt lt xs element name PRODUCT gt xs complexType lt 5 5 gt xs element name COMPONENT xs gt xs attribute type xs boolean gt xs attribute xs complexType xs element lt xs element name COMPONENT_2 gt xs complexType xs seguence lt xs element names COMPONENT 3 lt xs element names COMPONENT 4 lt xs rsequence gt xs attribute name GOLD type xs boolean gt xs attribute xs complexType xs element lt xs Sequence gt xs complexTypez xs unique name UNIGOLD xs selecto
7. Bibliography W3C XML Recommendation http www w3 org TR REC xml W3C DTD Recommendation http www w3 org TR REC xml dt doctype vi W3C XML Schema Recommendation http www w3 org XML Schema dev W3C XML Data Note http www w3 org TR 1998 NOTE XML data 0105 CHAPTER 1 Getting Started with XML Modeling About this chapter This chapter presents the PowerDesigner XML Model and describes how to create your model Contents Topic page XML Modeling with PowerDesigner 2 Creating an XSM S Customizing the XSM Environment 13 XML Modeling with PowerDesigner XML Modeling with PowerDesigner An XML model XSM is a graphical representation of an XML Schema Definition file XSD a Document Type Definition file DTD or an XML Data Reduced file XDR XML or eXtensible Markup Language is increasingly used to hold application data because it describes and structures data whereas HTML only displays data uses a self describing and personalized syntax can be exchanged between incompatible systems since data is stored in plain text format Since XML structures can be very complex it is much easier to visualize them through comprehensive and explicit diagrams than to read XML coded pages With its Browser tree view and diagram a PowerDesigner XSM gives you a global and schematic view of all the elements composing your XSD DTD or XDR amp u Workspace B E Resume En E Diagram 1 Mu Eig Si
8. By attaching the SQL XML extended model definition to an XML model mapped to a PDM you can also generate SQL XML queries to retrieve data in an XML format from relational databases supporting SQL XML The best way to generate SQL XML queries is to use the XML Builder Wizard which helps you build an XML model from a PDM The generated XML model is mapped to the PDM and automatically linked to the SQL XML extended model definition See Generating SOL XML queries on page 133 Mapping database objects to an XML schema via the XML Builder Wizard 132 s Ww You can create an XSM to generate an annotated schema from a PDM via the XML Builder To generate an annotated schema by mapping through the XML Builder Wizard 1 Open a targeted with the appropriate DBMS and select Tools XML Builder Wizard to open the XML Builder Wizard 2 Specify whether to create a new or work with an existing model and then click Next to go to the Tables and Views Selection page 3 Select the tables and views from which you want to generate the schema and then click Next to go to the XML Hierarchy Design page 4 Build your hierarchy by dragging and dropping tables and or columns from the left pane to the right pane or by using the tools above the panes Chapter 5 Working with XML and Databases XML Builder Wizard XML Hierarchy Design i x You can now build your own XML hierarchy from tables and views Select the columns op
9. Check Description and Correction KeyRef name and code uniqueness Undefined reference KeyRef names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code A keyRef must contain a reference to a key or a unique constraint Manual correction In the keyRef property sheet define a reference to a key or a unique constraint with the Reference list Automatic correction None 113 Checking an XML Model Check Description and Correction Existence of fields Undefined selector Unique checks A keyRef must contain at least one field Manual correction Add at least one field to the keyRef or delete the keyRef For example nu mEmployee Automatic correction Deletes unassigned keyRef For more information on fields see section Defining an identity constraint field in chapter Building an XML model You must define an XPath expression for a keyRef selector attribute Manual correction In the keyRef property sheet define an XPath expression for the selector attribute For example s company s employee Automatic correction None For more information on XPath expressions see section Defining an identity constraint selector in chapter Building an XML model The following XML model checks are made on uniques Check Description and Correction Unique name and code uniqueness Exist
10. Global SimpleType tag XML declaration Generated schema XML declaration Version attribute XML DECLARATION XML document ES F o s gl Encoding attribute Standalone attribute Global Element tag file EH Global Attribule tag Schema fag 3 A E bs Global SimpleType tag Global ComplexType tag XML desiaratiog ELEMENT tag file s a L pOcTYPE tag Bae ATTLISTtag ENTITY tag 29 Elements XSM 30 lt xml version 1 0 encoding UTF 8 gt xs schema xmlns xse http www w3 0rg 2001 xMLSschema xs element names xML DOCUMENT gt xs complexType lt 5 gt lt xs element name xsp FILE xs complexType xs sequence lt xs element ref xML DECLARATION lt xs element name SCHEMA_TAG gt xs complexType lt 11 gt lt xs element name GLOBAL ELEMENT TAG lt xs element name GLOBAL ATTRIBUTE TAG lt xs element name GLOBAL_SIMPLETYPE_TAG gt lt xs element names GLOBAL COMPLEXTYPE TAG xs all xs complexType xs element xsi seguence xs complexType lt xs relement gt lt xs element name DTD_FILE gt xs complexType lt xs Sequenc
11. No link Any B 5 g h c 73 No link No link No link No link B E No link p s B No link 8 No link No link No link All Chapter 2 Building XML Models Caution A group particle sequence choice all cannot be created from scratch in a diagram It must be the child element of an element a group or a complex type t For more information see sections How to link a child object to an element How to link a child object to a group particle How to link a child object to a group of elements How to link a child object to a complex type in chapter Building an XML model Creating an XML diagram You can create an XML diagram in an existing XSM in any of the following ways Right click the model in the Browser and select New XML Model Diagram from the contextual menu Right click the background of any diagram and select Diagram gt New Diagram gt New Diagram from the contextual menu To create a new XSM with an XML diagram select File New choose XML Model from the Model type list and click OK Group Symbols feature The Symbol Group Symbols feature is only available for free symbols in an XML diagram Expand Expand All Collapse Arrange Symbols features Right click a symbol in an XML diagram and select one of these features in the contextual menu Expand the hierarchy below a symbol is partially expanded only the first level Expand All the hierarchy b
12. Row tool Right click the model or package in the Browser and select New Entity ts For general information about creating objects see the Objects chapter in the Core Features Guide You can modify an object s properties from its property sheet To open an entity property sheet double click its diagram symbol or its Browser entry in the Entities folder The General tab contains the following properties Chapter 2 Building XML Models Property Description Name Name of the entity It must be a no colon name See Glossary Code Code of the entity It must be a no colon name Comment Descriptive label of the entity Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Value Value of the entity A string of characters in the case of a predefined value A URI in the case of an XML or a non XML file For example http something com pictures logo gif Public URI reference identifying the non XML object For example pictures gif System URI reference identifying the application that will process the non XML object For example user local pictureViewer Notation Used to define and process non XML objects within an XML model Parameter If selected the entity is parsed within the DTD and not within the XML document as for a general entity A parameter entity allows you to predefine a value within a DTD This predefined value ca
13. and then click the Expand tab 4 to reveal the group particle symbol in this case a sequence o Element 1 FT Element 1 Note that you can click the Collapse tab on the link in order to hide the group particle 3 Double click the group particle to open its property sheet and then click the Items tab 4 Click the Add Element tool for each child element you want to create in the list 5 Click OK to return to the diagram The group particle is displayed selected with an Expand tab on its right side Element 1 5 15 Element 1 asm 6 Click an empty space in the diagram to deselect the group particle symbol and then click the Expand tab to reveal the child element symbols Element 1 Element 1 3 fs Element_2 Elementa F yg Element 2 Element_3 Name and code uniqueness Child elements are defined within the namespace of their parent element Therefore there cannot be a conflict between a parent and a child name t For more information on the namespace concept see Controlling the namespace of a package in the Models chapter of the Core Features Guide Group particle properties You can modify an object s properties from its property sheet To open a group particle property sheet double click its diagram symbol or its Browser entry beneath its parent object The following sections detail the property sheet tabs that contain the properties most commonly en
14. b If you click a group symbol with the Choice tool a choice group particle is displayed linked to the group symbol P If you click a group symbol with the All tool an all group particle is displayed linked to the group symbol Chapter 2 Building XML Models Pointer indications When you cannot click a symbol or an empty space in a diagram the Pointer displays a forbidden sign See complex type in Tool column When there is a possibility to create a symbol above below or next to another one the Pointer displays an arrow indicating the corresponding direction See element in Tool column 67 Attribute Groups XSM Attribute Groups XSM 68 Attribute groups are not supported by XDR An attribute group is a set of attributes which is referenced in the model by various elements An attribute group is created independently without a parent element and can be reused multiple times by elements complex types or other global attribute groups through references In a schema it is directly linked to the schema tag root element See Creating an attribute group on page 69 Areference to an attribute group is created within an element complex type or global attribute group and makes the referenced attribute group available to its parent See Creating a reference to attribute group on page 69 For example XSD attributeGroup amp Diagram 1 jg Attribute Gro
15. on page 85 8 Click OK to close the restriction property sheet and return to the element simple type or complex type Restriction property sheet General tab The General tab contains the following properties Property Description ID ID of the simple type restriction Its value must be of type ID and unique within the model containing the simple type restriction Base type Data type on which the restriction is based Select a data type in the Base type list or with the Browse tool Embedded If selected the base type disappears and a simple type is type simple created in the schema within the current simple type types only Restriction property sheet Detail tab Facets are the constraints on the set of values of a simple type The Details tab lists the facets associated with the restriction Icon Facet Length Exact number of characters or list items allowed It must be equal to or greater than zero 82 Chapter 2 Building XML Models Icon Facet Minimum length Minimum number of characters or list items allowed It must be equal to or greater than zero Maximum length Maximum number of characters or list items allowed It must be equal to or greater than zero Minimum exclusive Lower bound for numeric values All values are greater than this value Maximum exclusive Upper bound for numeric values All values are lower than this value Minimum inclusive Mi
16. Guide Creating a reference to a group Group properties A reference to a group is created as a child of an element group or complex type and makes the referenced group available to its parent You can create a referencing group in any of the following ways Select the Group tool in the diagram Palette and click on an element group or complex type symbol On the Items tab of the property sheet of a group particle click the Add Group with Reference to Group tool see Group particle property sheet Items tab on page 42 ts For general information about creating objects see the Objects chapter in the Core Features Guide You can modify an object s properties from its property sheet To open a group or reference to a group property sheet double click its diagram symbol or its Browser entry in the Groups folder or in the case of a reference to a group beneath its parent object The General tab contains the following properties Property Description Name unavailable to references to groups Name of the group It must be a no colon name See Glossary Required when the group is global Code unavailable to references to groups Code of the group It must be a no colon name Required when the group is global Chapter 2 Building XML Models Property Description Comment Stereo type Reference Group type Minimum Maximum Descriptive label for the group Sub classificat
17. Resume D Main LZ 1 Contact i 2 Achievement E 3 Description iE 4 Address 9 88 Simple Types H Complex Types 9 88 Elements 9 88 Groups XML diagram objects Function xs string Status B C tai Diploma n Name xs string Dates StantDate xs gYearMonth EndDate xs gYearMonth Establishment 5 Address fAddressType Descriptions An XML model represents the structure of a potential or existing XSD DTD or XDR through a tree structure of child elements attached to parent elements Elements are the basic describing items of an XML model They can be made of other elements combined in different ways through group particles Elements are specified by attributes and data types which can be predefined or user defined Simple and complex data types can be defined as global directly linked to the lt schema gt tag or local embedded in an element declaration You can create the following objects in an XML diagram Object Tool Symbol Description Element Any Attribute 2 5l N A Element Element Any N A The basic object of an XML model An element can contain other elements or attributes See Elements XSM on page 29 Any type of object Can only be attached to a sequence or a choice group particle See Any Elements XSM on page 44 Additiona
18. Undefined reference Undefined type Notation checks Attribute names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code An attribute without a name or a code must have a reference Manual correction In the attribute property sheet define a reference with the Reference list or the Browse tool Automatic correction None You must define a data type for an attribute Manual correction In the attribute property sheet define a data type with the Type list or the Browse tool Automatic correction None The following XML model checks are made on notations 110 Chapter 3 Working with an XML model Check Description and Correction Notation name and code uniqueness Undefined notation Attribute group checks Notations names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code A notation must have at least one URI defined for Public or System properties Manual correction In the notation property sheet define a URI in the Public or System boxes Automatic correction None The following XML model checks are made on attribute groups Check Description and Correction Attribute group name and code uniqueness Undefined reference Existence of attributes Import chec
19. XML model targeted with DTD allows you to generate DAD files for IBM DB2 To generate an DAD files for DB2 1 Map an XSM to You can do this manually or by generating XSM from a PDM or a PDM from an XSM but we recommend that you use the XML Builder Wizard see Mapping database objects to an XML schema via the XML Builder Wizard on page 132 if you do not use the wizard Attach the SOL XML extended model definition see Attaching the SQL XML extended model definition on page 134 Further specify the mappings with extended attributes see Reinforcing DB2 mappings with extended attributes on page 148 Generate the annotated schema see Generating a DB2 DAD file on page 149 Mapping DB2 objects to an XML schema via the XML Builder Wizard 146 You can generate an annotated schema via the XML Builder Chapter 5 Working with XML and Databases To generate an annotated schema by mapping through the XML Builder Wizard 1 Open a targeted with the DB2 UDB 8 x Common Server DBMS and select Tools XML Builder Wizard to open the XML Builder Wizard Specify whether to create a new or work with an existing model and then click Next to go to the Tables and Views Selection page Select the tables and views from which you want to generate the schema and then click Next to go to the XML Hierarchy Design page Build your hierarchy by dragging and dropping tables
20. XSM You can create a new XSM from scratch or reverse engineer the model from an existing XSD a DTD or an XDR file For information about reverse engineering see the Generating and reverse engineering an XSD a DTD or an XDR file chapter create a new XSM 1 Select File gt New to display the New dialog box Model type BEC New model C New model from template S Business Process Model General Extended Model Definitions Conceptual Data Model Sb Free Model Model name 1 Information Liquidity Madel it Object Oriented Model TA Physical Data Model XML language Schema Definition 1 0 nj Requirements Model Share the XML language definition Copy the XML language definition in model 2 Select XML Model in the list of model types 3 Select one of the following radio buttons New model Creates a new standard model New model from template Creates model from a model template A model template is a set of model options display preferences extension or objects saved in a model located in the template folder You use model templates when you need to reuse preferences and options in several models t For more information about model templates see the Model templates section in the Models chapter of the Core Features Guide 4 Type a model name in the Model name box The code of the model which may be used for script or code generation is deriv
21. a symbol or an empty space in a diagram the Pointer displays a forbidden sign See complex type in Tool column When there is a possibility to create a symbol above below or next to another one the Pointer displays an arrow indicating the corresponding direction See element in Tool column Specifying the type of content of a complex type Content property sheet General tab 78 2 Ww A complex type can contain either simple content character data or a simple type but no elements or complex content elements or elements and character data To specify the type of content of a complex type 1 Open the property sheet of a complex type and select either simple or complex in the Content list 2 Click Apply to make available the Properties tool to the right of the list 3 optional Click the Properties tool to open the property sheet of the content and specify an ID and in the case of complex content whether the content can be mixed 4 Click OK to return to the diagram The General tab contains the following properties Property Description ID ID for the complex content Its value must be of type ID and unique within the model containing the complex content Mixed com Specifies that character data is allowed to appear between plex content child elements of the complex type only Chapter 2 Building XML Models Derivations Extensions Restrictions Lists and Unions XSM
22. an arrow indicating the corresponding direction See elements in Tool column 38 Chapter 2 Building XML Models Group Particles XSM An element composed of other elements is a parent element with child elements Child elements are linked to their parent element through a group particle Child element 1 Parent element 47 5 E Child element 2 JPARENT ELEMENT b There are three kinds of group particles Tool Symbol Description Child element 3 amp Sequence Child elements must appear at least once in the order of their declaration ico 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 at all These particles translate to the following tags in each of the supported languages Group Par XSD XDR order attribute DTD separator ticle Sequence seq comma sequence Choice choice one bar All all many comma Creating a group particle You can create a group particle in any of the following ways Use the Sequence Choice or All tool in the diagram Palette Open the property sheet of an element group or complex type and select a group particle from the Group type list 39 Group Particles XSM 40 ts For general information about creating objects see the Objects chapter in the Core Features Guide To create a group particle f
23. beneath the model item If the new global object does not appear in the diagram select Symbol Show Symbols and click the corresponding tab to select the object symbol 119 Manipulating XML Objects Graphically Workspace E Customer Directory Diagram_1 gg Complex Types E Job Type nickname None fg Elements E Address Customer TS Example before local j E Customer CUSTOMER ned global conversions within Ei sequence the B Address Shortcut e Browser NET E Name Address Shortou E E Attributes Job is a child element of the Customer element Nickname is the attribute of the Name element Workspace Customer Directory Diagram 1 gp Complex Types Job Type Elements EE Address CUSTOMER After conversions E Customer S sequence Address Shortcut E Name JOB TYPE ee gg Attributes ese nickname Address Shortcu Job became Job2 a global element Nickname became a global attribute 120 Chapter 3 Working with an XML model Comparing and Merging XML Models You can compare and merge two XML models with the same XML language The comparison process allows you to highlight the differences between two XML models The merge process allows you to form a single model that combines design efforts perfo
24. external schema file in the current schema allowing you to use components from any schema with the same target namespace as the current schema or with no specified target namespace In a schema a redefine is declared with the lt redefine gt tag For example xml versionsz 1 0 encoding UTF 8 xs schema xmins xs http www w3 org 200L xMLSchema gt xs redefine id REDEFL schemaLocation CUSTOMERS xsd gt xs group name PRIVILEGED_CUSTOMERS gt xs all lt xs element names CUSTOMER 1 xs element name CUSTOMER 2 lt xs element names CUSTOMER 3 xs all xs group xs complexType name PRIVILEGE gt xs complexType xs redefine xs schema Chapter 2 Building XML Models Creating an import include or redefine instruction You can create an import include or redefine instruction in any of the following ways Select Model Import Include or Redefine to access the relevant list and click the Add a Row tool Open the External Schemas tab in the property sheet of the model and click the Add Import Add Include or Add Redefine tool Right click the model or package in the Browser and select New Import Include or Redefine t For general information about creating objects see the Objects chapter in the Core Features Guide Import include and redefine properties You can modify an import include or redefine instruction s properties from it
25. generation will generate a bean class with this name instead of generating a name from the element name Specifies the column storage clause that is inserted into the default CREATE TABLE statement It is useful mainly for elements that are mapped to tables namely top level element declarations and out of line element declarations Specifies the name of the table into which XML instances of this schema should be stored This is most useful in cases when the XML is being inserted from APIs where table name is not specified for example FTP and HTTP Used to specify the name of a Java class that is derived from the corresponding bean class to ensure that an object of this class is instantiated during bean access If a JavaClassname is not specified Oracle XML DB will instantiate an object of the bean class directly If true instances of this element are stored so that they retain DOM fidelity on output This implies that all com ments processing instructions namespace declarations and so on are retained in addition to the ordering of elements If false the output need not be guaranteed to have the same DOM behavior as the input If true the collection is mapped to a VARRAY If false the collection is mapped to a NESTED TABLE Name of the database user owning the type specified by SQLCollType Specifies the name of the SQL collection type corre sponding to this XML element that has maxOccurs gt 1 Chapter 5 Working with
26. gt xs attribute xs complexType xs element xs sequence lt xsiattribute name DEPNUM type xs int sq field DEPNUM gt lt xs attribute x lt xs attribute gt lt x5 complexType gt lt xs element gt lt xs sequence lt xs complexType gt lt xs element gt lt gt attribute name DEPNAME types xs string sql field DEPNAME gt Note the SQL namespace with the sql prefix and the SQL annotations for tables sql relation columns sql field and reference sql relationship 140 Chapter 5 Working with XML and Databases Generating an Annotated Schema for Oracle 9i2 Oracle 912 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 Annotated schemas are XML coded files targeted with an XML language and tagged with specific DBMS annotations that allow you to store or retrieve data in an XML format from relational databases supporting XML An XML model allows you to generate an annotated schema XSD for Oracle 912 You just need to attach the Oracle 912 extended model definition to the XML model 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 exte
27. mapping resulting from the XML Builder Wizard via extended attributes Toattach the XEM 1 Select Model Extended Model Definitions to open the List of Extended Model Definitions 2 Click the Import an Extended Model Definition tool to open the Extended Model Definition Selection dialog box click the XML in Database tab select IBM DB2 DAD and click OK in order to attach it to the model DAD file preview In the Preview tab of the Root element property sheet click the DB2XMLEXxtender DAD File tab to preview the DAD file If the DAD File tab is not available click the Select Generation Targets tool to select IBM DB2 DAD in the Targets list and click OK DB2 extended attributes for global elements 148 You can set extended attributes on global elements to reinforce their mapping to tables and columns by opening their property sheets and clicking the Extended Attributes tab Extended attribute Description Database DTDID Login MappingType NamespaceNode Name of the database ID added to the DTD ref system table in DB2 XML Extender Name of the logged in user Type of mapping for a collection Text zone where each line describes a namespace couple value The separator character is z Chapter 5 Working with XML and Databases Extended attribute Description Password Password of the logged in user PathGeneration Generation path ProcessInstruction A text zo
28. names DIVNUM xs simpleType lt xsirestriction base ID gt lt xsiminiInclusive value L gt lt xsipattern value 00000 gt xs restriction xs simpleType xs attribute xs attribute name DIVNAME types NAME xs attribute xs attribute name DIVADDR types SHORT TEXT lt xstattribute gt xs complexType xs element An XSD file always starts with the schema tag root element objects created in the model will appear in the XSD file between the schema start tag and end tag An XDR file is a simplified XSD file or schema It does not support simple and complex user defined data types An extract of an XDR file follows lt xml version 1 0 encoding UTF 8 schema name PROJECT xmlns urn schemas microsoft com xm l data xmins dt urn schemas microsoft com datatypes gt lt description gt Project Management lt description gt ElementType name DIVISION content empty gt AttributeType name DIVNUM gt attribute type DIVNUM gt lt AttributeType name DIVNAME dt type string gt attribute type DIVNAME gt lt AttributeType name DIVADDR dt type string attribute type DIVADDR gt lt ElamentType gt An XDR file always starts with the lt schema gt tag root element All objects created in the model will appear in the XDR file between the schema start tag and end tag Chapter 1 Getting Started with XML Modeling Creating an
29. objects in an XML model 19 Customizing the XSM Environment 20 You can type stereotypes directly in the Stereotype column of the object property sheet or select a value from the list if you have previously defined stereotypes in an embedded or imported extended model definition XEM t For more information on extended model definitions see Extended Model Definitions in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual CHAPTER2 Building XML Models About this chapter Contents This chapter describes how to build an XML model XSM It explains the role of each object in an XML model and how to create and modify them Topic page XML Diagram Basics 22 Elements XSM 29 Group Particles XSM 39 Any Elements XSM 44 Attributes XSM 46 Constraints Keys Uniques and KeyRefs XSM 54 Groups XSM 62 Attribute Groups XSM 68 Simple Types XSM 11 Complex Types XSM TS Derivations Extensions Restrictions Lists and Unions XSM 79 Annotations XSM 89 Notations XSM 02 Entities XSM 94 Instructions Import Include and Redefine XSM 96 Business Rules XSM 99 21 XML Diagram Basics XML Diagram Basics An XML diagram is the easiest way to define the structure and content of an XML document if you are not familiar with the syntax of XML Schema Definition XSD Document Type Definition DTD or XML Data Reduced 22 XDR Wit
30. of the current complex type If selected this property indicates that character data is allowed to appear between the child elements of the current complex type Select Mixed only if the current complex type has a complex content See general properties If selected this property indicates that the complex type can be used in the instance document ID of the complex type Its value must be of type ID and unique within the model containing this complex type Complex type property sheet Attributes tab Attributes see Attributes XSM on page 46 give additional information about a complex type The Attributes tab lists the attributes and attribute groups associated with the complex type For information about the tools available on this tab for adding attributes see Creating an attribute on page 47 75 Complex Types XSM Complex type property sheet Mappings tab Object mapping is the ability to establish a correspondence between objects belonging to heterogeneous models and diagrams The Mapping tab of a complex type property sheet allows you to map the current complex type to PDM or OOM objects Select a data source in the Mapping for list If it is the first time you define a mapping for a complex type the Mapping for list is empty Click the Add a Mapping for a Data Source tool and select a data source Complex Type Sources The Complex Type Sources tab allows you to associate or several tab abstract data
31. preferences allow you to customize the format of object symbols and the information that is displayed on them To set XSM display preferences select Tools Display Preferences or right click the diagram background and select Display Preferences from the contextual menu For information about changing the format of symbols see Format display preferences in the Customizing your Modeling Environment chapter of the Core Features Guide The following sections list the options available to customize the information displayed on XSM object symbols Note that the objects available to be customized in the Display Preferences window are dependant upon the current diagram type Element display preferences To set display preferences for elements select Tools Display Preferences and select the Element sub category in the left hand Category pane 17 Customizing the XSM Environment Preference Description Attributes Display limit Stereotype Type Comment Show XPath Element At tributes Complex type display preferences Displays attributes and attribute values of the element Maximum number of attributes displayed Displays the stereotype of the element Displays the data type of the element Displays the comment of the element An XPath expression indicates the relationship between an element and the root element lt schema gt tag Select Never if you do not want the elements XPath expressions to be displ
32. property sheet and select a base type with the Base type list or the Browse tool Automatic correction None The following XML model checks are made on restrictions 115 Checking an XML Model Check Description and Correction Undefined base type Existence of facet Simple type list checks You must define a base type when you derive a simple or a complex type by restriction Manual correction In the simple or complex type property sheet click the Properties tool beside the Derivation box to display the Extension property sheet and select a base type with the Base type list or the Browse tool Automatic correction None A simple type restriction must have at least one facet defined Facets are defined in the Detail Enumer ations and Patterns tabs of a simple type restriction property sheet Manual correction Define one or more facets in the simple type restriction property sheet Automatic correction None The following XML model checks are made on simple types Check Description and Correction Undefined base type Simple type union checks You must define a base type when you derive a simple type by list Manual correction In the simple type property sheet click the Properties tool beside the Derivation box to display the simple type list property sheet and select a data type with the Type list or the Browse tool Automatic correction None The following XML model checks are ma
33. tab of a group property sheet Right click a group or a referencing group symbol in the diagram and select Preview in the contextual menu Linking child objects to a group XML objects do not support standard link objects To link a child object to a group you must click the child object tool in the palette and then click the group symbol in the diagram This will automatically create a link between 65 Groups XSM both objects See the following table for allowed links Tool Action gt E ls A 66 If you click a group symbol with the Element tool a se quence group particle and a child element symbol are created You can modify the group particle via its property sheet If you click a group symbol with the tool a se quence group particle and an any symbol are created You can modify the group particle via its property sheet 5 If you click a group symbol with the Group tool a se quence group particle and a referencing group are created You can modify the group particle via its property sheet You must now select a group for the reference C 3 9 If you click a group symbol with the Complex Type tool a complex type symbol is displayed superposed but not linked to the group symbol A global complex type cannot be the child of a group If you click a group symbol with the Sequence tool a sequence group particle is displayed linked to the group symbol
34. to the element or simple type List property sheet The General tab contains the following properties General tab 86 Chapter 2 Building XML Models Property Description ID ID of the simple type list Its value must be of type ID and unique within the model Type Data type for the list of values Embed If selected the type disappears and a simple type is created in ded Type the schema within the current simple type or element Deriving by union You can derive an element or simple type by union to define it as a collection of built in and simple data types To define an element or simple type derivation by union 1 Open the property sheet of an element or simple type and select Union in the Derivation list For elements the Embedded type field is set to Simple 2 Click the Properties tool to the right of the Derivation box to open the union property sheet Simple Type Union Properties _ B General Union Types Annotation Dependencies Version Info ID sru1 Member types xs integer xs string xs date xs time xs decimal xs boolear lt lt Less m Cancel Apply 3 Enter ID and member types for the union 87 Derivations Extensions Restrictions Lists and Unions XSM 4 optional Click the Union Types tab and add appropriate simple types to the union 5 Click OK to close the union property sheet and return to the element or si
35. types in PDMs or classes in OOMs to the current complex type You can use the Add Objects tool to select abstract data types or classes from the PDMs or OOMs opened in the current workspace Attributes Mapping tab The Attributes Mapping tab allows you to define the mapping between abstract data type attributes in PDMs or class attributes in OOMs and attributes in the current complex type Icon Description Es Add Mapping To select the attributes in the current complex type that will be mapped to abstract data type attributes or class attributes Once you have selected the attributes you can use the list in the Mapped to column to select corresponding abstract data type attributes or class attributes il Create from Sources To copy abstract data type attributes or class attributes to the current complex type attributes il Generate Mapping To automatically generate a mapping between abstract data type attributes or class attributes and complex type attributes with same name or code in the data source and the current model t For more information on complex type mapping see section Mapping objects in an XML model in chapter Working with an XML model How to link a child object to a complex type XML objects do not support standard link objects To link a child object to a complex type you must click the child object tool in the palette and then click the complex type symbol in the diagram This will automatical
36. xml data xmlns dt urn schemas microsoft com datatypes ElementType ElementType ElementType ElementType ElementType name linel content empty line2 contents empty lines content empty name name content empty gt name product model closed content eltonly order seq gt element types name group element type linel element type line2 element types line3 lt group gt lt ElementType gt lt schema gt Groups in DTD and XDR files In a model targeted with DTD or XDR language there are no global or referencing groups although they appear on the diagram Groups are expanded within their parent element and their child elements are declared individually as global elements See generated DTD and XDR files in Groups XSM on page 62 A group is created independently in the diagram and will be reused within other elements by way of references see Creating a reference to a group 63 Groups XSM on page 64 You can create a group in any of the following ways Select the Group tool in the diagram Palette and click in an empty space in the diagram Select Model gt Groups to access the List of Groups and click the Add a Row tool Right click the model or package in the Browser and select New gt Group t For general information about creating objects see the Objects chapter in the Core Features
37. 0 encading UTF 8 lt xsischema xm ns xs http www w3 o0rg 2001 xMLschema xmlns sqls http xmlns oracle com xdb lt xs element name Branch sql soLName branch xs complexType xs sequence lt xs element name Department type DepType sql soLNames office xs sequence xs complexType xs element xs complexType name DepType sql soLTypes officeType xs complexType xs schema Note the Oracle namespace with the sql prefix and annotations for tables sqi SQL and ADTs sql SQLType 145 Generating a DAD File for IBM DB2 Generating a DAD File for IBM DB2 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 There are three types of DAD files ie 4 Storage Description Xcolumn Column mapping the Root element is mapped to a table and its attributes or child elements are mapped to columns identified by an XPath Xcollection SQL mapping the DAD file starts with a SQL statement for the table mapped to the Root element and each child element or attribute is mapped to a column or a table name Xcollection RDB mapping a Relational Database node with a table and a column name is associated with each attribute or child element of the Root element An
38. 122 4 Generating and Reverse Engineering XML Schemas 123 Generating XML Schema 124 Reverse engineering an XML Schema into an XSM 126 iii 5 Working with XML and Databases 131 Introducing XML in Databases 132 Generating an Annotated Schema for Microsoft SQL Server 2000 EOS NE ITIN 136 Generating an Annotated Schema for Oracle 912 141 Generating a DAD File for IBM DB2 146 Index 153 About This Manual Subject This book describes the PowerDesigner XML Model including how to create an XSM build each of the available diagrams and generate and reverse engineer XML schemas Audience This book assumes that you are an experienced Windows user with some experience of XML Documentation primer For information about the complete documentation set provided with PowerDesigner see the Getting Started with PowerDesigner chapter of the Core Features Guide Typographic conventions PowerDesigner documentation uses special typefaces to help you readily identify specific items monospace text normal and bold Used for Code samples commands compiled functions and files references to variables Example declare user defined theBeforeInsertTrigger template bold text Used for New terms Example A shortcut has a target object SMALL CAPS Used for Key names Example Press the ENTER Key
39. 2 Building XML Models Business Rules XSM A business rule is a rule that your business follows It is a written statement specifying what an information system must do or how it must be structured It could be a government imposed law a customer requirement or an internal guideline You can attach business rules to your model objects to guide and document the creation of your model For example the rule an employee belongs to only one division can help you graphically build the link between an employee and a division 18 For more information see Business Rules section in the Objects chapter of the Core Features Guide 99 CHAPTER 3 Working with an XML model About this chapter This chapter describes a number of basic features available with XML models Contents Topic page Generating Other Models from an XML Model 102 Checking an XML Model 103 Manipulating XML Objects Graphically 118 Comparing and Merging XML Models 121 XML Model Reports 122 101 Generating Other Models from an XML Model Generating Other Models from an XML Model You can generate another XSM from your XSM When changes are made to the source model they can then be easily propagated to the generated models using the Update Existing Model generation mode 102 i Ww To generate one XSM from another 1 Select Tools gt Generate XML Model Ctrl Shift M to open the XML Model Generation Options Window On the General t
40. 36 mixed 75 78 model 2 attribute form 7 block 7 check model 104 compare and merge XML models 121 copy XSM 5 create 5 details T element form 7 environment 13 extended definitions 19 extended dependencies 19 external schemas properties 9 final 7 items 9 namespaces properties 10 naming conventions 15 options 15 preview properties 12 properties 6 share XSM 5 N namespace 10 44 51 node context node 57 root node 57 notation 92 check model 110 156 create 92 properties 92 1 912 141 parent element 39 pattern 81 process contents 44 51 R RDB 132 redefine 96 check model 112 create 97 properties 97 reference 31 48 54 62 68 report 122 create model report 122 restriction 81 check model 115 enumeration 81 fraction digits 81 length 81 maximum exclusive 81 maximum inclusive 81 maximum length 81 minimum exclusive 81 minimum inclusive 81 minimum length 81 pattern 81 total digits 81 whitespace 81 reverse engineering options 126 target models 126 to existing XML model 128 to new XML model 126 XSD DTD or XDR file to existing XML model 126 XSD DTD or XDR file to new XML model 126 root node 57 S schema 2 Index selector 54 57 stereotype 57 XPath 57 Sequence group particle 39 shortcut check model 104 managing external shortcuts through references and data types 27 simple content 78 simple type 71 check model 107 create 71 derive by list 86 derive by union 87 derived
41. Expand nodes Display filter Show elements Show complex types M Show groups M Show simple types M Convert unique references to elements Cancel Help 5 On the Options page specify the file you want to reverse engineer and select any appropriate options see Reverse engineering options on page 127 6 optional Click the Target Models tab and specify any existing PowerDesigner models which are referenced in the file being reverse engineered These references will become shortcuts in the reversed model 7 Click OK to begin reverse engineering The XML file is reversed into an XML model and displayed in the diagram window and the Browser The result is also displayed in the Reverse page of the Output window Reverse engineering options The Options page of the Reverse Engineering dialog box displays the following options 127 Heverse engineering an XML Schema into an XSM Option Description Show sym Creates symbols for the reversed objects in the diagram If bols you select to show symbols you can also specify to expand all the nodes and to display elements groups and complex and simple types Convert Enables the display of shortcuts to XML structures in other unique ref models as expandable nodes instead of simple shortcuts Since erences to global objects with a single reference in the model will be elements converted into child objects you should not use this option if you w
42. FIDELITY types xs string xs attribute xs attribute name SOLVENCY types xs string xs attribute xs complexType xs element xs sequence xs attribute name FOUNDATION type xs date gt lt xstattribute gt xs attribute name STATUS type xs token gt xs attribute xs complexType xs element xs attribute names NUMBER types xs positiveInteger xs attribute xs schema In a schema attributes are declared with attribute tags Creating an attribute ts You can create attributes and attribute groups on the Attributes tab of an element complex type or attribute group using the following tools 47 Attributes XSM Tool Description g e e Add Attribute Creates a local attribute Add Undefined Reference to Attribute Group Adds an attribute group with a reference to an attribute group defined in the current model Select a name in the Reference list You can also type a new name in the Reference column and then define a new attribute group in the Attribute Groups list See Model menu Add Reference to Attribute Adds one or several attributes with a reference to global attributes defined in the current model Select one or several global attributes in the Selection dialog box Add Reference to Attribute Group Adds a reference to an attribute group defined in the current model Select one or several attribute groups in the Selectio
43. If you type a combination of URI references targetNamespace and local provided they are separated by a white space objects from this combination can be used Only available in a model targeted with XSD Indicator of how an XML processor should handle validation of XML documents containing the objects specified by the Any If you select Strict the XML processor must obtain the schema and validate any object of the specified namespaces If you select Lax the XML processor will try to obtain the schema and validate any object of the specified namespaces If the schema cannot be found no error will occur If you select Skip the XML processor will not try to validate the objects of the specified namespaces Only available in a model targeted with XSD 45 Attributes XSM Attributes XSM 46 Attributes are used to give additional information about elements There are global and local attributes Global attributes are defined with the Model menu In a schema they are directly linked to the schema tag root element They can be reused for any element in the model through references See NUMBER attribute in the generated schema Local attributes only apply to the elements in which they are created They can be defined by reference to a global attribute See Reference property Global and local attributes in XDR files In a model targeted with the XML Data Reduced language local at tributes are first decl
44. P Xx Annotation Dependencies Version Info General Detail Enumerations Patterns amp amp Bx mY Se eS u 5 Z amp Z 0 3 5 LCCC i lt lt Less m Cancel Apply Help Generated schema xs simpleType name ZIPCODE gt xs restriction bases xs string xs pattern 1 2 2 0 9 15 gt xs restriction xs simpleType 85 Derivations Extensions Restrictions Lists and Unions XSM Deriving by list You can derive an element or simple type by list to define it as a list of values of a specified data type To define an element or simple type derivation by list 1 Open the property sheet of an element or simple type and select List in the Derivation list For elements the Embedded type field is set to Simple 2 Click the Properties tool to the right of the Derivation box to open the list property sheet Simple Type List Properties B x General Annotation Dependencies Version Info ID stu Embedded type re lt lt Less V Cancel Apply Help 3 Enter an ID and a type for the list If you select Embedded type the type disappears and a simple type is created in the schema within the current simple type Click Apply and then the Properties tool beside the Embedded type box to define a derivation and a type for the embedded simple type 4 Click OK to close the list property sheet and return
45. SM To specify a constraint selector 1 Open the property sheet of a constraint and enter an XPath expression in the Selector XPath field see XPath abbreviated syntax on page 59 2 Click Apply to make available the Properties tool to the right of the field 3 Click the Properties tool to open the selector property sheet fS Selector Properties iof x General Annotation Dependencies Version Info XPath fs company s employee Stereotype Poo ID lt lt Less v Cancel Apply Help 4 optional Enter additional properties for the selector and then click OK to return to the constraint Specifying constraint fields Constraint fields are XPath expressions used to define a constraint unique key or keyRef To create an identity constraint field 1 Open the property sheet of a constraint and then click the Fields tab 2 Click in the XPath column and enter an XPath expression see XPath abbreviated syntax on page 59 3 Click the Properties tool to open the property sheet of the field 58 Chapter 2 Building XML Models Field Properties iol x General Annotation Dependencies Version Info Path numE mployee Stereotype Poo ID lt lt Less m Cancel Apply 4 optional Enter additional properties for the selector and then click OK to return to the constraint XPath abbreviated syntax An XPath expression allows you to locate a no
46. SYBASE XML Modeling Sybase PowerDesigner 15 0 Windows Part number DC20014 01 1500 01 Last modified September 2008 Copyright 2008 Sybase Inc and its subsidiaries All rights reserved Information in this manual may change without notice and does not represent a commitment on the part of Sybase Inc and its subsidiaries Sybase Inc provides the software described in this manual under a Sybase License Agreement The software may be used only in accordance with the terms of the agreement No part of this publication may be reproduced transmitted or translated in any form or by any means electronic mechanical manual optical or otherwise without the prior written permission of Sybase Inc and its subsidiaries Use duplication or disclosure by the government is subject to the restrictions set forth in subparagraph c 1 ii of DFARS 52 227 7013 for the DOD and as set forth in FAR 52 227 19 a d for civilian agencies Sybase SYBASE logo ADA Workbench Adaptable Windowing Environment Adaptive Component Architecture Adaptive Server Adaptive Server Anywhere Adaptive Server Enterprise Adaptive Server Enterprise Monitor Adaptive Server Enterprise Replication Adaptive Server Everywhere Advantage Database Server Afaria Answers 365 Answers Anywhere AppModeler APT Workbench APT Build APT Edit APT Execute APT Translator APT Library ASEP Avaki Avaki Arrow Design Avaki Data Grid AvantGo Bit Wise BizTr
47. Sharelink SKILS smart partners smart parts smart script SOA Anywhere Trademark SQL Advantage SQL Anywhere SQL Anywhere Studio SQL Code Checker SQL Edit SQL Edit TPU SQL Modeler SQL Remote SQL SMART SQL Toolset SQL Station SQLJ Stage III Engineering STEP SupportNow S W I F T Message Format Libraries Sybase 365 Sybase Central Sybase IQ Sybase Learning Connection Sybase MPP SyberLearning LIVE SyberLearning OnDemand Sybase SQL Desktop Sybase SQL Lifecycle Sybase SQL Workgroup Sybase Synergy Program Sybase Virtual Server Architecture Sybase User Workbench SybaseWare Syber Financial SyberAssist SybFlex SybMD SyBooks System 10 System 11 System XI logo SystemTools Tabular Data Stream The Enterprise Client Server Company The Extensible Software Platform The Future Is Wide Open The Learning Connection The Model For Client Server Solutions The Online Information Center The Power of One TotalFix TradeForce Transact SQL Translation Toolkit Turning Imagination Into Reality UltraLite UltraLiteJ UltraLite NET UNIBOM Unilib Uninull Unisep Unistring Unwired Accelerator Unwired Orchestrator URK Runtime Kit for UniCode Unwired Accelerator Unwired Orchestrator Viafone Virtualized Resource Management VisualWriter WarehouseArchitect Warehouse Studio Warehouse WORKS Watcom Watcom SQL Web Deployment Kit Web PB Web SQL WebSights WebViewer XA Library XA Server XcelleNet XP Server XTNDAccess and XTNDCon
48. To specify the minimum number of occurrences for a local element Usually set to 0 or 1 Tab Detail Field Minimum maxOccurs local elements only To specify the maximum number of occurrences for a local element Usually set to 1 or unbounded Tab General Field Maximum Example of an XDR file xml versionz 1 0 encoding uTF 8 gt schema name xDR elements xmlns urn schemas microsoft com xml data xmlns dt urn schemas microasoft com datatypes ElementType name localElement content empty gt ElementType name globalElement model closed content eltonly order seq dt values 0 1 2 gt element type localElement minoccurs 0 maxoccurs gt lt ElementType gt Schema Element property sheet Detail tab The Detail tab contains the following properties 34 Chapter 2 Building XML Models Property Description Minimum Minimum number of times the element can occur To specify that the element is optional set this attribute to zero Maximum Maximum number of times the element can occur For an unlimited number of times select unbounded Substitution Name of a global element for which the current element can group be substituted It must have the same type or a derived type Its value must be a qualified name See Glossary Default Default value of the element if its content is a simple type or text only Enter a default value only if there is no fixed value Fixed Pred
49. Undefined schema location 106 You must define a schema location for an include Manual correction Define a URI or select a schema file for the schema location For example proforma xsd Automatic correction None Chapter 3 Working with an XML model Simple type checks The following XML model checks are made on simple types Check Description and Correction Simple type name and code uniqueness Complex type checks Simple type names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code The following XML model checks are made on complex types Check Description and Correction Complex type name and code uniqueness Existence of attribute Existence of particle Element checks Complex type names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code A complex type should have at least one at tribute Manual correction Define an attribute for the complex type Automatic correction None A complex type must contain elements groups group particles and or Any Manual correction Add items to the complex type or delete complex type Automatic correction None The following XML model checks are made on elements 107 Checking an XML Model Check Descrip
50. XDR details embedded type fixed form global local properties reference stereotype type XDR use 39 136 141 89 89 117 89 89 89 89 90 44 44 44 44 45 51 51 51 89 90 91 46 48 110 47 48 50 49 50 48 50 50 48 48 48 48 48 49 50 values DTD XDR attribute group check model create properties reference stereotype AttributeType XDR default dt type dt values name base type bibliography block business rule C check model annotation attribute attribute group complex type data source element entity extension group group particle import include key keyRef model namespaces notation redefine restriction shortcut simple type 51 68 111 69 68 69 68 68 49 49 49 49 79 7 34 75 99 117 110 111 107 105 107 106 115 109 103 111 106 112 113 104 104 110 112 115 104 107 153 Index simple type list simple type union target namespace unique XSM child element Choice group particle compare XML models complex content complex type attributes properties block check model complex content create detail properties display preferences final global local mapping properties mixed properties simple content constraint create properties content context node convert local to global object D DAD file data source data type attribute attribute check complex type element element check extension external
51. XML and Databases Annotation Description SQLInline SQLName SQLSchema SQLType tableProps If true this element is stored inline as an embedded attribute or a collection if maxOccurs gt 1 If false a REF or collection of REFs if maxOccurs gt 1 is stored This attribute will be forced to false in certain situations like cyclic references where SQL will not support inlining Specifies the name of the attribute within the SQL object that maps to this XML element Name of the database user owning the type specified by SQLType Specifies the name of the SQL type corresponding to this XML element declaration Specifies the TABLE storage clause that is appended to the default CREATE TABLE statement This is meaningful mainly for global and out of line elements Complex type extended following annotations can be specified on the Extended Attributes tab of attributes the property sheets of complex types Annotation Description beanClassname Can be used within element declarations If the element is based on a global complexType this name must be identical to the beanClassname value within the complexType declaration If a name is specified by the user the bean generation will generate a bean class with this name instead of generating a name from the element name SQLSchema Name of the database user owning the type specified by SQLType SQLType Specifies the name of the SQL type corresponding t
52. a Definition 1 0 XML Schema Definition 1 0 Model Options ModelOptions ModelOptions VS ModelOptions ModelOptions VS D Author D Version 5 Review the objects that you will be importing and the changes that they will make to the model For more information on merging models see the Comparing and Merging Models chapter in the Core Features Guide 6 Click OK to merge the selected changes into your model 7 optional Select Symbol Auto Layout to organize the new symbols in your diagram 129 CHAPTER 5 Working with XML and Databases About this chapter This chapter describes how to use an XML model to store or retrieve data in databases supporting XML Contents Topic page Introducing XML in Databases 132 Generating an Annotated Schema for Microsoft SQL Server 2000 136 Generating an Annotated Schema for Oracle 912 141 Generating a DAD File for IBM DB2 146 131 Introducing XML in Databases Introducing XML in Databases Most relational databases now support XML so that you can store or retrieve data through XML files You can use an XML model to generate an annotated schema that will allow you to store or retrieve data in such a database The following databases are supported Database Mapped XML Targeted XML Required XEM model language file Microsoft SQL Yes XSD or XDR Microsoft SQL Server 2000 Server Oracle 912 No XSD Oracle 912 IBM DB2 v8 1 Yes DTD IBM DB2 DAD
53. ab select a radio button to generate a new or update an existing model and complete the appropriate options optional Click the Detail tab and set any appropriate options We recommend that you select the Check model checkbox to check the model for errors and warnings before generation optional Click the Target Models tab and specify the target models for any generated shortcuts optional Click the Selection tab and select or deselect objects to generate Click OK to begin generation Generation options For detailed information about the options available on the various tabs of the Generation window see the Linking and Synchronizing Models chapter of the Core Features Guide Chapter 3 Working with an XML model Checking an XML Model The XML Model is a very flexible tool which allows you quickly to develop your model without constraints You can however check the validity of your XSM at any time Check your XSM before generating an XML document We recommend that you check your XSM before generating an XML document or other model from it If the check encounters errors generation will be stopped The Check model option is enabled by default in the Generation dialog box You can check an XSM in any of the following ways Press F4 or Select Tools Check Model or Right click the diagram background and select Check Model from the contextual menu The Check Mod
54. acker Certified PowerBuilder Developer Certified SYBASE Professional Certified SYBASE Professional Logo CodeBank Column Design ComponentPack Convoy DM Copernicus CSP Data Pipeline DataArchitect Database Analyzer DataExpress DataServer DataWindow DataWindow NET DB Library dbQueue Dejima Dejima Direct Developers Workbench DirectConnect Anywhere DirectConnect Distribution Director Dynamic Mobility Model e ADK e Biz Integrator EC Gateway ECMAP ECRTP eFulfillment Accelerator EII Plus Embedded SQL EMS Enterprise Client Server Enterprise Connect Enterprise Data Studio Enterprise Manager Enterprise Work Architecture Enterprise Work Designer Enterprise Work Modeler eProcurement Accelerator eremote Everything Works Better When Everything Works Together EWA Extended Systems Extended View Financial Fusion Financial Fusion and design Financial Fusion Server Formula One Fusion Powered e Finance Fusion Powered Financial Destinations Fusion Powered STP GeoPoint GlobalFIX iAnywhere iAnywhere Solutions ImpactNow Industry Warehouse Studio InfoMaker Information Anywhere InformationConnect InphoMatch InstaHelp Intelligent Self Care InternetBuilder iremote iScript Jaguar CTS jConnect for JDBC KnowledgeBase Logical Memory Manager M2M Anywhere Mach Desktop Mail Anywhere Studio Mainframe Connect Maintenance Express Manage Anywhere Studio MAP M Business Anywhere MDI Access Server MDI Database Gateway med
55. and application information property sheet Content tab The Content tab allows you to write or paste any well formed XML content 91 Notations XSM Notations XSM Notations allow you to define and process non XML objects within an XML model For example picture files with a GIF extension Generated schema lt xml version 1 0 encoding UTF 8 gt xs schema xmlns xsz http wwWw w3 org 2001 XMLSchema lt Integrating GIF files in your XML model gt xs notation name PICTURES public pictures gif system user local pictureVi ewer gt xs schema Notations are not available on models targeted with XDR Creating a notation You can create a notation in any of the following ways Select Model Notations to access the List of Notations and click the Add a Row tool Right click the model or package in the Browser and select New gt Notation t For general information about creating objects see the Objects chapter in the Core Features Guide Notation properties 92 You can modify an object s properties from its property sheet To open a notation property sheet double click its diagram symbol or its Browser entry in the Notations folder The General tab contains the following properties Chapter 2 Building XML Models Property Description Name Name of the notation It must be a no colon name See Glossary Code Code of the notation It must be a no colon nam
56. and or columns from the left pane to the right pane or by using the tools above the panes XML Builder Wizard XML Hierarchy Design You can now build your own XML hierarchy from tables and views Select the columns option then drag and drop tables and views to the Root element or a parent element corresponding to the parent table Use the elements contextual menu to modify elements Create column as C Element Attribute 51 8 Tables t 7 Department S sequence FT Employee E E Department E Views H E Attributes 5 5 sequence 5 Employee tributes B TE a Name lt Back Next Finish Cancel Help t For detailed information about using the wizard see Generating an XSM from a PDM via the XML Builder Wizard in the Working with Data Models chapter of the Data Modeling guide Click Finish to generate the XML model In the case of an existing XML model the generated elements appear alongside the existing elements 147 Generating a DAD File for IBM DB2 Extended model definitions The SQL XML extended model definition is automatically attached to the generated XML model You can attach the XML Document extended model definition to generate a simplified XML file that will help you understand the annotated schema Reinforcing DB2 mappings with extended attributes The IBM DB2 DAD extended model definition allows you to modify or reinforce the
57. ant to keep the global scope of some objects You can subsequently perform this conversion by selecting Tools gt Convert Unique References in the XML model Reverse engineering to an existing XML model You can reverse engineer XML schema files to add objects to an existing XSM e Ww To reverse engineer an XSD a DTD or an XDR file to an existing XSM 1 Open the XML model you want to reverse into and then select Language Reverse Engineer schema File to open the Reverse Engineering dialog box 2 Select the file to reverse and specify any appropriate options see Reverse engineering options on page 127 3 optional Click the Target Models tab and specify any existing PowerDesigner models which are referenced in the file being reverse engineered These references will become shortcuts in the reversed model 4 Click OK to begin reverse engineering A message in the Output window confirms that the file has been reversed and the Merge Models window opens 128 Chapter 4 Generating and Reverse Engineering XML Schemas Merge Models ol x BB r APM n From XMLM DEL 5 To XMLModel 3d XMLMODEL_5 Ej Items HIGHDEFINITION B sequence DOLBYSTEREO E FLATSCREEN B E DELUXETV 5 9 all E INTERNET E DVD m Embedded Type ES E gj webCam E gj wiFi Popty 1 LER Code XMLMODEL 5 XMLMODEL 6 E Schema Language XML Schem
58. ar at least once and may have any value matching its data type Form Form of the attribute If you select Qualified Form must be qualified by combining the target namespace of the schema with the no colon name See Glossary of the attribute If you select Unqualified Form is not required to be qualified with the namespace prefix and is matched against the no colon name of the attribute ID ID of the attribute Its value must be of type ID and unique within the model containing the attribute Attribute property sheet Values tab Any Attributes The Values tab of an attribute property sheet is only available in a model targeted with DTD or XDR You can set a list of predefined values for an attribute Element values with XDR In a model targeted with the XML Data Reduced language there is also a Values tab in the element property sheet The Any attribute feature allows you to insert any attribute of specified namespaces into an element a complex type or an attribute group declaration It is only available in a model targeted with XSD In a schema Any Attribute is declared with the lt anyAttribute gt tag For example 51 Attributes XSM lt xml 1 0 encoding UTF 8 xs schema xmins xs http Jf w3 org 2001 xMLschema gt lt xs element name PRODUCT gt xs 1 gt xs attribute name EXPIRYDATE type xs date gt lt xstattribute gt xs
59. ared separately like global attributes with the AttributeType tag and a name attribute then within their parent element with the attribute tag and a type attribute Extract of an XDR file AttributeType name globalAttribute ElementType names parentElement cont CA 12 EN AttributeType name localattribute default 0 attribute default 0 type Tocalattribute gt lt ElementType gt You can derive an attribute data type to extend or restrict its values Only with a model targeted with XSD For example Employees number xs positivelnteger Company Products references xs string foundation xs date A quantities xs unsignedLong status xs token fidelity xs boolean solvency xs boolean Generated schema Chapter 2 Building XML Models xml version 1 0 encoding UTF 8 xs schema xmins xs http www w3 0rg 2001 xMLschema xs element _name COMPANY gt xs complexType xs seguence xs element names EMPLOYEES xs attribute ref NUMBER gt xs attribute xs complexType xs element xs element name PRODUCTS xs complexType xs attribute name REFERENCES types xs string xs attribute xs attribute name QUANTITIES types xs unsignedLong xs attribute xs complexType xs ielement xs element names CLIENTS xs complexType xs attribute name
60. ayed Select Always if you want all the elements to have their XPath expression displayed Select Root symbol if you only want the root symbols global elements in the main diagram or parent elements in partial diagrams to have their XPath expression displayed Select Type if you want the attributes data types to be displayed To set display preferences for complex types select Tools Display Preferences and select the Complex Type sub category in the left hand Category pane Preference Description Attributes Display limit Stereotype Type Comment Complex Type Attributes Displays attributes and attribute values of the complex type Maximum number of attributes displayed Displays the stereotype of the complex type Displays the data type of the complex type Displays the comment of the complex type Select Type if you want the complex type attributes data types to be displayed Group simple type and any display preferences To set display preferences for groups simple types and anys select Tools Display Preferences and select the appropriate sub category in the left hand Category pane 18 Chapter 1 Getting Started with XML Modeling Preference Description Stereotype Displays the stereotype of the group Comment groups only Displays the comment of the group Working with XSM extended model definitions An extended model definition allows you to expand object definitions and complement
61. between the Browser tree view and the diagram window Move Select Tools General Options to make sure that Move is the Default action of the Drag amp Drop option Within Browser You can move a local object within the Browser to convert it into a global object If the new global object does not appear in the diagram select Symbol Show Symbols and click the corresponding tab to select the new global object Within diagram You can move a local object within the diagram to another group particle It remains a local object but with a new parent object You cannot move a local object within the diagram to convert it into a global object It remains attached to its group particle From Browser to diagram When you move a local object from the Browser to the diagram a synonym is created attached to the same group particle as the original symbol From diagram to Browser You can move a local object from the diagram to the Browser and convert it into a global object If the new global object does not appear in the diagram select Symbol Show Symbols and click the corresponding tab to select the new global object Global objects You can move global objects within or between the Browser tree view and the diagram window 118 Chapter 3 Working with an XML model Within Browser Within diagram From Browser to diagram From diagram to Browser Move Select Tools General Options to make sure that Move is th
62. box 2 Specify the directory in which to generate the file and select the XML in Database target on the Targets tab Directory ol Check model Targets XML in Database Microsoft SQL Server annotated 50 Cancel Apply Help 3 Click OK to begin the generation The Result dialog box is displayed with the path of the annotated schema file selected 4 Click Edit to open the generated annotated schema in your associated editor 139 Generating an Annotated Schema for Microsoft SQL Server 2000 lt xml version 1 0 encoding UTF 8 7 lt xs schema xm ns xse http www w3 org 2001 xMLSchema xmns sqle urn schemas microsoft com mapping schema lt xs element name Root sql is constant 1 xs complexType lt xs Sequence gt lt xs element name DEPARTMENT sq relation DEPARTMENT gt lt xs complexType gt lt xs Sequence gt lt xs element name EMPLOYEE 591 relation EMPLOYEE gt lt xs annotation gt lt xs appinfo gt sql relationship parent DEPARTMENT parent key DEPNUM child key DEPNUM child EMPLOYEE gt lt xs appinfo xs annotation xs complexType gt ixs attribute name DEPNUM type xs int sgl fiel attribute tribute name EMPID type x attribute gt tribute name FIRSTNAME typi attribute nt sql fielde EMPID xs string sql field FIRSTNAME lt xstattribute name LASTNAME typee xs string sql field LASTNAME
63. by list 71 derived by restriction 71 derived by union 71 list check 116 properties 72 union check 116 SQL XML query in XML model 132 133 stereotype 31 48 54 57 58 62 68 substitution group 34 T target namespace total digits 81 typographic conventions U union member types 87 properties 87 unique 36 54 check model 114 field 54 properties 54 selector 54 stereotype 54 URI 10 use 50 V value attribute DTD XDR 51 element XDR 51 W whitespace X XDR any AttributeType ElementType XML diagram model objects XML diagram attribute constraint create element entity import include notation redefine XML language XPath abbreviated syntax expressions XSD XSM check model create validation 81 44 48 31 22 23 46 54 27 29 94 96 96 92 96 13 58 57 57 103 103 157
64. chema xmlns xse http www w3 0rg 2001 xMLschema xs annotation id ANNOTL gt xs documentation source attributes dtd xml lang en us lt xml version 1 0 encoding UTF 8 7 lt ELEMENT COMPANY CEMPLOYEES PRODUCTS CLIENTS gt lt gt lt ATTLIST COMPANY FOUNDATION STATUS lt ELEMENT EMPLOYEES EMPTY gt lt l lt ATTLIST EMPLOYEES NUMBER lt ELEMENT PRODUCTS EMPTY gt lt gt lt ATTLIST PRODUCTS REFERENCES QUANTITIES lt ELEMENT CLIENTS EMPTY gt lt gt lt ATTLIST CLIENTS FIDELITY SOLVENCY xs documentation CDATA CDATA gt CDATA gt CDATA CDATA gt CDATA CDATA gt xs appinfo source http www parsersandco com gt lt xs appinfo gt xs annotation xs schema This global annotation is composed of a documentation with a well formed XML content extract of a DTD file and an application information Creating an annotation You can create a annotation at the global level in any of the following ways 89 Annotations XSM Open the Items or External Schemas tab in the property sheet of the model and click the Add Annotation tool Right click the model or package in the Browser and select New gt Annotation t For general information about creating objects see the Objects chapter in the Core Features Guide Creating a documentation or application information You can create a documentation or application i
65. cut code unique ness 104 Two or more objects cannot have the same identi fier ID Manual correction Give a unique identifier to each object Automatic correction None You must define an identifier ID for each object in the model Manual correction Define an identifier for each object Automatic correction None Two shortcuts with the same code cannot be in the same namespace Manual correction Change the code of one of the shortcuts Automatic correction None Chapter 3 Working with an XML model Check Description and Correction Undefined target namespace Missing namespaces Data source checks You should define a target namespace to your model Manual correction Type a URI for the Target Namespace property in the Detail tab of the model property sheet Automatic correction None There should be at least one namespace defined for the model Manual correction Type a URI and a prefix in the Namespaces tab of the model property sheet Automatic correction Adds the target namespace URI and a prefix ns followed by a number e g ns1 The following XML model checks are made on data sources Check Description and Correction Data source name and code uniqueness Existence of model Data sources names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name co
66. d on page 132 2 if you do not use the wizard Attach the SOL XML extended model definition see Attaching the SQL XML extended model definition on page 134 3 optional Reinforce the mappings with extended attributes see Reinforcing SQL Server mappings with extended attributes on page 136 4 Generate the annotated schema see Generating the SOL Server annotated schema file on page 139 Reinforcing SQL Server mappings with extended attributes 136 The Microsoft SQL Server extended model definition allows you to modify or reinforce the mapping resulting from the XML Builder Wizard via extended attributes If element and attribute names match table and column names If the element and attribute names match the table and column names you do not need to define extended attributes for XML objects Chapter 5 Working with XML and Databases To attach the XEM 1 Select Model Extended Model Definitions to open the List of Extended Model Definitions 2 Click the Import an Extended Model Definition tool to open the Extended Model Definition Selection dialog box click the XML in Database tab select Microsoft SQL Server and click OK in order to attach it to the model Annotated schema preview By clicking the Preview tab of the model property sheet you can have a preview of the annotated schema SQL Server extended attributes for elements and attributes You can set extended attr
67. de A data source must have at least one model in its definition Manual correction Add a model from the Models tab of the data source property sheet Automatic correction Deletes data source without a model 105 Checking an XML Model Check Description and Correction Data source containing The models in a data source represent a single models with different Ob set of information This is why the models in ject Language or DBMS the data source should share the same DBMS or types Entity checks object language Manual correction Delete models with different DBMS or object language or modify the DBMS or object language of models in the data source Automatic correction None The following XML model checks are made on entities Check Description and Correction Entity name and code uniqueness Undefined entity Include checks Entity names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code You must define an entity In the entity property sheet you must either type a value string of characters or URI in the Value box or a URI in the Public or System boxes Manual correction Type a value in the Value box or a URI in the Public or System boxes Automatic correction None The following XML model checks are made on includes Check Description and Correction
68. de an element with its ramifications in the hierarchical tree structure of an XML document The XPath expressions permitted to define constraint selectors and fields are limited to a subset of the full XPath language defined in the W3C Recommendation XML Path Language 1 0 Syntax Description Root node of the XML document It is the root element with its ramifications Selects the context node It is the current element on which an identity constraint is defined with its ramifications Selects the context node parent Selects all the child elements of the context node employee Selects all the employee child elements of the context node 59 Constraints Keys Uniques and KeyRefs XSM 60 Syntax Description s employee Selects all the employee child elements of the context node defined in the namespace with the s prefix numEmployee Selects the numEmployee attribute of the con text node Selects all the attributes of the context node 9 numEmployee Selects the numEmployee attribute of the con text node parent employee 1 Selects the first employee child element of the context node employee last Selects the last employee child element of the context node employee Selects all the employee grandchildren of the context node employee Selects all the employee descendants of the root node J employee Selects the employee descendants of the context node company employee Selects the emp
69. de on simple type unions 116 Chapter 3 Working with an XML model Check Description and Correction Undefined base type Annotation checks You must define at least two data types when you derive a simple type by union Manual correction In the simple type property sheet click the Properties tool beside the Derivation box to display the simple type union property sheet and type a white space separated list of at least two data types qualified names in the Member types box Automatic correction None The following XML model checks are made on annotations Check Description and Correction Existence of items An annotation must contain at least one URI for a Documentation or an Application Information Manual correction Define a URI for a Documentation or an Application Information Automatic correction None 117 Manipulating XML Objects Graphically Manipulating XML Objects Graphically The graphical interface of PowerDesigner allows you to manipulate XML objects within or between the Browser tree view and the diagram window A global object is right under the model item in the Browser tree view It has no parent symbol in the diagram A local object is under a group particle item in the Browser tree view It has a parent symbol in the diagram The following sections explain all the graphical operations allowed in PowerDesigner Local objects You can move local objects within or
70. e Comment Descriptive label of the notation Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined ID ID of the notation Its value must be of type ID and unique within the model containing the notation Public URI reference identifying the non XML object For example pictures gif System URI reference identifying the application that will process the non XML object For example user local pictureViewer 93 Entities XSM Entities XSM Creating an entity Entity properties 94 Entities enable you to include predefined values external XML or non XML files in an XML model targeted with a DTD When an XML processor reads an entity reference in an XML document it will replace this entity reference by its value defined in the DTD file of the XML document An entity reference is the entity name preceded by an ampersand and followed by a semicolon For example amp glossary will be replaced by See Glossary The W3C has predefined five entities for XML tags Entity name Reference Value Less than amp lt Greater than amp gt gt Ampersand amp amp amp Apostrophe amp apos Quotation amp quot D In an XML model you just need to type the name and the value of an entity You can create an entity in any of the following ways Select Model Entities to access the List of Entities and click the Add a
71. e Default action of the Drag amp Drop option You can move a global object within the Browser to convert it into a local object under a group particle item but you cannot move a global object within its own structure as a child of itself You can move a global object within the diagram to convert it into a local object Just move the global object symbol to a group particle symbol When you move a global object from the Browser to the diagram a synonym symbol is created in the diagram You can move a global object from the diagram to the Browser and convert it into a local object under a group particle item If the new local object does not appear in the diagram double click the Collapse node of the group particle symbol under which the former global object has been attached Example converting a local object into a global object The following procedure explains how to convert a local object into a global object To convert a local object into a global object 1 Click a local object child element or attribute in the Browser or the diagram 2 Drag and drop the local object in the space just beneath the Diagram item or the model item A thick horizontal line indicates that you can drop the object Drag and drop Select Tools gt General Options to make sure that Move is the Default action of the Drag amp Drop option The new global object is displayed in a global objects category one level
72. e and complex types Simple types and complex types are only supported by XSDs schemas When changing an XSD into a DTD or an XDR simple types and global complex types directly linked to the lt schema gt tag disappear from the diagram and the Browser tree view Local complex types within an element are expanded in the diagram beneath their containing element Example of a complex type with XSD 14 Chapter 1 Getting Started with XML Modeling dolbyStereo flatScreen highDefinition z deluxe TY highDefinition deluxeTV HighDefinition is a global complex type reused as data type for the deluxeTV element The same example with DTD or XDR dolbyStereo ts For more information on simple and complex types see sections Defining simple types and Defining complex types in chapter Building an XML model Setting XSM model options This section explains how to set global options for the objects in your XSM These options apply only to the current XSM For information about controlling the naming conventions of your models see Naming Conventions section in the Models chapter of the Core Features Guide Setting Model Settings To set Model Settings select Tools Model Options or right click the diagram background and select Model Options from the contextual menu 15 Customizing the XSM Environment 16 Model Options H The options on this tab affect a
73. e created You can modify the group particle via its property sheet oe el If you click the lower part of a child element symbol with the Element tool a brother ele ment symbol is displayed below the child element UIZIID symbol n If you click an element symbol with the Any tool a sequence group particle and an any symbol are cre ated You can modify the group particle via its property sheet B s If you click an element symbol with the Group tool a refer encing group is created You must now select a group for the reference B g 37 Elements XSM Tool Action If you click an element symbol with the Complex Type tool a complex type symbol is displayed superposed but not linked to the element symbol A global complex type cannot be the child of an element If you click an element symbol with the Sequence tool a sequence group particle is displayed linked to the element symbol BH If you click an element symbol with the Choice tool a choice group particle is displayed linked to the element symbol BC If you click an element symbol with the All tool an all group particle is displayed linked to the element symbol b 1 Pointer indications When you cannot click a symbol or an empty space in a diagram the Pointer displays a forbidden sign See complex type in Tool column When there is a possibility to create a symbol above below or next to another one the Pointer displays
74. e generation of the following types of files for the XML schemas supported by the XSM Target Schema Generated file XML Schema Definition 1 0 XSD Document Type Definition 1 0 DTD XML Data Reduced 1 0 XDR You can preview the file to be generated by selecting the Preview tab of your XML model property sheet Parameter entities and DTD generation Parameter entities are references to predefined values within a DTD file See Parameter property in entity property sheet During DTD generation some object properties containing inadvertently parameter values will be generated with parameter references If you are not satisfied with this default use of parameter entities you should clear the Parameter property before generation Generating XML schema files PowerDesigner provides a standard interface for generating all the supported XML schemas To generate an XSD DTD or XDR schema file 1 Select Language gt Generate schema File to open the Generation dialog Directory C ATEMPSXSD files Check model Cancel Apply Help 2 Enter a directory in which to generate the files and specify whether you want to perform a model check For more information about checking your model see Checking an XSM in the Working with XSMs chapter 124 Chapter 4 Generating and Reverse Engineering XML Schemas XDR generation options When generating an XDR file the Generation dialog contains an Options
75. e group particle S with the palette Group tool The Reference property of the referencing group property sheet is then set to descriptionLines Inthe generated XSD file the group is first declared with the group tag and then reused through a reference ref set to descriptionLines Chapter 2 Building XML Models Creating a group lt xml version 1 0 encoding UTF 8 xs schema xmlns xs http www w3 org 2001 MLSchema lt 5 group name descriptionLines gt xs all gt xs element name Tinel gt lt xs element name line2 lt xs element names lines3 xs all xs group xS e ement name product gt xs complexType xs sequence lt xs element name name gt xs group ref descriptionLines gt xst group lt sequence xs 1 gt xs element xs schema Inthe generated DTD file the group is expanded directly within its parent element xml version 1 0 encoding UTF 8 gt lt ELEMENT linel EMPTY lt ELEMENT line2 EMPTY gt lt ELEMENT line3 EMPTY gt lt ELEMENT product Cname 1inel 11 2 1ine3 gt lt ELEMENT name EMPTY gt Inthe generated XDR file the group is declared through a group tag within an lt ElementType gt tag with its order attribute set to seq lt xml versions 1 0 encoding UTF 8 schema name xDbR group xmlns urn schemas microsoft com
76. e gt lt xs element ref ML_DECLARATION gt lt xs element name DOCTYPE_TAG gt xs complexType lt xsiall gt lt xs element name ELEMENT TAG lt xs element name ATTLIST_TAG gt lt xs element name ENTITY_TAG gt xs all xs complexType xs element xs sequence xs complexType xs element xs choice xs complexType xs element lt xs element name ML_DECLARATION gt xs complexType lt 5 5 gt lt xs element name VERSION_ATTRIBUTE gt xs element name ENCODING ATTRIBUTE lt xs element names STANDALONE ATTRIBUTE gt lt xs sequence gt xs complexType xs element xs schema In a schema elements are declared with element tags There are two broad kinds of elements Global elements have no parent element in a diagram and are directly linked to the schema tag root element in a schema They can be reused in the model through referencing elements See XML declaration in the Elements XSM on page 29 example Local elements have a parent element in a diagram and are unique within their parent scope They can be defined by reference to a global element see the Reference property in Element properties on page 31 Chapter 2 Building XML Models Global and local elements in XDR files In a model targeted with the XML Data Reduced language local elements are first declared separately like g
77. e model to provide documentation or application information t For more information on these items see chapter Building an XML model XML model property sheet Namespaces tab A namespace is a URI indicating a location where objects are declared The prefix of a namespace followed by a colon and the name of an object indicates that this object is declared in that namespace Namespaces are not supported by DTDs The following tools are available on this tab Tool Description an Add Namespaces from XML Models Adds a namespace from another XSM as a source namespace for the current model Add Namespaces from XML schema files Adds a namespace from an external schema file as a source namespace for the current model In the case of a model targeted with XSD the namespace of W3C XML Schema Recommendation is predefined in the list of namespaces 10 Chapter 1 Getting Started with XML Modeling amp Model Properties First XML model FIRST XML MO E3 Rules Dependencies Extended Dependencies l Version Info l Preview General Detail Items External Schemas Namespaces Notes TOSS e http www w3 org 2001 MLS c lt lt Less i Cancel Apply Help Inthe case of a model targeted with XDR two namespaces are predefined in the list of namespaces E Model Properties Test Model Test Model Dependencies Ext
78. ear in the model as objects with their corre sponding symbol in the diagram Local complex types only appear in the schema see Preview tab of an element property sheet Creating a complex type You can create a complex type in any of the following ways 73 Complex Types XSM Usethe Complex Type tool in the diagram Palette Select Model Complex Types to access the List of Complex Types and click the Add a Row tool Right click the model or package in the Browser and select New Complex Type t For general information about creating objects see the Objects chapter in the Core Features Guide Complex type properties You can modify an object s properties from its property sheet To open a complex type property sheet double click its diagram symbol or its Browser entry in the Complex Types folder The following sections detail the property sheet tabs that contain the properties most commonly entered for complex types The General tab contains the following properties Property Description Name Code Comment Stereotype Group type 74 Name of the complex type It must be a no colon name See Glossary and unique among all simple types and complex types Code of the complex type It must be a no colon name and unique among all simple types and complex types Descriptive label of the complex type Sub classification used to extend the semantics of an object without cha
79. ed from this name according to the model naming conventions 5 Select an XML language from the list XML languages are defined in dedicated XML files with a xsl extension which are provided as part of your PowerDesigner installation Creating an XSM XML model properties in the Resource Files XML languages directory and contain all the syntax and specifications for each target XML language Select one of the following radio buttons Share the XML language definition use the original XSM file in the Resource Files XML languages directory Any changes made to the XML language are shared by all linked XSMs Copy the XML language definition in model make a copy of the original XML language file in the Resource Files XML languages directory The current XML language is independent of the original XML language so modifications made to the file in the XML languages directory are not available to the XSM The copied object language is saved with the XSM and cannot be used without it t For more information on XML language properties and customizing an XML language see Resource File Reference and Working with the Resource Editor in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual optional If you want to attach one or more extended model definitions to complement the selected XML language click the Extended Model Definitions tab and
80. el Parameters window opens which allows you to specify the kinds of checks to perform and the objects to apply them to For detailed information about this window and correcting problems reported see Checking a Model section in the Models chapter of the Core Features Guide The following sections document the XSM specific checks available by default For information about other checks available by default for all model types see Checking a Model in the Models chapter of the Core Features Guide Group particle checks The following XML model checks are made on group articles 103 Checking an XML Model Check Description and Correction Existence of particle Invalid cardinality Model checks A group particle must contain elements groups group particles and or Any Manual correction Add items to the group particle or delete it Automatic correction None You should define a minimum 0 or 1 and a max imum cardinality 1 or unbounded for a group particle occurrence This check is only available in a model targeted with XDR Manual correction Double click the group particle symbol and type a value for Minimum 0 or 1 and Maximum 1 or unbounded properties Automatic correction None This check only applies to models built on a schema The following XML model checks are made on models Check Description and Correction Identifier uniqueness Undefined identifier Short
81. elow a symbol is fully expanded all levels Collapse the hierarchy below a symbol is hidden Arrange Symbols the hierarchy below a symbol is properly displayed External Shortcuts through references and data types External shortcuts allow you to share objects between different models You can define external shortcuts in an XML model but you cannot use them directly in the model except as substitution groups for elements see Detail tab in element property sheet You can define external shortcuts for any global object with no parent object in the diagram except for imports includes redefines and annotations 27 XML Diagram Basics References Data types 28 Internal shortcuts allow you to share objects between packages of a same model You cannot define internal shortcuts since an XML model does not support packages External shortcuts are automatically generated in the following situations When you use the Reference property to define an element an attribute a group or an attribute group by reference to a similar object in another model opened in the workspace a shortcut is created between the referencing object and the target object The shortcut is displayed in the current model with a specific item in the Browser tree view and the Shortcut expression in the reference symbol and item The target object keeps track of the referencing object in the Reference tab of the Dependencies tab of its
82. ence of fields 114 Unique constraint names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code A unique constraint must contain at least one field Manual correction Add at least one field to the unique constraint or delete the unique constraint For example numEmployee Automatic correction Deletes unassigned unique constraint For more information on fields see section Defining an identity constraint field in chapter Building an XML model Chapter 3 Working with an XML model Check Description and Correction Undefined Selector Extension checks You must define an XPath expression for a unique constraint selector attribute Manual correction In the unique constraint prop erty sheet define an XPath expression for the unique constraint selector attribute For example s company s employee Automatic correction None For more information on XPath expressions see section Defining an identity constraint selector in chapter Building an XML model The following XML model checks are made on extensions Check Description and Correction Undefined base type Restriction checks You must define a base type when you derive a complex type by extension Manual correction In the complex type property sheet click the Properties tool beside the Derivation box to display the Extension
83. ended Dependencies Version Info General Items External Schemas Namespaces Notes Rules CEA SO 48 8x um schemas microsoft com xml data urn schemas microsoft com datatypes dt 11 Creating an XSM XML model property sheet Preview tab The Preview tab of the model property sheet displays a preview of the XSD DTD or XDR file generated from the XML model For example amp Model Properties First XML model FIRST XML MODEL Dl x General Detail Items External Schemas Namespaces Notes Rules Dependencies Extended Dependencies Version Info Preview E E amp X Ba Blo utc xml version 1 0 encoding UTF 8 gt schema x http www wuw3 org 2z001 XMLSchema xs group name DESCRIPTIONLINES gt xs all element namesz LINEl element name LINE2 gt lement name LINE3 gt all qroup sr element names PRODUCT x omplexType equence element name NAME gt group ref DESCRIPTIONLINES gt qroup quence xs conplexType lement A j l lt lt Less amp Cancel Apply Help The schema file starts with the XML declaration followed by the schema root element declaration All objects created in the model will appear in the schema file between the schema start and end tags 12 Chapter 1 Getting Started with XML Modeling Custo
84. equence gt lt xs element name STATE type xs token gt xs sequence xs extension xs complexcontent lt xs i complexType gt lt xs schema To define a derivation by extension 1 Open the property sheet of an element or complex type and select Extension in the Derivation list The Content field and in the case of an element the Embedded type field is set to Complex 2 Click the Properties tool to the right of the Derivation box to open the property sheet of the extension Extension Properties Gl XI General Annotation Dependencies Version Info ID Exil Base type xs integer lt lt Less E Cancel Apply Help 3 Specify an ID select a base type and then click OK to return to the 80 Chapter 2 Building XML Models element or complex type Extension property sheet The General tab contains the following properties General tab Property Description ID ID of the extension Its value must be of type ID and unique within the model containing the extension Base Type Data type on which the extension is based Deriving by restriction You can derive an element simple type or complex type by restriction to restrict the values of their base type To create a restriction on an element simple type or complex type 1 Open the property sheet of an element simple type or complex type and select Restriction in the Derivation list Q Simple Type P
85. etermined unchangeable value of the element if its content is a simple type or text only Enter a fixed value only if there is no default value Block Property to prevent another element with the same type of derivation from being used in place of the current element Final Property to prevent derivation of the current element Prohib ited if the element is not a global element Form Form of the element Used to specify the target namespace of the element If you select Qualified a namespace prefix is required to qualify the element If you select Unqualified a namespace prefix is not required to qualify the element ID ID of the element Its value must be of type ID and unique within the model containing the element Abstract Property defining if the element can appear in the instance document or not If selected the element cannot appear in the instance document Nillable Property defining if the element is null or not In the case of a model targeted with XDR the Detail tab is only available for local elements Element property sheet Attributes tab Attributes see Attributes XSM on page 46 give additional information about an element The Attributes tab lists the attributes and attribute groups associated with the element For information about the tools available on this tab for adding attributes see 35 Elements XSM Creating an attribute on page 47 Element property sheet Constraints tab Constraint
86. excluded from the result Available for Element Attribute Allows you to specify depth in recursive relationships that are specified in the schema Available for Element Identifies the database column that contains the overflow data Available for Element Maps an XML item to a database table Available for Element Specifies an element as the child table in a reference To define only in the child element property sheet Available for Element Specifies an attribute as the foreign key of a child table in a reference To define only in the child element property sheet Available for Element Specifies an element as the parent table in a reference To define only in the child element property sheet Available for Element Specifies an attribute as the primary key of a parent table in a reference To define only in the child element property sheet Available for Element Allows specifying CDATA sections to be used for certain elements in the XML document Available for Element Creates valid XML ID IDREF and IDREFS Prepends the values of ID IDREF and IDREFS with a string Available for Attribute Chapter 5 Working with XML and Databases Generating the SQL Server annotated schema file You generate the annotated schema file by selecting it as an additional target for standard schema generation To generate an annotated schema file 1 Select Language gt schema File to open the Generation dialog
87. ge 47 70 Chapter 2 Building XML Models Simple Types XSM You can only create simple types in a model targeted with XSD A simple type is a data type definition for elements or attributes with text only content It 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 contains a white space separated list of values of an inherited simple type Restriction has a range of values restricted to a subset of those of an inherited simple type Union contains a union of values of two or more inherited simple types t For more information on simple type derivations see section Derivations Extensions Restrictions Lists and Unions XSM on page 79 Once defined in a model a simple type can be reused in the definition of an attribute an element or a complex type Example of a simple type in a schema k xml version 1 0 encoding UTF 8 lt xsischema xmlns xse http www w3 0rg 2001 xMLschema xs simpleType name BARCODE gt xs restriction base z xs nonNegativeInteger id STRL gt xs length values 13 xs restriction xs simpleTrype lt xs element name PRODUCTA type BARCODE gt lt xs element name PRODUCTB type BARCODE gt lt xs ischema gt Creating a simple type You can create a simple type in any of the fol
88. h the user friendly graphical interface of PowerDesigner XML Model you can build an XML diagram and then generate automatically an XSD a DTD or an XDR file The following example shows the diagram of an XSM which models an XML schema for Resume documents lobRE tester iss nra isna Te Wame desir wsie amp TADDRESSTYPE EINST Resume BA meune P EH HPEH ei snra va Perg gt ea Home Prone Prove desir FP hore Gell Phone isni EE hese nra Tie poe LIU Shee giess destra oe SBE Apode 470006 County fes SiriDSE m osgYemWenh tira meo Function Diploma des Address 4TADDRESSTYPE If an XML model is too large or too complex you can create several diagrams to have partial views of the model and focus on certain objects For example the original Resume diagram could be split into five diagrams corresponding to the five main objects of the model Main Contact Achievement Description and Address The Achievement sub diagram follows Chapter 2 Building XML Models Workspace e B
89. hey are used You can choose between all All children may be present See Group Particles XSM on page 39 choice Only one child must be present See Group Parti cles XSM on page 39 group Reference to a predefined group See Groups XSM on page 62 sequence All children must be present in order See Group Particles XSM on page 39 Element data type Use the list to select a built in data type Use the Browse tool to select a simple or a complex type from any model opened in the current workspace In the case of an XSD selecting a data type will delete any group particle and its child elements or attribute previously defined in the element property sheet Do not select a data type if you want to define attributes or child elements within the current element Chapter 2 Building XML Models Property Description Embedded XSD only Locally defined data type It applies to the current type element only Automatically set to Complex if you define a derivation for the element data type Content XSD only Content type of the element If you select Com plex the element can have child elements If you select Simple the element cannot have child elements Derivation XSD only Derivation method for the element data type Used to extend or restrict the values of the element data type When you define a derivation the data type disappears You must click Apply and then the Properties t
90. ia splash Message Anywhere Server MetaWorks MethodSet mFolio Mirror Activator ML Query MMS 365 Mobile 365 and design MobiLink MySupport New Era of Networks Next Generation Learning Next Generation Learning Studio DEVICE OASIS OASIS logo ObjectConnect ObjectCycle OmniConnect OmniQ OmniSQL Access Module OmniSQL Toolkit OneBridge Open Biz Open Business Interchange Open Client Open ClientConnect Open Client Server Open Client Server Interfaces Open Gateway Open Server Open ServerConnect Open Solutions OpenSwitch Partnerships that Work PB Gen PC APT Execute PC DB Net PC Net Library Pharma Anywhere PhysicalArchitect PocketBuilder Power Through Knowledge power stop PowerAMC PowerBuilder PowerBuilder Foundation Class Library PowerDesigner PowerDimensions Powering the New Economy PowerScript PowerSite PowerSocket Powersoft PowerStage PowerTips Powersoft Portfolio Powersoft Professional PowerWare Desktop PowerWare Enterprise ProcessAnalyst Pylon Pylon Anywhere Pylon Application Server Pylon Conduit Pylon Pro QAnywhere RAP The Trading Edition Rapport Relational Beans RepConnector Report Workbench Report Execute Replication Agent Replication Driver Replication Server Replication Server Manager Replication Toolkit Resource Manager RFID Anywhere RW DisplayLib RW Library SAFE SAFE PRO Sales Anywhere Search Anywhere SDF Search Anywhere Secure SQL Toolset Security Guardian ShareSpool
91. ibutes on elements and attributes to reinforce their mapping to tables and columns by opening their property sheets and clicking the Extended Attributes tab Annota tion Description encode field hide is constant key fields limit field When an XML element or attribute is mapped to a SQL Server BLOB column allows requesting a reference URI to be returned and used later to return BLOB data Available for Element Attribute Maps an XML item to a database column Available for Element Attribute Hides the element or attribute specified in the schema in the resulting XML document Available for Element Attribute Creates an XML element that does not map to any table The element is displayed in the query output Available for Element Allows specification of columns that uniquely identify the rows in a table Available for Element Allows limiting the values that are returned on the basis of a limiting value Available for Element Attribute 137 Generating an Annotated Schema for Microsoft SQL Server 2000 138 Annota tion Description limit value mapped max depth overflow field relation relationship child relationship child key relationship parent relationship parent key use cdata prefix Allows limiting the values that are returned on the basis of a limiting value Available for Element Attribute Allows schema items to be
92. in step 11 Generating SQL XML queries SQL XML is an XML extension of the Structured Query Language which allows you to retrieve relational data using extended SQL syntax and produce an XML result SOL XML has five main elements 133 Introducing XML in Databases XMLELEMENT to edit an element with a name a list of attributes optional and a list of values optional XMLATTRIBUTES to edit a list of attributes with names and values XMLAGG to edit in multiple rows a concatenation of elements from a single XML value corresponding to a single column XMLCONCAT to edit in the same row a concatenation of elements from several XML values corresponding to several columns XMLFOREST to edit in the same row a concatenation of elements from several SQL values corresponding to several columns The name and value of a column become the name and value of an element An XML model allows you to generate SOL XML queries for global elements whatever the targeted XML language XSD DTD or XDR You need first to map an XML model to a PDM then to attach the SOL XML extended model definition to the mapped XML model The best way to map an XML model to a PDM is to use the XML Builder Wizard from a PDM The generated XML model is automatically mapped to the PDM and linked with the SQL XML extended model definition If need be you can still modify the mapping through the Mapping tab of elements and complex ty
93. ing properties for XDR element properties see the subsequent table Property Description Name The name of the item which should be clear and meaningful and should convey the item s purpose to non technical users 31 Elements XSM Property Description Code Comment Stereotype Reference Group type Type 32 The technical name of the item used for generating code or scripts which may be abbreviated and should not generally include spaces Descriptive label of the element Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Name of a global element The current element will have the same properties as the global element The Reference property is only available for child elements Use the list to select a global element in the current model or the Browse tool to select a global element from any open model If you select a global element from another model a shortcut is created with the referencing element When you define a reference name and code properties are grayed Name and code are those of the global element Once you have referenced an element you can locate it in the diagram by right clicking the referencing element symbol and selecting Find Referenced Element in the contextual menu The referenced element is displayed with handles in the diagram Specifies that the element has child elements and how t
94. ion used to extend the semantics of an object without changing its structure It can be predefined or user defined for references to groups only Name of a group in the current model or another model opened in the workspace It must be a qualified name See Glossary A reference allows you to reuse a group with all its properties without having to define it again Use the list to select a group in the current model Use the Browse tool to select a group from any model opened in the workspace If you select a group from another model a shortcut is created with the referencing group When a reference is defined the name and code properties are grayed The name and code are those of the target group unavailable to references to groups Specifies how child ele ments are to be used within the group You can choose between all choice sequence For more information see Group Particles XSM on page 39 Minimum number of times the group can occur To specify that the group is optional set this attribute to zero Maximum number of times the group can occur For an unlim ited number of times select unbounded Once you have defined the reference of a referencing group you can locate the referenced group in the diagram by right clicking the referencing group symbol and selecting Find Referenced Group in the contextual menu The referenced group is displayed with handles in the diagram You can access directly to the Preview
95. ks Attribute group names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code An attribute group without a name or a code must have a reference Manual correction In the attribute group property sheet define a reference with the Reference list or the Browse tool Automatic correction None An attribute group must contain at least one attribute Manual correction Add attributes to attribute group or delete attribute group Automatic correction Deletes unassigned attribute group The following XML model checks are made on imports 111 Checking an XML Model Check Description and Correction Undefined schema lo cation and namespace Redefine checks An import must have at least a schema location or a namespace defined Manual correction In the import property sheet define a URI for the schema location and or the namespace Example for a schema location http www something org schemas order xsd Ex ample for a namespace http www something org xml ordering Automatic correction None The following XML model checks are made on redefines Check Description and Correction Undefined schema loca tion Existence of component Key checks You must define a schema location for a redefine Manual correction In the redefine property sheet define a URI or select a schema file fo
96. l information about an element or a complex type Defined by a built in data type or a simple data type See Attributes XSM on page 46 23 XML Diagram Basics Object Tool Symbol Description Group Attribute Group Simple Type Complex Type Sequence Choice All Instruction Derivation 24 N A N A e N A N A N A N A Complex N A N A A group of elements arranged by a group particle Defined once and reused through references See Groups XSM on page 62 A group of attributes defined once and reused in the model through refer ences See Attribute Groups XSM on page 68 XSD only Used in the case of elements or attributes with text only content See Simple Types XSM on page 71 XSD only Used to introduce elements or attributes within an element declaration See Complex Types XSM on page 73 This group particle arranges a set of elements where all the elements must appear at least once in the order of their declaration See Group Particles XSM on page 39 This group particle arranges a set of elements from which one element must be chosen See Group Particles XSM on page 39 This group particle arranges a set of elements where each element can appear or not in any order See Group Particles XSM on page 39 An import include or redefine instruc tion See Instructions Import Inc
97. l property sheet Version of the model You can use this box to display the repository version or a user defined version of the model This parameter is defined in the display preferences of the Title node Current XML language for the model Diagram displayed by default when opening the model XML model property sheet Detail tab The Detail tab is only available in a model of an XSD It contains the following properties Creating an XSM Property Description Target Namespace of all the model objects Its name is a URI which Names does not refer to any file but only to an assigned name A pace prefix can be assigned to the namespace All the schema elements with this prefix in their start tag will be associated with the namespace For example http www mycompany com myproduct XMLmodel Language Indicator of the language used in the model For example en en GB en US de fr ID ID of the model Its value must be of type ID and unique within the file containing the model For example XMODI Element Form of the elements declared in the target namespace If Form you select Qualified elements must be qualified with the namespace prefix If you select Unqualified elements are not required to be qualified with the namespace prefix The value of Element Form is the global default value for all the elements declared in the target namespace To override this setting individual elements can use the Form attribute Attribute Fo
98. lect an attribute in the current model Use the Browse tool to select an attribute from any model opened in the workspace If you select an attribute from another model a shortcut is created with the referencing attribute When you define a reference name and code properties are grayed The name and code are those of the target attribute Attribute data type It must be a qualified name See Glossary Use the list to select a built in data type Use the Browse tool to select a simple type defined in the current model or another model opened in the workspace If selected the attribute data type disappears and a simple type tag is created in the schema within the attribute tag Only available in a model targeted with XSD Derivation method for the attribute data type Used to extend or restrict the values of the attribute data type When you define a derivation the data type disappears You must click Apply and then the Properties tool to select a type a base type or member types for the corresponding derivation list restriction or union Only available in a model targeted with XSD Defining attributes in In a model targeted with the XML Data Reduced language attributes tags XDR files are defined by XDR attribute attribute different attributes Description name default Specifies the name of the attribute Tab General Field Name Specifies a default value for the attribute Tab Detail Field Default A
99. ll the objects in the model including those already created while changes to the object specific options on the sub category tabs only affect objects created subsequently You can set the following options on this tab Chapter 1 Getting Started with XML Modeling Option Description Name Code You can define the case sensitivity of names and codes for all case sensi objects in the current model When this check box is selected tive it implies that you can have two objects with identical name or code but different case in the same namespace Unlike other model options you can modify the name and code case sensitivity during the design process However if you do so make sure you run the check model feature to verify if the model does not contain any duplicate object Enablelinks Requirements are descriptions of customer needs that must to require be satisfied during development processes ments You can enable links to requirements for all objects in the current model When this check box is selected it implies that the Requirements tab is displayed in the objects property sheet The Requirements tab allows you to attach requirements to objects these requirements are defined in the Requirements models open in the workspace Attached requirements and Requirements models are synchronized For more information on requirements see the Requirements Modeling guide Setting XSM Display Preferences PowerDesigner display
100. lobal elements with the lt ElementType gt tag and a name attribute then within their parent element with the lt element gt tag and a type attribute Extract of an XDR file ElementType name localElement ElementType name globalElement element types localElement ElementType Parent elements are linked to their child elements through group particles sequence choice or all which contain a group of child elements see the Group type property in Element properties on page 31 You can derive an XSD element data type to extend or restrict its values see the Derivation property in Element properties on page 31 Creating an element You can create an element in any of the following ways Use the Element tool in the diagram Palette Select Model gt Elements to access the List of Elements and click the Add a Row tool Right click the model or package in the Browser and select New gt Element t For general information about creating objects see the Objects chapter in the Core Features Guide Element properties You can modify an object s properties from its property sheet To open an element property sheet double click its diagram symbol or its Browser entry in the Elements folder The following sections detail the property sheet tabs that contain the properties most commonly entered for elements The General tab of an XSD or DTD element property sheet displays the follow
101. low you to attach any type of object to a choice or a sequence group particle For example Resources Resources H E Inan XSD file Any is declared with the lt any gt tag lt xml version 1 0 encoding UTF 8 gt xs schema xmlns xse http www w3 0rg 2001 xMLschema lt xs element name RESOURCES gt xs complexType lt xsichoice gt lt xs element name INTERNAL gt xs any namespace local processContents lax gt xs choice xs complexType xs element xs schema InaDTD file Any is declared within an lt ELEMENT gt tag with the keyword ANY lt xml version 1 0 encoding UTF 8 lt ELEMENT Resources ANY gt lt ELEMENT Internal EMPTY gt Inan XDR file Any is declared through of an lt ElementType gt tag resources in the example with its model attribute set to open Although it is displayed in a diagram Any is not considered as an object in an XDR file lt xml version 1 0 encading UTF 8 schema name XDR_Any xmlns urn schemas microsoft com xm l data xmlns dtez urn schemas microsoft com datatypes ElementType namesz internal content empty gt ElementType name resources model open content eltonly order one gt element types internal ElementType lt schema gt Creating an any element You can create an any element in any of the following ways Use the Any tool in the diagram Palette Open the Ite
102. lowing ways Select Model Simple Types to access the List of Simple Types and click the Add a Row tool Right click the model or package in the Browser and select New gt Simple Type 71 Simple Types XSM Caution If the simple type symbol does not appear in the diagram select Show Symbols in the Symbol menu then click the Simple Type tab and select the simple type box to display its symbol in the diagram t For general information about creating objects see the Objects chapter in the Core Features Guide Simple type properties You can modify an object s properties from its property sheet To open a simple type property sheet double click its diagram symbol or its Browser entry in the Simple Types folder The General tab contains the following properties Property Description Name Code Comment Stereotype Derivation Final ID 72 Name of the simple type It must be a no colon name See Glossary If specified it must be unique among all simple types and complex types Code of the simple type It must be a no colon name If specified it must be unique among all simple types and complex types Descriptive label of the simple type Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Derivation method for the simple type Enabled and required when the simple type is defined Property t
103. loyee descendants of the com pany child elements of the context node company employee Selects all the employee elements with company book chapter 2 section 3 employee dept doc em ployee dept doc 3 em ployee 3 dept doc chapter title as parent element in the context node Selects the third section in the second chapter of the book Selects all the employee child elements of the context node with a dept attribute set to doc Selects the third employee child element of the context node with a dept attribute set to doc Selects the third employee child element of the context node only if it has a dept attribute set to doc Selects the chapter child elements of the context node with at least one title child element Chapter 2 Building XML Models Syntax Description chapter title About this Selects the chapter child elements of the context book em node with at least one title child element with a text content set to About this book Selects all the employee child elements of the ployee numEmployee context node with the numEmployee and dept and dept text attributes Selects all the child nodes of the text context node Selector and Field property sheet General tab The General tab of a selector or field property sheet contains the following properties Property Description XPath Stereo type ID For a selecto
104. lude and Redefine XSM on page 96 Extends or restricts the values of elements and simple and complex types See Derivations Extensions Restrictions Lists and Unions XSM on page 79 Chapter 2 Building XML Models Object Tool Symbol Description Constraint Annotation Entity Notation Linking objects in an XML model N A N A N A N A N A N A XSD only Specifies uniqueness of el ement values See Constraints Keys Uniques and KeyRefs XSM on page 54 Provides documentation or application information See Annotations XSM on page 89 DTD only Specifies a predefined value or external XML or non XML file See Entities XSM on page 94 Defines and processes non XML objects within an XML model See Notations XSM on page 92 XML objects do not support standard link objects To link a child object to a parent object you must click the child object tool in the palette and then click the symbol of the parent object in the diagram This will automatically create a link between both objects See the following table for allowed links 25 XML Diagram Basics 26 Tool Element symbol Group symbol Complex type sym bol e B B BG B pHa b B Any P a pCa No link No link No link B C h lt e All Tool Sequence symbol Choice symbol All symbol E B t5 b h G a BOS
105. ly create 76 Chapter 2 Building XML Models a link between both objects See the following table for allowed links Tool Action gt E A If you click a complex type symbol with the Element tool a sequence group particle and a child element symbol are created You can modify the group particle via its property sheet BGB If you click a complex type symbol with the Any tool a sequence group particle and an any symbol are cre ated You can modify the group particle via its property sheet b B If you click a complex type symbol with the Group tool a referencing group is created You can modify the group particle via its property sheet You must now select a group for the reference Ea If you click a complex type symbol with the Complex Type tool a second complex type symbol is displayed superposed but not linked to the first complex type symbol A complex type cannot be the child of another complex type If you click a complex type symbol with the Sequence tool a sequence group particle is displayed linked to the complex type symbol B If you click a complex type symbol with the Choice tool a choice group particle is displayed linked to the complex type symbol o If you click a complex type symbol with the All tool an all group particle is displayed linked to the complex type symbol pi 77 Complex Types XSM Pointer indications When you cannot click
106. mizing the XSM Environment The XML model environment includes a set of parameters and configuration options that define various aspects of the model content and behavior You can set these parameters At model creation After creating a model with default options and parameters When creating a model template Working with XML languages An XML language contains specifications for a particular language It provides PowerDesigner with the syntax and guidelines for implementing stereotypes data types scripts and constants for an XML language You manage an XML language from the Resource Editor The language displays a tree view with several categories that can be used to extend XML model objects Profile category or manage generation Generation category Each XML model is by default attached to an XML language When you create a new XML model you must choose an XML language You can create a new XML language or use the XML languages delivered with PowerDesigner The definition of an XML language is available from its property sheet You can select and configure parameters used when defining objects or generating from an XML model For more information on resource files Resource File Reference in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual Not certified resource file Some resource files are delivered with Not Certified in their names Sybase will
107. model Add Attribute Group Adds a group of attributes to the model Add Simple Type XSD only Adds a simple type to the model Add Complex XSD only Adds a complex type to the model Sa Add Notation Adds a notation to the model to describe the format of non XML data Re Add Annotation XSD only Adds an annotation to the model to provide documentation or application information E The list reflects the order in which global objects are declared in the schema You can change the order of declaration by selecting an item in the list and using the arrowed buttons at the bottom left corner of the tab to move it in the list ts For more information on these items see chapter Building an XML model XML model property sheet External Schemas tab The External Schemas tab is only available in a model of an XSD This tab allows you to link to and reuse in your model global objects from Creating an XSM other schemas The following tools are available on this tab Tool Description Add Include Adds a specified schema file to be included in the target namespace of the current schema Add Import Adds a specified namespace whose schema components are referenced by the current schema Add Redefine Adds a specified schema file whose simple and complex types groups and attribute groups can be redefined in the current schema Add Annotation Adds an annotation to th
108. mple Types gestr Code irc eme Complex Types ELI 1 AddressType _ 5 9 sequence isma erms E Ciy E Country ersobneserveg E State Wamwe E Street ddress M E O pem desire E ZipCode HEH 55 c fj Elements H seem B E Resume Fate BY HRE E sequence Hes UT H E Contact Stribs sea Yemen amp amp E Education eaten des amp amp E Experience amp amp E Interests ELTE e Hemos E iobReference reri Eg Groups B ae 19 00 Achievement tire 8 06 Description p 9 Wiese 21 8 sequence TE i Paragraph Tie ege Once you have created an XML diagram you can generate an XSD a DTD or an XDR file from it for use in your application A PowerDesigner XSM allows you to Build and check XML models Map objects in and create reports of XML models Generate and reverse engineer XSD DTD and XDR files Chapter 1 Getting Started with XML Modeling Generate an XML model f
109. mple type Union property sheet The General tab of a simple type union property sheet displays the following General tab properties Property Description ID ID of the simple type union Its value must be of type ID and unique within the model containing the simple type union Member Types White space separated list of built in data types Values must be qualified names See Glossary Union property sheet The Union Types tab of a simple type union property sheet displays a list Union Types tab where you can add simple types using the Add Simple Type tool 88 Chapter 2 Building XML Models Annotations XSM Annotations are only available in models targeted with XSD You define annotations when you want to add information about an XML model There are three kinds of annotations Annotation provides extra information on XML models or schemas You can define multiple annotations at this level and each can contain multiple documentation and or application information tags Documentation is contained within an annotation and contains an URI reference or any well formed XML content that gives extra information about XML objects or documents Application Information is contained within an annotation and contains an URI reference or any well formed XML content that is used by applications for processing instructions Generated schema of a global annotation xml version 1 0 encoding UTF 8 xs s
110. ms tab in the property sheet of a group particle and click the Add Any tool ts For general information about creating objects see the Objects chapter in the Core Features Guide Chapter 2 Building XML Models Any element properties You can modify an object s properties from its property sheet To open an any element property sheet double click its diagram symbol or its Browser entry beneath its parent object The General tab contains the following properties Property Description Stereotype Minimum Maximum ID Names pace Process contents Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Minimum number of times the Any can occur To specify that the Any is optional set this attribute to zero Maximum number of times the Any can occur For an unlimited number of times select unbounded ID of the Any Its value must be of type ID and unique within the model containing the Any Only available in a model targeted with XSD Namespaces containing the objects that can be used If you select any objects from any namespace can be used If you select other objects from any namespace other than the target namespace of the schema can be used If you select local objects that are not qualified with a namespace can be used If you select targetNamespace objects from the target namespace of the schema can be used
111. n dialog box Any Attribute Adds any attribute of a specified namespace For more information see Any Attributes on page 51 ts For general information about creating objects see the Objects chapter in the Core Features Guide Attribute properties 48 You can modify an object s properties from its property sheet To open an attribute property sheet double click its diagram symbol or its Browser entry in the Attributes folder beneath an entity or complex type The following sections detail the property sheet tabs that contain the properties most commonly entered for attributes The General tab contains the following properties Property Description Name The name of the item which should be clear and meaningful and should convey the item s purpose to non technical users Code The technical name of the item used for generating code or scripts which may be abbreviated and should not generally include spaces Comment Descriptive label of the attribute Chapter 2 Building XML Models Property Description Stereotype Reference Type Embedded Type Derivation Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Name of an attribute in the current model or another model opened in the workspace A reference allows you to reuse an attribute with all its properties without having to define it again Use the list to se
112. n entity The General tab contains the following properties Property Description Name Code Comment Stereo type ID Reference KeyRef only Selector XPath Name of the constraint It must be a no colon name See Glossary Code of the constraint It must be a no colon name Descriptive label of the constraint Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined ID of the constraint Its value must be of type ID and unique within the model containing the constraint Name of a key or a unique constraint defined in the current model or another model with a specified namespace The Reference value must be a qualified name See Glossary An XML Path Language expression that selects a set of elements across which the values specified in the Fields tab must be unique There can only be one selector see Specifying a constraint selector on page 57 Constraint property sheet Fields tab The Fields tab lists XPath expressions used to define the constraint see XPath abbreviated syntax on page 59 If more than one field is listed the combination of fields must be unique For information see Specifying constraint fields on page 58 Specifying a constraint selector A constraint selector specifies an XPath expression that selects a set of elements for a constraint 57 Constraints Keys Uniques and KeyRefs X
113. n property sheet Enumerations tab 84 The Enumerations tab is only available for simple type restrictions It allows you to enter a set of acceptable values for the simple type restriction Select F for Fixed at the end of a row if you want to prevent the modification of a value For example the meetings simple type based on the xs gMonthDay data type is restricted to the following dates 01 20 03 20 05 20 and 07 20 Restriction Properties OO Xx Annotation Dependencies l Version Info General Detail Enumerations Patterns Generated schema Chapter 2 Building XML Models lt xsisimpleType name MEETINGS gt lt xsirestriction base xs gmonthDay gt xs enumeration value 01 20 gt xs enumeration value 03 20 gt xs enumeration value 05 20 gt xs enumeration value 07 20 gt xs enumer at 1on xsirestriction xs simpleType Restriction property sheet Patterns tab The Patterns tab is only available for simple type restrictions It allows you to enter the exact sequence of acceptable values for the simple type restriction Select F for Fixed at the end of a row if you want to prevent the modification of a value For example the zipCode simple type based on the xs string data type is restricted to the following pattern two uppercase letters from A to Z followed by a five digit number each digit ranging from 0 to 9 Restriction Properties
114. n then be easily changed within the DTD 95 Instructions Import Include and Redefine XSM Instructions Import Include and Redefine XSM Imports Includes Redefines 96 Import Include and Redefine allow you to enrich your XML model with external namespaces schema files or schema components These instructions are only available in a model targeted with XSD An import identifies a namespace whose schema components are referenced by the current schema allowing you to use components from any schema with different target namespace than the current schema In a schema an import is declared with the lt import gt tag For example xml version 1 0 encoding UTF 8 lt xs schema xmlns xse http www w3 0rg 2001 xMLschema xs import id IMPL namespace xml ordering schemaLocation ORDER xsd xs schema An include allows you to include a specified schema file in the target namespace of the current schema allowing you to use components from any schema with the same target namespace as the current schema or with no specified target namespace In a schema an include is declared with the include tag For example xml versionsz 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 200L xMLSchema gt xs include id INcL schemaLocation PROFORMA xsd gt xs schema A redefine allows you to redefine simple and complex types groups and attribute groups from an
115. nded attributes for elements complex types and the XML model Caution The following procedure assumes you have an XML model open in the workspace and targeted with XSD Creating Oracle mappings with extended attributes The Oracle XML DB extended model definition allows you to set extended attributes to define mappings between your XSM and an Oracle database Toattach the XEM 1 Select Model Extended Model Definitions to open the List of Extended Model Definitions 2 Click the Import an Extended Model Definition tool to open the Extended Model Definition Selection dialog box click the XML in Database tab select Oracle XML DB and click OK in order to attach it to the model Oracle extended attributes for elements and attributes Element extended attributes You can set extended attributes on various XSM objects to define mappings with an Oracle database The following annotations can be specified on the Extended Attributes tab of the property sheets of elements 141 Generating an Annotated Schema for Oracle 9i2 Annotation Description beanClassname columnProps defaultTable javaClassname maintainDOM maintainOrder SQL CollSchema SQLCollType 142 Can be used within element declarations If the element is based on a global complexType this name must be identical to the beanClassname value within the complexType declaration If a name is specified by the user the bean
116. ne that enables the user to enter some instruction SideTableID Identifier of the side table optional SideTableName Name of the side table StorageName If StorageType is Xcolumn then it is the name of the sidetable column StorageType Type of storage Xcollection or Xcolumn Generating a DB2 DAD file You generate the DAD file by selecting it as an additional target for standard schema generation To generate an annotated schema file 1 Select Language gt schema File to open the Generation dialog box 2 Specify the directory in which to generate the file and select the XML in Database target on the Targets tab 149 Generating a DAD File for IBM DB2 150 Generation Oy x Directory Check model Targets Options XML in Database IBM DB2 DAD Document Access Definition Cancel Apply Help optional Click the Options tab and set any appropriate generation options see DB2 DAD file generation options on page 151 Click OK to begin the generation The Result dialog box is displayed with the path of the generated DAD DTD and SQL files Click Edit to open the generated DAD file in your associated editor Extract of a DAD file defined with Xcollection as StorageType and RDB as MappingType lt DOCTYPE DAD SYSTEM E dad dtd gt DAD lt validation gt ves lt validation gt xcollection prolog xml version 1 0 lt prolog gt lt doctype gt DOCTYPE Roo
117. nect are trademarks of Sybase Inc or its subsidiaries All other trademarks are the property of their respective owners ii Contents About This Manual V 1 Getting Started with XML Modeling 1 XML Modeling with PowerDesigner 2 Creating an 5 5 Customizing the XSM 13 2 Building XML Models 21 XML Diagram 22 Elements XSM is ko 29 Group 5 5 39 Any Elements 5 44 Attributes 46 Constraints Keys Uniques KeyRefs XSM 54 Groups 62 Attribute Groups XSM 68 Simple Types 5 71 Complex Types 5 73 Derivations Extensions Restrictions Lists and Unions XSM 79 Annotations 5 89 Notations XSM 92 Entities XSM 94 Instructions Import Include and Redefine XSM 96 Business Rules 5 99 3 Working with an XML model 101 Generating Other Models from an XML Model 102 Checking an XML 103 Manipulating XML Objects Graphically 118 Comparing and Merging XML Models 121 XML Model Reports
118. nformation using the following tools on the Items tab of an annotation property sheet to add content to an annotation at the global schema level Annotations tab of an element or other object property sheet to add content to an annotation at the global schema level Tool Description E Add Documentation Adds a comment or a document reference to be read by users Add Application Information Adds an information to be used by applications for processing instructions ts For general information about creating objects see the Objects chapter in the Core Features Guide Annotation property sheet General tab The General tab contains the following properties Property Description ID Must be of type ID and unique within the model containing the annotation Annotation property sheet Items tab The Items tab lists the documentation and application information tags contained within the annotation For information on the tools for creating content available on this tab see Creating a documentation or application information on page 90 90 Chapter 2 Building XML Models Documentation and application information property sheet General tab The General tab contains the following properties Property Description Source Source of the content It must be a URI reference Language documentation only Language used in the documentation For example en en GB en US de fr Documentation
119. nging its structure It can be predefined or user defined Specifies that the complex type has child elements and how they are used You can choose between all All children may be present See Group Particles XSM on page 39 choice Only one child must be present See Group Parti cles XSM on page 39 group Reference to a predefined group See Groups XSM on page 62 sequence All children must be present in order See Group Particles XSM on page 39 Chapter 2 Building XML Models Property Description Content Derivation Content type of the complex type You can choose between Simple the complex type cannot contain child elements Complex the complex type can contain child elements For more information see Specifying the type of content of a complex type on page 78 Derivation method for the complex type Once you have selected a derivation method you must define a base type Click the Properties tool beside the derivation box to display the derivation property sheet In the General tab select a base type in the Base Type list Complex type property sheet Detail tab The Detail tab contains the following properties Property Description Final Block Mixed Abstract ID Property to prevent derivation of the current complex type Property to prevent another complex type with the specified type of derivation from being used in place
120. nimum value allowed for data type Maximum inclusive Maximum value allowed for data type ga m Total digits Exact number of decimal digits allowed It must be greater than zero Fraction digits Maximum number of decimal digits in the frac tional part Whitespace Way of handling white spaces If the value is Preserve white spaces are unchanged If the value is Replace tabs line feeds and carriage returns are replaced with spaces If the value is Collapse contiguous sequences of spaces are collapsed to a single space Leading and trailing spaces are removed A facet icon is displayed in the title bar of a facet property sheet Enumeration and Pattern facets For Enumeration and Pattern facets click their corresponding tabs in the restriction property sheet and double click the arrow left of an enumeration or a pattern value to display its property sheet Caution Facets only appear in the schema within a simple type declaration see Preview tab in the model property sheet Facet general properties The General tab of a facet property sheet displays the following properties 83 Derivations Extensions Restrictions Lists and Unions XSM Property Description ID ID of the facet Its value must be of type ID and unique within the model containing the facet Value Value s of the facet Fixed To prevent a modification of the facet value s select the Fixed property Restrictio
121. niption unes 43 1 Card ofthe aroup dexcriptionnen of tw siement product ane 44 Group particle quence of the element XML modei 2 441Card ot he article sequence of ine element product Comp Partch 442 of the oloment group particle equence hor Descrip pereng Czop acr Lt Gomentname s1Cara otelementrame Cote auam Comment Dee Mosa 42 Litotdlagram containing tw slmentram e Tene 35 Lintotreteronces of tw aroup descriptonLines ane alagram containing the group deseiptontines Eementproguct card of eement product 59 eir PRODUCT Wena 42 diagram containing tne element product ane TIRGAN Y 43 Group deicriptionLiner of fne element XML model 2 TDI Page 4 4 8 x CHAPTER 4 Generating and Reverse Engineering XML Schemas About this chapter This chapter describes how to generate and reverse engineer an XML Schema Definition file XSD a Document Type Definition file DTD or an XML Data Reduced file XDR The same procedures apply to all XML languages Contents Topic page Generating an XML Schema 124 Reverse engineering an XML Schema into an XSM 126 123 Generating an XML Schema Generating an XML Schema By default PowerDesigner supports th
122. o prevent derivation of the current simple type ID of the simple type Its value must be of type ID and unique within the model containing the simple type Chapter 2 Building XML Models Complex Types XSM You can only create complex types in a model targeted with XSD 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 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 alocal scope when integrated into an lt element gt tag It applies only to its containing element dolbyStereo flatScreen highDefinition 4 s nd deluxeTV highDefinition fdeluxeTV In the example above HighDefinition is a global complex type reused as data type for the deluxeTV element Generated schema lt xml version 1 0 encoding UTF 8 gt xs schema xmlns xse http www w3 0rg 2001 xMLschema xs complexType name highbefinition gt xs sequence lt xs element name dolbystereo gt lt xs element name flatScreen gt xs sequence xs complexType lt xs element name deluxeTv types highpefinition xs schema Caution Global complex types app
123. o this XML element declaration Model extended The following annotations can be specified on the Extended Attributes tab of attributes the property sheet of the model 143 Generating an Annotated Schema for Oracle 9i2 Annotation Description mapUnboundedString If true unbounded strings are mapped to ToLob CLOB by default Similarly unbounded binary data get mapped to BLOB by default If false unbounded strings are mapped to VARCHAR2 4000 and unbounded binary components are mapped to RAW 2000 store Varray AsTable If true the VARRAY is stored as a table OCT If false the VARRAY is stored in a LOB Generating the Oracle annotated schema file You generate the annotated schema file by selecting it as an additional target for standard schema generation To generate an annotated schema file 1 Select Language gt schema File to open the Generation dialog box 2 Specify the directory in which to generate the file and select the XML in Database target on the Targets tab Generation iol x Directory C NTEMP ol Check model Targets XML in Database Oracle XML DB 9 2 annotated XSD Cancel Apply Help 144 Chapter 5 Working with XML and Databases Click OK to begin the generation The Result dialog box is displayed with the path of the annotated schema file selected Click Edit to open the generated annotated schema in your associated editor lt xml version 1
124. ool to select a base type in the derivation property sheet See Derivations Extensions Restrictions Lists and Unions XSM on page 79 Defining elements in In a model targeted with the XML Data Reduced language elements are XDR files defined by different attributes XDR element attribute Description Model Content Specifies if an element can contain new local elements Possible values are closed default open if an Any element is attached to the element See Any Elements XSM on page 44 Tab N A Specifies the content type Possible values are mixed a group particle and a data type are defined eltOnly a group particle is defined without a data type textOnly a data type is defined without a group particle empty neither group particle nor data type are defined Tab General Field Group type Type 33 Elements XSM XDR element Description attribute Order Specifies how child elements are organized within a parent element Possible values are seq sequence group particle choice group particle many all group particle Tab General Field Group type dt type Specifies a data type Tab General Field Type dt values Specifies a list of possible element values Tab Values type local elements only Specifies the name of a global element as reference for the local element Tab General Field Reference minOccurs local elements only
125. p in any of the following ways Select Model gt Attribute Groups to access the List of Attribute Groups and click the Add a Row tool Right click the model or package in the Browser and select New gt Attribute Group t For general information about creating objects see the Objects chapter in the Core Features Guide Creating a reference to an attribute group A reference to an attribute group is created within an element complex type or attribute group and makes the referenced attribute group available to its parent You can create a reference to an attribute group as follows On the Attributes tab of the property sheet of an element complex type or attribute group click the Add Group with Reference to Group tool see Element property sheet Attributes tab on page 35 ts For general information about creating objects see the Objects chapter in the Core Features Guide Attribute group properties You can modify an object s properties from its property sheet To open an attribute group or reference to an attribute group property sheet double click its Browser entry in the Attribute Groups folder or in the case of a reference to an attribute group beneath its parent object The following sections detail the property sheet tabs that contain the properties most commonly entered for attribute groups 69 Attribute Groups XSM The General tab contains the following properties Property Description
126. perform all possible validation checks however Sybase does not maintain specific environments to fully certify these resource files Sybase will support the definition by accepting bug reports and will provide fixes as per standard policy with the exception that there will be no final environmental validation of the fix Users are invited to assist Sybase by testing fixes of the definition provided by Sybase and report any continuing inconsistencies 13 Customizing the XSM Environment To change the XML language of an XML model 1 Select Language Change Current Language to open the Change XML Language dialog box r New XML language Document Definition 1 0 Share the XML language C Copy the XML language in model m Current XML language MLSchemaDefntioniO Shared Copied j Cancel 2 Select the XML language you want to model 3 Select one of the following radio buttons Share the XML language use the original XSM file in the Resource Files XML languages directory Any changes made to the XML language are shared by all linked XSMs Copy the XML language definition in model make a copy of the original XML language file in the Resource Files XML languages directory The copied object language is saved with the XSM and cannot be used without it 4 Click OK to change the XML language of the model Changes concerning simpl
127. pes property sheets t For more information on the XML Builder Wizard see Generating an XML model via the XML Builder Wizard in the Working with Data Models chapter of the Data Modeling guide Generated SQL XML queries cannot be parameterized Caution The following procedure assumes you have an XML model open in the workspace and mapped to a PDM Attaching the SQL XML extended model definition The SQL XML extended model definition allows you to generate SQL XML queries Note that this extended model definition is automatically linked to your XSM if you have created it from a PDM via the XML Builder Wizard Toattach the XEM 1 Select Model Extended Model Definitions to open the List of Extended Model Definitions 134 Chapter 5 Working with XML and Databases 2 Click the Import an Extended Model Definition tool to open the Extended Model Definition Selection dialog box select SQL XML on the General Purpose tab and click OK in order to attach it to the model SQL XML query preview You can click the Preview tab of the model property sheet to obtain a preview of the SQL XML query Generating an SQL XML query file You can generate an SQL XML query file from an XSM To generate an SQL XML query file 1 Select Tools gt Generate SOL XML Queries to open the Generation dialog box 2 Specify the directory in which to generate the file 3 Click the Selection tab and specify which of
128. pped to column to select corresponding PDM columns or OOM class attributes Create from Sources Use this tool to columns OOM class attributes in the data source to the current element attributes Generate Mapping Use this tool to automatically generate a mapping between PDM columns or OOM class attributes and element attributes with the same name or code in the data source and the current model 36 Chapter 2 Building XML Models ts For more information on element mapping see section Mapping objects in an XML model in chapter Working with an XML model Link child objects to elements XML objects do not support standard PowerDesigner link objects To link a child object to an element you must click the child object tool in the palette and then click the element symbol in the diagram This will automatically create a link between both objects See the following table for allowed links Tool Action b If you click parent element symbol with the Element tool a sequence group particle and a child element symbol are created You can modify the group particle via its property sheet b If you click the upper part of a child element symbol with the Element tool a brother ele ment symbol is displayed above the child element symbol b pum If you click the middle part of a child element symbol with the Ele ment tool a sequence group particle and a grand child element sym bol ar
129. property sheet When you define the data type of an element by selecting a simple or a complex type from another model using the Browse tool beside the Type list a shortcut is created between the current element type and the target data type The shortcut is displayed in the current model with a specific item in the Browser tree view Example of shortcuts through a reference and a data type Workspace El E Customer Directory amp Diagram 1 5 88 Elements E E Customer 5 5 sequence E Name E Job Customer gs Job g Address Shortcut m Address iustomer P luos veg Complex Types e Address Shortoup E E Corporate Directory amp Diagram 1 2 Elements E Address Eg Complex Types Job Type Chapter 2 Building XML Models Elements XSM Elements are the basic building blocks of an XML model An XML model is a tree structure of elements where child elements are attached to parent elements For example EI Workspace E structure Diagram 1 5 Elements EHE XML declaration ES sequence Encoding attribute Standalone attribute Version attribute EE XML document EO choice E file ES sequence S E DOCTYPE_tag E all ATTLIST tag ELEMENT tag ENTITY tag XML declaration EE X5D file E sequence E Schema lag E05 all Global Attibule tag Global ComplexType tag Global Element tag
130. r An XPath expression relative to the parent element being declared It identifies the child elements to which the identity applies For a field An XPath expression relative to each element selected by the selector of the constraint It identifies a single element with a simple type whose content or value is used for the constraint Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined ID of the selector Its value must be of type ID and unique within the model containing the selector 61 Groups XSM Groups XSM 62 A group of elements is a set of elements arranged by a group particle all choice or sequence which is then referenced in the model by various elements A group is created independently without a parent element and can be reused multiple times by elements complex types or other global groups through references In a schema it is directly linked to the schema tag root element See Creating a group on page 63 Areference to a group is created within an element complex type or global group and makes the referenced group available to its parent See Creating a reference to a group on page 64 For example descriptionLines A o Lr X product om name product The descriptionLines group is reused in the definition of the product element by clicking the sequenc
131. r the schema location For example customers xsd Automatic correction None A redefine must contain at least one of the follow ing items simple type complex type group or attribute group Manual correction Add items to the redefine Automatic correction None The following XML model checks are made on keys Check Description and Correction Key name and code uniqueness 112 Element names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Chapter 3 Working with an XML model Check Description and Correction Existence of fields Undefined selector KeyRef checks A key must contain at least one field Manual correction Add at least one field to the key or delete the key For example numEmployee Automatic correction Deletes unassigned key For more information on fields see section Defin ing an identity constraint field in chapter Building an XML model You must define an XPath expression for a key selector attribute Manual correction In the key property sheet de fine an XPath expression for the selector attribute For example s company s employee Automatic correction None For more information on XPath expressions see section Defining an identity constraint selector in chapter Building an XML model The following XML model checks are made on KeyRefs
132. r x ath ks 27 5 xs field xpathe GOLD f lt xs unique xs keyref name KEYREF UNIGOLD refer k UNIGOLD gt xs selector x ath ks COMPONENT 2 lt xsifield xpathe GOLD xsikeyref lt xs element xs schema The KEYREF UNIGOLD keyRef defined on the product element by reference to the UNIGOLD unique constraint specifies that the gold attribute must be unique or null within the component 2 element as well as it must be unique or null within the component 1 element See UNIGOLD Creating a constraint 56 rs You create constraints on the Constraints tab of an element using one of the following tools Tool Description a Add Key Constraint The element value must be a key within the specified scope The scope of a key is the containing element in an instance document A key must be unique not null and always present Add Unique Constraint The element value must be unique or null within the specified scope Ra Add KeyRef Constraint The element value corresponds to those of the specified key or unique constraint Chapter 2 Building XML Models ts For general information about creating objects see the Objects chapter in the Core Features Guide Constraint properties You can modify an object s properties from its property sheet To open a constraint property sheet double click its diagram symbol or its Browser entry in the Constraints folder beneath a
133. reviously defined a group in the current model Adding a child object to a group particle 42 XML objects do not support standard link objects To link a child object to a group particle you must click the child object tool in the palette and then click the group particle symbol in the diagram This will automatically create a link between both objects See the following table for allowed links Chapter 2 Building XML Models Caution A group particle cannot be created from scratch in a diagram It must be the child element of an element a group or a complex type Tool Sequence symbol Choice symbol All symbol p B p sD 1 E bOs No link A Any e L o 03 b G C3 No link A referencing group A referencing group is created You must is created You must now select a group now select a group for the reference for the reference o No link No link No link O b No link 1 e b p cg No link T No link No link No link o lin o lin o lin All Pointer indications When you cannot click a symbol or an empty space in a diagram the Pointer displays a forbidden sign See complex type in Tool column When there is a possibility to create a symbol above below or next to another one the Pointer displays an arrow indicating the corresponding direction See element in Tool column 43 Any Elements XSM Any Elements XSM Any elements al
134. rm of the attributes declared in the target namespace If Form you select Qualified attributes must be qualified with the namespace prefix If you select Unqualified attributes are not required to be qualified with the namespace prefix The value of Attribute Form is the global default value for all the attributes declared in the target namespace To override this setting individual attributes can use the Form attribute Block Default value for the Block property of elements and complex types in the target namespace The Block property prevents an element or a complex type with a specified type of derivation from being used in place of the inherited element or complex type Final Default value for the Final property of elements simple types and complex types in the target namespace The Final property prevents the specified type of derivation for an element a simple type or a complex type t For more information on elements attributes simple and complex types see chapter Building an XML model Chapter 1 Getting Started with XML Modeling XML model property sheet Items tab The Items tab lists the model s global objects which have no parent symbol in the diagram and are directly linked to the schema tag The following tools are available on this tab Tool Description Add Element Adds an element to the model Add Group Adds a group of elements to the model Add Attribute Adds an attribute to the
135. rmed independently by several team members Merge is performed from left to right the model in the right pane is compared to the model in the left pane differences are highlighted and merge actions are proposed in the model to be merged t For more information on comparing and merging models see the Comparing and Merging Models chapter in the Core Features Guide 121 XML Model Reports XML Model Reports You can create reports to document your XML model 122 t For detailed information about working with PowerDesigner reports see the Reports chapter in the Core Features Guide You can emphasize the hierarchical structure of your XML model by inserting diagram graphics in your report In the following structure the graphical representation of the diagram will appear in the report just before the descriptive paragraphs Report items 2 Section 1 Title Report of XML model 2 Text paragraph This report gives you a global look Table of contents Jj Diagram Diagram of XML model 2 E 2 Group Group descriptionLines QA Element Element ZITEM To have a preview of your report click the Print Preview tool in the Report Editor window 2 PowerDesigner XML model 2 Report Report XML model 2 B pp roo JADA ah Ae unie M Mode 2 of XML model 2 rj Group descriptontines Card ot group dexe
136. rom a Physical Data Model PDM Object Oriented Model OOM or another XSM e G XML Model 6 Har XDR file R E Reverse Engineering G Generation DTD XSD or XDR The structure of an XSM is described by a DTD an XSD or an XDR file ADTD file is a basic way to describe the structure of an XML document It is a raw list of all the legal elements making up an XML document An extract of a DTD file follows xml version 1 0 encoding UTF 8 gt Project Management lt ELEMENT Database DIVISION EMPLOYEE CUSTOMER PROJECT TEAM MATERIAL PARTICIPATE MEMBER USED COMPOSE lt ELEMENT DIVISION EMPTY gt lt ATTLIST DIVISION DIVNUM CDATA DIVNAME CDATA DIVADDR CDATA gt lt ELEMENT EMPLOYEE EMPTY gt lt ATTLIST EMPLOYEE EMPNUM CDATA EMP_EMPNUM CDATA DIVNUM CDATA EMPF NAM CDATA EMPL NAM CDATA EMPFUNC CDATA EMPSAL CDATA gt XSD file or schema is an elaborated way to describe the structure of an XML document It can support namespaces derivations keys simple and complex user defined data types and a robust collection of predefined data types An extract of an XSD file follows XML Modeling with PowerDesigner lt xml version 1 0 encading UTF 8 lt Project Management gt xs schema xmlns xse http www w3 org 2001 xMLSchema gt xs element names patabase xs complexType xsisequence xs element names DIVISION xs complexType xs attribute
137. rom the target namespace of the schema can be used If you type a white space delimited list with URI references targetNamespace and local attributes from this list can be used Process Indicator of how an XML processor should handle validation contents of XML documents containing the attributes specified by the Any Attribute If you select Lax the XML processor will try to obtain the schema and validate any attribute of the specified namespaces If the schema cannot be found no error will occur If you select Skip the XML processor will not try to validate the attributes of the specified namespaces If you select Strict the XML processor must obtain the schema and validate any attribute of the specified namespaces 53 Constraints Keys Uniques and KeyRefs XSM Constraints Keys Uniques and KeyRefs XSM 54 Constraints indicate that element values must be unique within their specified scope Constraints are only available in a model targeted with XSD Each constraint has two specific attributes selector and field In a schema a constraint is declared with its corresponding tag lt unique gt lt key gt or lt keyRef gt There are three kinds of identity constraints A Unique constraint specifies that an element or an attribute value or set of values must be unique or null within a specified scope For example project IPROJECT Generated schema lt xml version 1 0 encoding UTF 8
138. rom the palette 1 Select a group particle tool Sequence Choice or All in the palette and then click the element symbol in the diagram A group particle is created and its symbol is displayed in the diagram linked to the element symbol Element 1 ION S Element 1 3 2 Select the Element tool in the palette and then click the group particle symbol to add an element item Click the symbol again to add additional elements The child elements appear one by one in the diagram linked to the group particle symbol Element_1 m 3 Right click in order to recover the Pointer Clicking an element symbol with the Element tool When you click an element symbol with the Element tool a sequence symbol by default is displayed in the diagram between the parent element and the child element To add other child elements click the sequence symbol with the Element tool To change the group particle double click the sequence symbol to display its property sheet then select another group particle in the Type list and click OK To create a group particle from the property sheet of an element 1 Open the property sheet of the element select a group particle from the Group type list and then click OK The element is displayed selected with an Expand tab on its right side Element 1 IE J Element 1 Chapter 2 Building XML Models 2 Click an empty space in the diagram to deselect the element
139. roperties barCode BARCODE iof x Extended Dependencies Version Info Preview General Annotation Notes Rules Dependencies Name barCode Code BARCODE Comment Stereotype Derivation Final lt Undefined gt lt lt Less m Cancel Apply For elements and complex types the Content field and in the case of element the Embedded type field is set to Complex 2 Click the Properties tool to the right of the Derivation box to open the restriction property sheet 81 Derivations Extensions Restrictions Lists and Unions XSM 3 Type an ID and a base type for the restriction 4 simple types only If you select Embedded type the base type disappears and a simple type is created in the schema within the current simple type Click Apply and then the Properties tool beside the Embedded type box to define a derivation and a base type for the embedded simple type 5 option simple types only Click the Detail tab and enter appropriate facets for the restriction see Restriction property sheet Detail tab on page 82 6 option simple types only Click the Enumerations tab and enter appropriate enumerations for the restriction see Restriction property sheet Enumerations tab on page 84 7 option simple types only Click the Patterns tab and enter appropriate patterns for the restriction see Restriction property sheet Patterns tab
140. rrection Double click the group parti cle symbol and type a value for Minimum 0 or 1 and Maximum 1 or unbounded properties Automatic correction None The following XML model checks are made on groups Check Description and Correction Group name and code uniqueness Undefined reference Existence of particle Group names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code A group without a name or a code must have a reference Manual correction In the group property sheet define a reference with the Reference list or the Browse tool Automatic correction None A group must contain elements groups group particles and or Any Manual correction Add items to group or delete group Automatic correction None 109 Checking an XML Model Check Description and Correction Invalid cardinality Attribute checks You should define a minimum 0 or 1 and a maximum cardinality 1 or unbounded for a group particle occurrence This check is only available in a model targeted with XDR Manual correction Double click the group particle symbol and type a value for Minimum 0 or 1 and Maximum 1 or unbounded properties Automatic correction None The following XML model checks are made on attributes Check Description and Correction Attribute name and code uniqueness
141. rse engineering an XML Schema into an XSM Reverse engineering is the process of extracting an XML structure from an XML schema file and using it to build or update an XSM Parsing PowerDesigner uses a parser software for XML reverse engineering developed by the Apache Software Foundation http www apache org Reverse engineering to a new XML model You can reverse engineer XML schema files into a new XSM Toreverse engineer an XSD a DTD or an XDR file to a new XSM 1 Select File gt Reverse Engineer gt XML Definition to open the New XML Model dialog box New XML Model Lx General Extended Model Definitions XML language XML Schema Definition 1 0 Share the XML language Copy the XML language in model 2 Select an XML language and specify whether you want to share the resource file or copy it to your model 3 optional Click the Extended Model Definitions tab and select the extended model definitions you want to attach to the new model t For more information on extended model definitions see Extended Model Definitions in the Resource Files and the Public Metamodel chapter of Customizing and Extending PowerDesigner 4 Click OK to go to the Reverse Engineering dialog 126 Chapter 4 Generating and Reverse Engineering XML Schemas Reverse Engineering P Xx ptions Target Models Eile name C TEMPAXS D_files SMLMODEL_5 xsd Ia 1 Show symbols
142. s see Constraints Keys Uniques and KeyRefs XSM page 54 allow you to indicate that element values must be unique within their specified scope The Constraints tab lists the constraints associated with the element For information about the tools available on this tab for adding constraints see Creating a constraint on page 56 Element property sheet Mapping tab Object mapping is the ability to establish a correspondence between objects belonging to heterogeneous models and diagrams The Mapping tab of an element property sheet allows you to map the current element and its attributes to PDM or OOM objects Select a data source in the Mapping for list If it is the first time you define a mapping for an element the Mapping for list is empty Click the Add a Mapping for a Data Source tool and select a data source Element Sources tab The Element Sources tab allows you to associate one or several PDM or OOM objects to the current element You can use the Add Objects tool to select objects from the PDMs or OOMs opened in the current workspace Attributes Mapping tab The Attributes Mapping tab allows you to define the mapping between PDM columns or OOM class attributes and the element attributes Tool Description Add Mapping Use this tool to select the attributes in the current element that will be mapped to PDM columns or OOM class attributes Once you have selected the attributes you can use the list in the Ma
143. s property sheet To open an instruction property sheet double click its diagram symbol or its Browser entry in the Imports Includes or Redefines folder The following sections detail the property sheet tabs that contain the properties most commonly entered for instructions The General tab contains the following properties Property Description Schema location ID Names pace Comment Stereotype URI reference for the location of a schema file with an external namespace You can use the Browse tool beside the Properties tool to select a schema file among those opened in the current workspace For example ORDER xsd ID of the instruction Its value must be of type ID and unique within the schema containing the instruction import only URI reference for the namespace to import For example xml ordering Descriptive label of the instruction Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined 97 Instructions Import Include and Redefine XSM Redefine property sheet Items tab 98 The Items tab lists the items to be redefined Tool Description e mg Add Group Adds a group of elements to be redefined Add Attribute Group Adds a group of attributes to be redefined Add Simple Type Adds a simple type to be redefined Add Complex Type Adds a complex type to be redefined Chapter
144. select the extended model definitions of your choice t For more information on attaching extended model definition to a model see Extended Model Definitions in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual 8 Click OK to create the new XSM in the current Workspace Demo example Several example XSMs are available in the Examples directory The Model property sheet displays the definition of the current model From this property sheet you can modify the model definition The General tab contains the following properties Property Description Name The name of the item which should be clear and meaningful and should convey the item s purpose to non technical users Chapter 1 Getting Started with XML Modeling Property Description Code Comment File name Author Version XML lan guage Default diagram The technical name of the item used for generating code or scripts which may be abbreviated and should not generally include spaces Descriptive label of the model Location of the model file This box is empty if the model has never been saved Author of the model You can insert a name a space or nothing If you insert a space the Author field in the title box remains empty If you intentionally leave the box empty the Author field in the title box displays the user name from the Version Info tab of the mode
145. shortcut simple type simple type list simple type list check simple type union simple type union check 154 116 116 104 114 103 39 39 121 78 73 75 75 107 78 73 75 18 75 73 73 76 75 74 78 54 56 57 31 57 119 146 148 105 48 110 73 31 107 79 27 71 86 116 87 116 database DAD file IBM DB2 Microsoft SQL Server 2000 Oracle 912 SQL XML queries XML in database default derivation extension restriction simple type list simple type union diagram documentation create properties DTD E element block check model child element constraints properties content create data type default detail properties display preferences ElementType XDR embedded type final fixed form general properties global group local mapping properties maxOccurs XDR minOccurs XDR parent element properties reference stereotype 146 148 146 148 136 141 132 133 132 34 50 79 79 81 86 87 22 89 90 91 2 29 34 107 39 36 31 31 31 34 34 17 31 31 34 34 34 31 31 62 31 36 33 33 39 31 31 31 Index substitution group type XDR values XDR ElementType XDR content dt type dt values model order embedded type entity check model create properties enumeration extended dependencies model definition extension extension check external schema F facet field stereotype XPath final fixed form fraction digits functional o
146. t SYSTEM C XTEMPXDTD filesXcorporateMembership dtd doctype root node element node name Root element node name DEPARTMENT gt attribute node name DEPNUM gt RDB node table name DEPARTMENT column name DEPNUM types INTEGER RDB node attribute node attribute node name DEPNAME gt RDB node table name DEPARTMENT column name DEPNAME type VARCHAR 254 gt RDB node attribute node element node name EMPLOYEE gt attribute node name DEPNUM gt RDB node table names EMPLOYEE gt column name DEPNUM types INTEGER RDB node attribute node Chapter 5 Working with XML and Databases DAD file defined with Xcolumn as StorageType lt xml version 1 Q lt DOCTYPE DAD SYSTEM E Xdad dtd DAD validation YES validation xcolumn table name DEPARTMENT key DEPNUM column name type path multi name type path multi umn lt table gt lt table co umn name type path multi name pacha multi name type path multi names type path multi column umn column lt table gt lt xcolumn gt lt DAD gt DB2 DAD file generation options name EMPLOYEE keys EMPID orderBy DEPNUM DEPNAME gt DEPNUM INTEGER DEPARTMENT GDEPNUM occurrences NO f gt DEPNAME VARCHAR 2 54
147. tab where you can specify whether or not to generate comments within a description tag This option is enabled by default 3 Click OK to begin generation A Progress box is displayed The Result list displays the files that you can edit The result is also displayed in the Generation tab of the Output window located in the bottom part of the main window 4 Click Edit to edit the XSD DTD or XDR file in your associated editor XMLMODEL_2 xsd Notepad olx File Edit Format Help lt xml version 1 0 encoding UTF 8 gt xs schema xmins xs http www w3 arg 2001 xmMLSchema gt xs group name DESCRIPTIONLINES gt lt xstall gt lt xs element name LINEL gt lt xs element name LINE2 gt lt xs element name LINE3 gt xs all zx xs group lt xs element name PRODUCT gt xs complexType lt xs 1Sequence gt lt xs element gt xs group ref DESCRIPTIONLINES gt xsigroup xs sequence xs complexType xs element xs schema Customizing XML schema generation The PowerDesigner generation system is extremely customizable through the use of extended model definitions profiles and generation templates t For detailed information about customizing the generation of your code including adding generation targets options and tasks see Customizing and Extending PowerDesigner 125 Heverse engineering an XML Schema into an XSM Reve
148. tered for group particles The General tab contains the following properties 41 Group Particles XSM Property Description Type Type of the group particle You can change its type by selecting a value in the list and clicking OK Minimum Minimum number of times the group particle can occur To specify that the group particle is optional set this property to Zero Maximum Maximum number of times the group particle can occur For an ID unlimited number of times select unbounded ID of the group particle Its value must be of type ID and unique within the model containing the group particle Group particle property sheet Items tab The Items tab list the child elements associated with the group particle You can add additional children directly on this tab using the following tools Tool Description E m m Add Element Adds an element to the list Add Any Adds an Any to the list Only available with a choice or a sequence group particle Add Group Particle Adds a group particle to the list Add Reference to Element Adds a referencing element to the list Select a global element for the reference in the Selection dialog box To use this tool you must have previously defined a global element in the current model Add Reference to Group Adds a referencing group to the list Select a group for the reference in the Selection dialog box To use this tool you must have p
149. the generation targets and commands Extended model definitions are created and saved in files with the XEM extension You can create or attach one or several extended model definitions to a model When you create a new XML model or when you reverse engineer into a new XML model you can select one or several extended model definitions and attach them to the model from the New dialog box Madel type 2 New model C New model from template S Business Process Model General Extended Model Definitions Conceptual Data Model P ses at Bg Oo Information Liquidity Model Es Object Oriented Model SQL XML TA Physical Data Model OE XML Document Requirements Model ES XML Model X NGenerat Purpose in Database Share the extended model definitions 0 2 C Copy the extended model definitions Cancel Help t For more information on extended model definitions see Extended Model Definitions in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual Working with XSM extended dependencies Extended dependencies are links between objects of an XML model These links help to make object relationships clearer but are not interpreted and checked by PowerDesigner as they are meant to be used for documentation purposes only You can complement these links by applying stereotypes Stereotypes can be used to define extended dependencies between
150. the global elements you want to generate queries from separate file will be generated for each global element selected 4 Click OK to begin the generation The Result dialog box is displayed with the path of the query file selected 5 Click Edit to open the generated query file in your associated editor select xml versions 1 0 encading UTF 8 XMLELEMENT NAME Root select xMLAGG XMLELEMENT NAME DEPARTMENT XMLATTRIBUTES DEPARTMENT DEPNUM select xMLAGG XMLELEMENT NAME EMPLOYEE XMLATTRIBUTES EMPLOYEE DEPNUM AS from EMPLOYEE where DEPARTMENT DEPNUM EMPLOYEE DEPNUM from DEPARTMENT 135 Generating an Annotated Schema for Microsoft SQL Server 2000 Generating an Annotated Schema for Microsoft SQL Server 2000 ie ho d Microsoft SQL Server 2000 is an XML enabled database server which supports annotations that can be used on XSD or XDR files to map XML data to relational data An annotated schema is an XML file that allows you to store or retrieve data in an XML format from relational databases supporting XML An XML model allows you to generate an annotated schema XSD or XDR for SQL Server 2000 To generate an annotated schema for SQL Server 2000 1 Map an XSM to a PDM You can do this manually or by generating an XSM from a PDM or a PDM from an XSM but we recommend that you use the XML Builder Wizard see Mapping database objects to an XML schema via the XML Builder Wizar
151. tion then drag and drop tables and views to the Root element or a parent element corresponding to the parent table Use the elements contextual menu to modify elements Create column as C Element Attribute B E Tables H 0 Department 5 5 sequence E E Employee 51 Department E Views H E Attributes 51 65 sequence 1 Employee Attributes 8 Name ID Function gt lt Back Next gt Finish Cancel Help t For detailed information about using the wizard see Generating an XSM from a PDM via the XML Builder Wizard in the Working with Data Models chapter of the Data Modeling guide 5 Click Finish to generate the XML model S Tables 5 J MML model Diagram 1 Elements B E Root ES sequence EE Department Department Employee ES sequence Reet 6 Name sq Name ssting E Employee Root 10 s decimal ID s decimal Ei f Attributes Location xsstring Function xs string Name ID Function Attributes In the case of an existing XML model the generated elements appear alongside the existing elements Extended model definitions The SQL XML extended model definition is automatically attached to the generated XML model You can attach the XML Document extended model definition to generate a simplified XML file that will help you understand the annotated schema See Note
152. tion and Correction 108 Element name and code uniqueness Undefined type Undefined reference Existence of attribute Existence of particle Element names and codes must be unique in the model Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code An element without a reference should have a defined data type Manual correction In the element property sheet define a data type with the Type list or the Browse tool Automatic correction None An element without a defined data type must have a reference Manual correction In the element property sheet define a reference with the Reference list or the Browse tool Automatic correction None An element without a reference a data type or a substitution group should have at least one attribute Manual correction Define an attribute for the element Automatic correction None An element with an embedded complex type must contain child elements groups group particles and or Any Manual correction Add items to complex element or delete complex element Automatic correction None Chapter 3 Working with an XML model Check Description and Correction Invalid cardinality Group checks You should define a minimum 0 or 1 and a maximum cardinality 1 or unbounded for a group particle occurrence This check is only available in a model targeted with XDR Manual co
153. ttributes XSM XDR attribute Description attribute dt type Specifies a type for the attribute Tab General Field Type dt values To specify a list of available values for a global attribute Tab Values type Specifies the name of a global attribute as a reference for a local attribute Tab General Field Reference Example of an XDR file lt xml versionz 1 0 encading UTF 8 schema name xbR attributes xmlns urn schemas microsoft com xm data xmins dt urn schemas microsoft com datatypes gt AttributeType name qlobalattribute gt ElementType names parentElement pn lt attributeType name Jocalattribute default 0 dt values 1 2 3 gt attribute default 0 type Tocalattribute gt lt ElementType gt lt schema gt Attribute property sheet Detail tab 50 The Detail tab of an attribute property sheet displays the following properties Chapter 2 Building XML Models Property Description Default Default value Enter a default value only if there is no fixed value Fixed Fixed value Enter a fixed value only if there is no default value Use Indicator of how the attribute is used If you select Optional the attribute is optional and may have any value If you select Prohibited the attribute cannot be used Use this value to prohibit the use of an existing attribute in the restriction of another complex type If you select Required the attribute must appe
154. ups gp Attributes S guarantee S qualityStandards 1 88 Elements E product gg Attributes quality The quality attribute group is composed of the guarantee and qualityStandards attributes The productA element reuses the quality attribute group via the Attributes tab of its property sheet Generated XSD file xml version 1 0 encoding UTF 8 gt lt xsischema xmlns xse http www w3 0rg 2001 xMLschema xs attributeGroup name quality xs attribute name guarantee xs attribute xs attribute name qualitystandards lt xstattribute gt lt xstattributeGcroup gt lt xs element name producta gt utem ben xs attributecroup ref quality gt lt xstattributecroup gt xs complexType xs element xs schema Chapter 2 Building XML Models In a schema a group of attributes is declared with the lt attributeGroup gt tag It can contain the following tags attribute lt attributeGroup gt or lt anyAttribute gt Generated DTD file lt xml version 1 0 encoding UTF 8 gt lt ELEMENT productA EMPTY gt lt ATTLIST producta guarantee CDATA qualitystandards CDATA gt Creating an attribute group An attribute group is created independently and will be reused within other elements by way of references see Creating a reference to an attribute group on page 69 You can create an attribute grou
155. verview G generate DTD file from XML model XDR file from XML model XSD file from XML model XSM to XSM global objects group check model create display preferences properties reference stereotype 34 33 51 33 33 33 33 33 31 48 86 94 106 94 94 81 19 19 79 115 82 54 58 58 58 7 34 75 34 50 34 50 81 2 124 124 124 102 118 62 109 63 64 18 62 64 62 62 group particle All check model Choice create properties Sequence IBM DB2 identity constraint field key keyRef selector unique import check model create properties include check model create properties K key check model field properties selector stereotype keyRef check model field properties reference selector stereotype L length restriction maximum maximum exclusive maximum inclusive minimum 39 103 39 39 41 39 146 148 54 58 54 54 57 54 96 111 97 97 96 106 97 97 36 54 112 54 54 54 54 36 54 113 54 54 54 54 54 81 81 81 81 155 Index minimum exclusive 81 minimum inclusive 81 link 25 37 42 65 76 child object to complex type 76 child object to element 37 child object to group 65 child object to group particle 42 child object to parent object 25 local objects 118 M manipulate XML objects graphically 118 member types 87 merge XML models 121 Microsoft SQL Server 2000 reinforcing mapping with extended attributes 134 1
Download Pdf Manuals
Related Search
Related Contents
Sony KDX-565MXRF User's Manual manual de instrucciones epa 5 - TDA Bedienungsanleitungen 4050-313C SFE-35 FR.indd - Hearth & Home Technologies 部品の交換・購入について 2@jーRUSHー Hamal Signature Programme points d`épargne 中学校技術・家庭科 安全指導の手引(家庭分野)(PDF:4645KB) Copyright © All rights reserved.
Failed to retrieve file