Home
View this document as PDF
Contents
1. XML Modeling 95 96 PowerDesigner CHAPTER5 Working with XML and Databases Many 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 available Database Mapped XML mod Targeted XML lan Required XEM file el guage Microsoft SQL Server Yes XSD or XDR Microsoft SQL Server 2000 and higher IBM DB2 v8 1 and Yes DTD IBM DB2 DAD higher By attaching the SQL XML extensions 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 Note You can also generate PDM tables from an XML schema For more information see Generating Other Models from an XSM on page 79 Mapping Database Objects to an XML Schema Via the XML Builder Wizard You can create an XSM to generate an annotated schema from a PDM via the XML Builder 1 Open a PDM targeted with the appropriate DBMS and select Tools gt XML Builder Wizard to open the XML Builder Wizard 2 Specify whether to create a new XML model 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 hi
2. lt xsichoice gt lt xs element name INTERNAL f gt lt xsiany namespace local processContents lax gt lt xs choice gt lt xsi complexType gt lt xs element gt lt xsischema gt XML Modeling 33 e InaDTD file Any is declared within an lt ELEMENT gt tag with the keyword ANY lt xml version 1 0 encading UTF 8 gt lt ELEMENT Resources ANY gt lt ELEMENT Internal EMPTY gt e Inan XDR file Any is declared through of an lt ElementType gt tag resources in the example with its mode 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 encoding UTF 8 gt lt schema name DR_Any xmIns urn schemas micrasoft com xml data xmins dt urn schemas micrasoft com datatypes gt lt ElementType name internal content empty gt lt ElementType name resources model open content eltonly order one gt lt element type internal gt lt fElementType gt lt schema gt Creating an Any Element You can create an any element in any of the following ways e Use the Any tool in the diagram Palette e Open the Items tab in the property sheet of a group particle and click the Add Any tool For general information about creating objects see the Objects chapter in the Core Features Guide Any Element Properties You can modify an object s properties from its property sheet To open an any eleme
3. Customer Directory and the Nickname element is similarly dragged and dropped onto the model Job becomes Job2 a global element and Nickname becomes a global attribute 28 PowerDesigner CHAPTER 2 Building XML Diagrams Workspace Customer Directory Eil Diagram_1 a g Complex Types 6 Job Type gj Elements T eer EE Customer G ES sequence Address Shortcut TTA Name 5 JOB_TYPE Sanne OBZ G GA Attributes 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 PARENT_ELEMENT Child_element_2 Child_element_3 There are three kinds of group particles o s Sequence Child elements must appear at least once in the order of their declaration Choice Only one child element can be linked to the parent element All Child elements can appear in any order and each of them once or not at all These particles translate to the following tags in each of the supported languages XDR order attribute DTD separator ticle XML Modeling 29 XDR order attribute DTD separator ticle Creating a Group Particle You can create a group particle in any of the following ways e Use the Sequence Choice or All tool in the diagram Palette e Open the property sheet of an element group or complex type and se
4. Restrictions Lists and Unions XSM esis cwnsindiaraiunct tn had EEE A aN S 61 Deriving by Extension cccccsessesescccesccscccones 61 Deriving by Restriction seeeeeeeeeeeeeeeeeeees 62 Deriving DY List sssessessesessssssesesseeseeceseee 66 Deriving by Union esssssssesssessscsssessscoseessseess 67 Annotations XSM ssessessecscossoecoesoscoscoscossoeeeeeo 67 Creating an Annotation sssssessesseseoseeseeseseos 68 Annotation Properties ssssssesessssescscsescosoess 68 Notations XSM isis cciicscdescestsavstatuesdedsssesessevcseaetees 69 Creating a Notation ccc cece e nsec ccc eeeeeeeeenees 70 Notation Properties 3 vc veccnsvedsesvesiass ovens venseeensiede 70 Entities XSM isscarvasiesnisancawnnra teeiaasecn send a 70 Creating an Entity siieck anne ss demnaenowtalesaseehquehtewedues 71 Entity Properties ccccccsvecsecvecceccevcesceseess 71 Instructions Import Include and Redefine XSM 72 Creating an Import Include or Redefine Instruction EE aa E EEE Geka hed ed yin eis E RT 73 Import Include and Redefine Properties 73 Redefine Property Sheet Items Tab 74 Business Rules XSM s cicccsvicscesnesncsneaneavesesnea ses eene s 74 CHAPTER 3 Generating and Reverse Engineering XML Schemas and Other Models sssssssseees 75 Generating XML Schema Files cccesccssesscsseees 75 Reverse
5. and the SQL annotations for tables sql relation columns sql field and reference sql relationship Generating an Annotated Schema for Oracle 9i2 Oracle 9i2 is a database server with a native XML storage and retrieval technology called Oracle XML DB There is no mapping between XML data and relational data Tables columns and abstract data types ADT are created from annotated schemas XSDs 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 Oracle 9i2 uses by default the name of the XML elements present in the annotated schema to generate SQL objects You can override the creation of SQL objects by defining extended attributes for elements complex types and the XML model To enable these extensions in your model select Model gt Extensions click the Import tool select the Oracle XML DB on the XML in Database tab and click OK to attach it XML Modeling 103 Oracle Extended Attributes for Elements and Attributes You can set extended attributes on various XSM objects to define mappings with an Oracle database Element Extended Attributes The following annotations can be specified on the Extended Attributes tab of the property sheets of elements beanClassname Can be used within eleme
6. gt lt xstall gt lt xs element name linel gt lt xs element name 1ine2 gt lt xs element name 1ine3 gt lt xsiall gt lt xs igroup gt lt xs element name product gt lt xs rcomplexType gt lt xs 1sequence gt lt xs element name name gt lt xsigroup ref descriptionLines gt lt xs igroup gt lt xs rsequence gt lt xsicomplexType gt lt xs element gt lt xsischema gt e Inthe generated DTD file the group is expanded directly within its parent element lt xml version 1 0 encoding UTF 8 gt lt ELEMENT linel EMPTY gt lt ELEMENT line EMPTY gt lt ELEMENT 1ine3 EMPTY gt lt ELEMENT product Cname linel line2 1ine3 gt lt ELEMENT name EMPTY gt e Inthe generated XDR file the group is declared through a lt group gt tag within an lt ElementType gt tag with its order attribute set to seq lt xml version 1 0 encoding UTF 8 gt lt schema name XDR_group xmins urn schemas microasoft com xml data xmIns dt urn schemas microsoft com datatypes gt lt ElementType name linel content empty gt lt ElementType name Jine2 content empty gt lt ElementType name Tine3 content empty gt lt ElementType name name content empty gt lt ElementType name product model closed content eltonly order seq gt lt element type name gt sgroup gt lt element type inel gt lt element type ine2 gt lt element type ine3 gt
7. localattribute gt lt fElementType gt You can derive an attribute data type to extend or restrict its values Only with a model targeted with XSD For example XML Modeling 35 Employees number xs positivelnteger references xs string quantities xs unsignedLong fidelity xs boolean solvency xs boolean Company COMPANY foundation xs date status xs token Generated schema lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001L xmMLSchema gt lt xs element name COMPANY gt lt xs rcomplexType gt lt xs sequence gt lt xs element name EMPLOYEES gt oe lt xsiattribute ref NUMBER gt lt xstattribute gt lt xs rcomp exType gt lt xs element gt lt xs element name PRODUCTS gt lt xs complexType gt lt xSiattribute name REFERENCES type xsistring gt lt xstattribute gt lt xSiattribute name QUANTITIES type xs unsignedcLong gt lt xstattribute gt lt xsircomplexType gt lt xs relement gt lt xs element name CLIENTS gt lt xs i complexType gt lt xsiattribute name FIDELITY type xs string gt lt xstattribute gt lt xSiattribute name SOLVENCY type xs istring gt lt xstattribute gt lt xsicomplexType gt lt xsrelement gt lt xs sequence gt lt xsiattribute name FOUNDATION type xs date gt lt xstattribute gt lt xSiattribute name STATUS type xs token gt lt xstattribute g
8. lt Less X Cancel Apply Help 40 PowerDesigner CHAPTER 2 Building XML Diagrams 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 The General tab contains the following properties ID ID of the Any Attribute Its value must be of type ID and unique within the model containing the Any Attribute Namespace Namespaces containing the attributes that can be used If you select any attributes from any namespace can be used If you select other attributes from any name space 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 from 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 con Indicator of how an XML processor should handle validation of XML documents tents 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 obtai
9. lt group gt lt fElementType gt lt schema gt Note 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 48 XML Modeling 49 Creating a Group A group is created independently in the diagram and will be reused within other elements by way of references For more information on references see Creating a reference to a group on page 50 You can create a group in any of the following ways e Select the Group tool in the diagram Palette and click in an empty space in the diagram e Select Model gt Groups to access the List of Groups and click the Add a Row tool e Right click the model or package in the Browser and select New gt Group For general information about creating objects see the Objects chapter in the Core Features Guide Creating a Reference to a Group 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 e Select the Group tool in the diagram Palette and click on an element group or complex type symbol e On the Items tab of the property sheet of a group particle click the Add Group with Reference to Group
10. product PRODUCT gold xs boolean Generated schema lt xml version 1 0 encoding UTF 8 7 gt lt xsischema xmins xs http www w3 org 2001 xmMLschema xmIns k keyRef namespace gt lt xs element name PRODUCT gt lt xs complexType gt lt xs sequence gt lt xs element name COMPONENT_1 gt lt xs ec I lexType gt lt xsiattribute name GOLD type xs boolean gt lt xs tattribute gt lt xsicomplexType gt lt xs element gt lt xs element name COMPONENT_2 gt lt xs i complexType gt lt xs Sequence gt lt xs element name COMPONENT_3 gt lt xs element name COMPONENT_4 gt lt xs sequence lt xsiattribute name GOLD type xs boolean gt lt xstattribute gt lt xsicomplexType gt lt xs element gt lt xs sequence lt xs i complexType gt lt xs unique name UNIGOLD gt lt xsiselector xpath k COMPONENT_1 gt lt xs ifield xpath GOLD gt lt xs tunique gt lt xsikeyref name KEYREF_UNIGOLD refer k UNIGOLD gt lt xsiselector xpath k COMPONENT_2 gt lt xs field xpath GOLD gt lt f xsikeyref gt lt xs element gt lt xsischema gt 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 You create const
11. 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 speci fied namespaces Only available in a model targeted with XSD Attributes XSM Attributes are used to give additional information about elements There are global and local attributes e Global attributes are defined with the Model menu In a schema they are directly linked to the lt schema gt tag root element They can be reused for any element in the model through references See NUMBER attribute in the generated schema e 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 Note In a model targeted with the XML Data Reduced language local attributes are first declared separately like global attributes with the lt AttributeType gt tag and a name attribute then within their parent element with the lt attribute gt tag and a type attribute Extract of an XDR file lt AttributeType name globalaAttribute gt lt ElementType name parentElement content empty gt lt AttributeType name Jocalattribute default 0 lt attribute default 0 type
12. DOCTYPE_tag all ATTLIST_tag E ELEMENT_tag E ENTITY_tag XML_document i sci M ceeleraen DENEN P OE ES sequence HHE Schema_tag B all E Global_Attribute_tag E Global_ComplexType_tag E Global_Element_tag E Global_SimpleType_tag ML_declaration Generated schema XML Modeling 19 lt xml version 1 0 encoding UTF 8 7 gt lt xs schema xmins xs http www w3 org 2001 xmMLschema gt lt xs element name ML_DOCUMENT gt lt xsicomplexType gt lt xsichoice gt lt xs element name SD_FILE gt lt xs i complexType gt lt xs sequence lt xs element ref XML_DECLARATION gt lt xs element name SCHEMA_TAG gt lt xs complexType gt lt xstall gt lt xs element name GLOBAL_ELEMENT_TAG gt lt xs element name GLOBAL_ATTRIBUTE_TAG gt lt xs element name GLOBAL_SIMPLETYPE_TAG gt lt xs element name GLOBAL_COMPLEXTYPE_TAG gt lt xstall gt lt xs complexType gt lt xsrelement gt lt xs sequence gt lt xs complexType gt lt xsrelement gt lt xs element name DTD_FILE gt lt xs complexType gt lt xs 1sequence gt lt xs element ref ML_DECLARATION gt lt xs element name DOCTYPE_TAG gt lt xs complexType gt lt xsiall gt lt xs element name ELEMENT_TAG gt lt xs element name ATTLIST_TAG gt lt xs element name ENTITY_TAG gt lt f xstall gt lt xs comp lexType gt lt xs element gt lt xs sequence gt lt xsi complexType g
13. DTD file and an application information Creating an Annotation You can create a annotation at the global level in any of the following ways e Open the Items or External Schemas tab in the property sheet of the model and click the Add Annotation tool e Right click the model or package in the Browser and select New gt Annotation For general information about creating objects see the Objects chapter in the Core Features Guide Annotation Properties You can modify an object s properties from its property sheet To open an annotation property sheet double click its Browser entry in the Annotations folder The following sections detail the property sheet tabs that contain the properties most commonly entered for annotations The General tab contains the following properties Must be of type ID and unique within the model containing the annotation 68 PowerDesigner CHAPTER 2 Building XML Diagrams Items Tab This tab lists the documentation and application information tags contained within the annotation You can create a documentation or application information using the following tools Tool Description CE 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 Note These tools are also available on the Annotations tab of an element or other object property sheet to add con
14. Engineering an XML Schema into an XSM 77 Reverse Engineering to a New XML Model 77 Reverse Engineering to an Existing XML Model 78 Generating Other Models from an XSM ccccccssssseees 79 CHAPTER 4 Checking an XSM cccccecsccccccceees 83 Group Particle Checks cccccccccccscscscscccccceceeees 83 M del CHECKS wicciusiseitivwckeecereeeis vuasicciesaussticdadereeess 84 Data Source CHECKS vicscecieiiwesseseeeiadsicassivscrcestssavcees 85 XML Modeling v Contents Entity CHECKS rescrie Stasi Gea tu odio Mute ia a e 85 Include CHECKS s cos ccescedsesee cis eveunceedi ace vedcvenseasesevevens 86 Simple Type GHECK Gist cea tedvaedvivicecudontsansantecetonewsiosia 86 Complex Type Checks ssesessesseceesesecoecseesecseceeseeceo 86 Element CRECKS c scssicccascnseccstcsescesssvavdesdsacevcasevess 87 Group CHECKS osidcciscvcoranaaducsenee teed cocceassusedenbswerenvesne 88 Attrib te CHECKS 5 oc ac vided dcowsabesbeseea dewaenducasaesceuessewen 89 NOLACION CNEGCKS viiaieusenastee ocete oc a 89 Attribute Group Checks ccccccccccecccccccccessceccees 90 Import CHECKS s isscsdassdccwsees van sadecews Sede Cavdaatandevcasesnes 90 Redervine CHECKS c esids ccoive a E a E ESA 91 Key CHECKS iid ics dontcicvanawdewd nes a EEEE EEEE EE 91 KeyRef CHECKS a5 ivicoidsccssccsscvetscvarcanennans avssnecsyeeeewass 92 UNIGUE CHECKS iisicey aaa ucenci snese onnen ea iaa 93 Extension CheckScssc
15. Existence of fields 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 Specifying Constraint Fields on page 45 XML Modeling 91 Check Description and Correction Undefined selector KeyRef Checks PowerDesigner provides default model checks to verify the validity of KeyRefs KeyRef name and code uniqueness Undefined reference Existence of fields Undefined selector You must define an XPath expression for a key selector attribute Manual correction In the key 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 Specifying a Constraint Selector on page 45 Description and Correction 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 A keyRef must contain at least one field Manual correction Add at least one field to the keyRef or delete the keyRef For example numEmp
16. General Options to make sure that Move is the Default action of the Drag amp Drop option A global object is right under the model item in the Browser tree view It has no parent symbol in the diagram You can move global objects within or between the Browser tree view and the diagram window e Within Browser 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 e Within Diagram 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 e From Browser to Diagram When you move a global object from the Browser to the diagram a synonym symbol is created in the diagram e From Diagram to Browser 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 Local Objects A local object is under a group particle item in the Browser tree view It has a parent symbol in the diagram You can move local objects within or between the Browser tree view and the diagram window XML Modeling 27 e Within Browser You can move a local object within the Browser to convert it into a globa
17. When a reference is defined the name and code are those of the target group and the properties are grayed 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 Group type unavailable to references to groups Specifies how child elements are to be used within the group You can choose between e all e choice sequence For more information see Group Particles XSM on page 29 Minimum Minimum number of times the group can occur To specify that the group is optional set this attribute to zero Maximum Maximum number of times the group can occur For an unlimited number of times select unbounded You can access the Preview tab of a group property sheet directly by right clicking the group symbol in the diagram and selecting Preview 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 both objects The following table lists the allowed links If you click a group symbol with the Element tool a sequence group particle and a child element symbol are created You can modify the group particle via
18. appear in the XDR file between the schema start tag and end tag Suggested Bibliography e W3C XML Recommendation http www w3 org TR REC xml e W3C DTD Recommendation http www w3 org TR REC xml dt doctype e W3C XML Schema Recommendation Attp www w3 org XML Schema dev e W3C XML Data Note Attp www w3 org TR 1998 NOTE X ML data 0105 XML Modeling 3 Creating an XSM You create anew XML model by selecting File gt New Model Note In addition to creating an XSM from scratch with the following procedure you can also reverse engineer a model from an existing XSD a DTD or an XDR file see Reverse Engineering an XML Schema into an XSM on page 77 The New Model dialog is highly configurable and your administrator may hide options that are not relevant for your work or provide templates or predefined models to guide you through model creation When you open the dialog one or more of the following buttons will be available on the left hand side e Categories which provides a set of predefined models and diagrams sorted in a configurable category structure e Model types which provides the classic list of PowerDesigner model types and diagrams Template files which provides a set of model templates sorted by model type T New Model E Category Category items B Business a m Information Categories Application Conceptual Data Data Flow Diagram Data Movement Logica
19. attribute group or delete attrib ute group Automatic correction Deletes unassigned attribute group PowerDesigner provides default model checks to verify the validity of imports Undefined schema location and namespace Description and Correction An import must have at least a schema location or a namespace de fined Manual correction In the import property sheet define a URI for the schema location and or the namespace Automatic correction None 90 PowerDesigner CHAPTER 4 Checking an XSM Redefine Checks PowerDesigner provides default model checks to verify the validity of redefines Check Description and Correction Undefined schema location You must define a schema location for a redefine Manual correction In the redefine property sheet define a URI or select a schema file for the schema location For example cus tomers xsd Automatic correction None Existence of component A redefine must contain at least one of the following items simple type complex type group or attribute group Manual correction Add items to the redefine Automatic correction None Key Checks PowerDesigner provides default model checks to verify the validity of keys Check Description and Correction Key name and code uniqueness 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
20. creates a link in the model to the specified file To copy the contents of the resource and save it in your model file click the Embed Resource in Model button to the right of this field Embedding a file in this way enables you to make changes specific to your model without affecting any other models that reference the shared resource 6 optional Click the Select Extensions button and attach one or more extensions to your model 7 Click OK to create and open the XML model Note Sample XSMs are available in the Example Directory XSM Properties You open the model property sheet by right clicking the model in the Browser and selecting Properties Each XML model has the following model properties Name Specifies the name of the model which should be clear and meaningful and should convey the item s purpose to non technical users Code Specifies the technical name of the model which is used for generating code or scripts Provides a description of the model Filename Specifies the location of the model file This box is empty if the model has never been saved XML Modeling 5 Author Specifies the author of the model If you enter nothing the Author field in diagram title boxes displays the user name from the model property sheet Version Info tab If you enter a space the Author field displays nothing Version Specifies the version of the model You can use this box to display the repository version or a user de
21. 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 gt lt xsischema xmins xs http www w3 org 2001 xmMLschema gt lt xsisimpleType name BARCODE gt lt xsirestriction base xsinonNegativelnteger id STRL gt lt xs length value 13 gt lt xstrestriction gt lt xsisimpleType gt lt xs element name PRODUCTA type BARCODE gt lt xs element name PRODUCTB type BARCODE gt lt xsischema gt Creating a Simple Type You can create a simple type in any of the following ways e Select Model gt Simple Types to access the List of Simple Types and click the Add a Row tool e Right click the model or package in the Browser and select New gt Simple Type XML Modeling 55 Warning If the simple type symbol does not appear in the diagram select Symbol gt Show Symbols then click the Simple Type tab and select the simple type box to display its symbol in the diagram 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 Name Name of the simple type which must be a no c
22. defined in the current model or another model opened in the workspace Embedded If selected the attribute data type disappears and a lt simple type gt tag is created in the Type schema within the lt attribute gt tag Only available in a model targeted with XSD Derivation 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 Detail Tab The Detail tab of an attribute property sheet displays the following properties Property Description Default value Enter a default value only if there is no fixed value Fixed value Enter a fixed value only if there is no default value 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 appear at least once and may have any value matching its data type 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 of the attribute If you s
23. element name DIVISION gt lt xs i complexType gt lt xstattribute name DIVNUM gt lt xsisimpleType gt lt xsirestriction base ID gt lt xsiminiInclusive value L gt lt xsipattern value 00000 gt lt xstrestriction gt lt xsisimpleType gt lt xstattribute gt lt xSiattribute name DIVNAME type NAME gt lt xstattribute gt lt xSiattribute name DIVADDR type SHORT_TEXT gt lt xstattribute gt lt xs complexType gt lt xsrelement gt An XSD file always starts with the lt schema gt tag root element All objects created in the model will appear in the XSD file between the schema start tag and end tag e 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 gt lt Schema name PROJECT xmIns urn schemas microsoft com xm l data xmins dt urn schemas microsoft com datatypes gt lt description gt Project Management lt description gt lt ElementType name DIVISION content empty gt lt attributeType name DIVNUM gt lt attribute type DIVNUM gt lt AttributeType name DIVNAME dt type string gt lt attribute type DIVNAME gt lt AttributeType name DIVADDR dt type string gt lt attribute type DIVADDR gt lt fElementType gt An XDR file always starts with the lt schema gt tag root element All objects created in the model will
24. 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 lt xml version 1 0 encoding UTF 8 gt lt xs ischema xmins xs http www w3 org 2001 xMLSschema gt lt xsiimport id IMPL namespace xml ordering schemaLocation ORDER xsd gt lt xs ischema gt Includes 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 lt include gt tag For example lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001 xMLSchema gt lt xstinclude id INCL schemaLocation PROFORMA xsd gt lt xsischema gt Redefines A redefine allows you to redefine simple and complex types groups and attribute groups from an 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 72 PowerDesigner CHAPTER 2 Building XML Diagrams lt xml v
25. 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 For more information see Business Rules in the Objects chapter of the Core Features Guide 74 PowerDesigner CHAPTER 3 Generating and Reverse Engineering XML Schemas and Other Models PowerDesigner supports the generation and reverse engineering of XML Schema Definition files XSD Document Type Definition files DTD and XML Data Reduced files XDR You can also generate a physical data model PDM from an XSM or generate an XSM froma PDM Generating XML Schema Files PowerDesigner provides a standard interface for generating all the supported XML schemas Target Schema Generated file Document Type Definition 1 0 Note Parameter entities are references to predefined values within a DTD file See Parameter property in entity property sheet During DTD generation some object properties con taining 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 XML Data Reduced 1 0 You can preview the file to be generated by selecting the Preview tab of your XML model property she
26. must be a qualified name 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 Predetermined 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 Prohibited 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 Note In the case of a model targeted with XDR the Detail tab is only available for local elements Mapping Tab This tab lets you map the element and its attributes to PDM or OOM objects You associate one or more PDM or OOM objects to the element using the Add Objects tool on the Element Sources sub tab You can associate PDM columns or OOM c
27. must be unique There can only be one selector see Specitying a Constraint Selector on page 45 Fields Tab The Fields tab lists XPath expressions used to define the constraint see XPath Abbreviated Syntax on page 46 If more than one field is listed the combination of fields must be unique see Specifying Constraint Fields on page 45 44 PowerDesigner CHAPTER 2 Building XML Diagrams Specifying a Constraint Selector A constraint selector specifies an XPath expression that selects a set of elements for a constraint 1 Open the property sheet of a constraint and enter an XPath expression in the Selector XPath field see XPath abbreviated syntax on page 46 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 Selector Properties ioj x General Annotation Dependencies Version Info Path scompanysemployee Ss Stereotype Poo ID OO 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 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 46 3 Click the P
28. name localelement content empty gt lt ElementType name qglobalelement model closed content eltonly order seqg dt values 0 1 2 gt lt element type Tocalelement minoccurs 0 maxoccurs gt lt ElementType gt lt f schema gt XML Modeling 25 Linking 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 The following table lists the allowed links If you click a 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 If you click the upper part of a child element symbol with the Element tool a brother element symbol is displayed above the child element symbol oes If you click the middle part of a child element symbol with the Element tool a sequence group particle and a grand child element symbol are created You can modify the group particle via its property sheet 2 mAH If you click the lower part of a child element symbol with the Element tool a brother element symbol is displayed below the child element symbol p i CE If you click an element symbol with the Any tool a sequence group particle and an any symbol are created You can modify the group
29. or object language Manual correction Delete models with different DBMS or ob ject language or modify the DBMS or object language of mod els in the data source Automatic correction None Entity Checks PowerDesigner provides default model checks to verify the validity of entities Check o Description and Correction Entity name and code Entity names and codes must be unique in the model uniqueness f q Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Undefined entity 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 XML Modeling 85 Include Checks PowerDesigner provides default model checks to verify the validity of includes Check o Description and Correction Undefined schema location 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 Simple Type Checks PowerDesigner provides default model checks to verify the validity of simple types Description and Correction Simple type name and code Simple type names and codes must be unique in the model uni
30. selector attribute For example s company s employee Automatic correction None For more information on XPath expressions see Specifying a Con straint Selector on page 45 PowerDesigner provides default model checks to verify the validity of extensions Undefined base type Description and Correction You must define a base type when you derive a complex type by ex tension Manual correction In the complex type property sheet click the Prop erties 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 XML Modeling 93 Restriction Checks PowerDesigner provides default model checks to verify the validity of restrictions Check o Description and Correction Undefined base type 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 Existence of facet A simple type restriction must have at least one facet defined Facets are defined in the Detail Enumerations and Patterns tabs of a simple type restriction property sheet Manual correction Define one or more facets in the simple type re striction property sheet Autom
31. 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 Groups XSM 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 For example 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 lt schema gt tag root element See Creating a group on page 50 A reference 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 50 The descriptionLines group is reused in the definition of the product element by clicking the sequence group particle S with the palette Group tool The Reference property of the referencing group property sheet is then set to descriptionLines 48 PowerDesigner CHAPTER 2 Building XML Diagrams In the generated XSD file the group is first declared with the lt group gt tag and then reused through a reference ref set to descriptionLines lt xml version 1 0 encoding UTF 8 7 gt lt xsischema xmins xs http www w3 org 2001 xmMLschema gt lt xsigroup name descriptionLines
32. the type disappears and a simple type is created in the schema within Type the current simple type or element Click Apply and then the Properties tool beside the Embedded type box to define a derivation and a type for the embedded simple type 3 Click OK to close the list property sheet and return to the element or simple type 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 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 and complete the following properties 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 3 optional Click the Union Types tab and add appropriate simple types to the union 4 Click OK to close the union property sheet and return to the element or simple type 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 e Annotation provides extra information on XML models or schemas You can define multiple annotati
33. type 86 simple type list 94 simple type union 95 target namespace 84 unique 93 child element 29 Choice group particle 29 code preview 8 complex content 60 complex type 56 check model 86 complex content 60 create 57 global 56 local 56 properties 57 simple content 60 constraint 41 create 43 properties 44 context node 45 D DAD file 107 XML Modeling 111 Index data source 85 data type attribute check 89 complex type 56 element check 87 extension 61 external shortcut 17 simple type 55 simple type list 66 simple type list check 94 simple type union 67 simple type union check 95 database DAD file 107 IBM DB2 107 Microsoft SQL Server 2000 100 Oracle 912 103 SQL XML queries 97 99 XML in database 97 derivation 61 extension 61 simple type list 66 simple type union 67 diagram 13 display preferences 9 documentation annotation 67 DTD 1 E element 18 check model 87 child element 29 create 21 general properties 21 group 48 parent element 29 embedded type 66 entity 70 check model 85 create 71 properties 71 extended dependency 12 extension 11 check 93 derivation 61 extension file 11 F facet 62 field 41 45 stereotype 45 XPath 45 G generate DTD file from XML model 75 XDR file from XML model 75 XSD file from XML model 75 generate pdm 79 generate xsm 79 global objects 27 group 48 check model 88 create 50 properties 48 50 reference 48 stereotype 48 group
34. types within the current simple type Click Apply and then the Properties tool beside only the Embedded type box to define a derivation and a base type for the embedded simple type 3 optional simple type restrictions only Click the Detail tab and enter appropriate facets constraints on the set of values of a simple type for the restriction e Length Exact number of characters or list items allowed It must be equal to or greater than zero XML Modeling 63 4 g 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 a 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 Minimum value allowed for data type Maximum inclusive Maximum value allowed for data type Total digits Exact number of decimal digits allowed It must be greater than zero Fraction digits Maximum number of decimal digits in the fractional part Whitespace Way of handling white spaces You can choose from the following e Preserve white spaces are unchanged e Replace Tabs line feeds and carriage returns are replaced with spaces e Collapse Contiguous sequences of spaces are collapsed to a single space Leading and trailin
35. window Reverse Engineering to an Existing XML Model You can reverse engineer XML schema files to add objects to an existing XSM 1 Open the XML model you want to reverse into and then select Language gt Reverse Engineer schema File to open the Reverse Engineering dialog box 2 Select the file to reverse and specify any appropriate options 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 78 PowerDesigner CHAPTER 3 Generating and Reverse Engineering XML Schemas and Other Models Merge Models _ OF x BB SF BHM APM D From SMLMODEL_5 To lt MLModel_6 39 XMLMODEL_5 B A Items B HIGHDEFINITION A sequence E DOLBYSTEREO E FLATSCREEN B E DELUXETY B A all E INTERNET E DYD 2g Embedded Type deluxeComputer lt all webCam WiFi LIT Code MLMODEL_5 XMLMODEL_6 E Schema Language XML Schema Definition 1 0 XML Schema Definition 1 0 E Model Options ModelOptions ModelOptions xS ModelOptions ModelOptions xS O Author D Version Fia Cancel Help 5 Review the objects that you will be importing and the changes that th
36. with Extended Dependencies Extended dependencies can be created between any model objects including between objects in different models They are used for documentation purposes only and are not interpreted or checked by PowerDesigner For more information about extended dependencies see Creating Extended Dependencies in Chapter 9 Getting Started with Linking and Synching of the Core Features Guide 12 PowerDesigner CHAPTER2 Building XML Diagrams An XML diagram provides a graphical view of the elements that comprise an XML schema definition in a tree format With 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 Shee Wddess issn lob Retrence festa Ejo 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 following illustration shows the Achievement sub diagram XML Modeling 13 Workspace 5 Rese rite O Main StantDate xs gYearMonth 1 Contact EndDate xs gYearonth a 2Achievement 3 Description E 4 Address
37. 1L xMLSchema gt lt xSigroup name DESCRIPTIONLINES gt lt xsitall gt lt xs element name LINEL gt lt xs element name LINE2 gt lt xs element name LINE3 gt lt xsiall gt lt xs igroup gt lt xs element name PRODUCT gt lt xs i complexType gt lt xs 1Sequence gt lt xs element name NAME gt lt xsigroup ref DESCRIPTIONLINES gt lt xs igroup gt lt xs rsequence gt lt f xs complexType gt lt xs element gt lt xs schema gt 76 PowerDesigner CHAPTER 3 Generating and Reverse Engineering XML Schemas and Other Models Reverse 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 Note PowerDesigner uses a parser software for XML reverse engineering developed by the Apache Software Foundation Attp www apache org Reverse Engineering to a New XML Model You can reverse engineer XML schema files to create a new XSM 1 Select File gt Reverse Engineer gt XML Definition to open the New XML Model dialog box 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 Select Extensions tab and select any extension files you want to attach to the new model 4 Click OK to go to the Reverse Engineering dialog Reverse Engineering ioj x Options Target Models File name C TEMP XSD_fi
38. 3 Selects the third section in the second chapter of the book employee dept doc Selects all the employee child elements of the context node with a dept attribute set to doc employee dept doc 3 Selects the third employee child element of the context node with a dept attribute set to doc employee 3 dept doc Selects the third employee child element of the context node only if it has a dept attribute set to doc chapter title Selects the chapter child elements of the context node with at least one title child element chapter title About this book Selects the chapter child elements of the context node with at least one title child element with a text content set to About this book employee numEmployee and Selects all the employee child elements of the context node with dept the numEmployee and dept attributes Selects all the child nodes of the text context node XML Modeling 47 Selector and Field Property Sheet General Tab The General tab of a selector or field property sheet contains the following properties Property XPath For a selector 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
39. By EMPID DEPNUM FIRSTNAME LASTNAME gt lt column name DEPNUM type INTEGER path DEPARTMENT EMPLOYEE DEPNUM multi_occurrence No gt lt column name EMPID type INTEGER path DEPARTMENT EMPLOYEE GEMPID multi_occurrence No gt lt column name FIRSTNAME type CHARCL path DEPARTMENT EMPLOYEE FIRSTNAME multi_occurrence NO gt lt column name LASTNAME type CHARCL path DEPARTMENT EMPLOYEE LASTNAME multi_occurrence No gt lt table gt lt xcolumn gt lt DAD gt 110 PowerDesigner Index A All group particle 29 annotated schema Microsoft SQL Server 2000 100 Oracle 912 103 annotation 67 application information 67 check model 95 create 68 documentation 67 global 67 local 67 properties 68 any 33 create 34 namespace 33 process contents 33 properties 34 any attribute 40 namespace 40 process contents 40 application information 67 attribute 35 check model 89 create 37 properties 37 attribute group 52 check model 90 create 53 54 properties 52 54 reference 52 stereotype 52 AttributeType XDR 37 B base type 61 business rule XSM define 74 C check model 83 Index annotation 95 attribute 89 attribute group 90 complex type 86 data source 85 element 87 entity 85 extension 93 group 88 group particle 83 import 90 include 86 key 91 keyRef 92 model 84 namespaces 84 notation 89 redefine 91 restriction 94 shortcut 84 simple
40. Diagram sssssessecesseseesecseoeeseooeo 17 External Shortcuts through References and Data Types EEEE E E E E E E ET 17 Elements XSM ecr ie nenieesisn itan oenen E EEE Se 18 Creating an Element ssssssssssssssssssscssesscssceseo 21 Element Properties cccscccccccecsessscccescccoues 21 Linking Child Objects to Elements ssessssssessess 26 Manipulating XML Objects Graphically 27 Group Particles XSM ssessessesssssecoscosssesccesoesoeeo 29 Creating a Group Particle cece eee ee eee e ee 30 Creating a Group Particle from the Palette 30 Creating a Group Particle from the Property Sheet of an Element ceseeseeeees 31 XML Modeling Contents Group Particle Properties cccccecccecceeeeeeeees 31 Adding a Child Object to a Group Particle 32 Any Elements XSM ssccccccccccsccccccccccccccccccccees 33 Creating an Any Element c cece cece seen ee eeeeee 34 Any Element Properties scceeesssssseseeenees 34 Attributes XS soss si nenosene ae aee ees 35 Creating an Attribute ccccccescesessesescscesees 37 Attribute Properties essserssessserceseecssreceeses 37 Any Attributes sessessessessesssoscsseescoesoecoecoe 40 Any Attribute Property Sheet General Tab 41 Constraints Keys Uniques and KeyRefs XSM 41 Creating a Constraint sssesesose
41. If false the collection is mapped to a NESTED TABLE SQLCollSchema Name of the database user owning the type specified by SQLCollType SQLCollType Specifies the name of the SQL collection type corresponding to this XML element that has maxOccurs gt 1 SQLInline 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 104 PowerDesigner CHAPTER 5 Working with XML and Databases SQLName Specifies the name of the attribute within the SQL object that maps to this XML element SQLSchema Name of the database user owning the type specified by SQLType SQLType Specifies the name of the SQL type corresponding to this XML element declaration tableProps 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 Attributes The following annotations can be specified on the Extended Attributes tab of the property sheets of complex types 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 g
42. Inc in the U S and other countries Unicode and the Unicode Logo are registered trademarks of Unicode Inc All other company and product names used herein may be trademarks or registered trademarks of the respective companies with which they are associated 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 Inc One Sybase Drive Dublin CA 94568 Contents CHAPTER 1 Getting Started with XML Modeling 1 Creating an XSM sscvewawcstaseveciavs eneen s iNET anea veo 4 XSM Properties o 05sesssnieccdevncsecrrest eciesenenvesvenvend rd 5 Previewing XML Code scsi sisavedeetennstasieiesdsaesetdessenceass 8 Customizing your Modeling Environment sssseees 9 Setting XSM Model Options ssssssssssssssessessesees 9 Setting XSM Display Preferences eeeeeeeeeeees 9 Viewing and Editing the XML Language Definition File Gisela ree adil ss iad ead Cantu eeu chance tie Patan tae 10 Changing the XML Language eeeeeeee 10 Extending your Modeling Environment 66 11 Creating Links with Extended Dependencies 12 CHAPTER 2 Building XML Diagrams ssceeeees 13 XML Diagram Objects seseeseesecsecsececceeeceeeoecoecoecoe 14 Linking Objects in an XML Model ssssessssssesssess 16 Creating an XML
43. L document Available for Element Attribute 100 PowerDesigner CHAPTER 5 Working with XML and Databases key fields limit field overflow field relationship child relationship child key relationship parent relationship parent key 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 Allows limiting the values that are returned on the basis of a limiting value Available for Element Attribute Allows schema items to be 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 el
44. Markup Language is increasingly used to hold application data because It e describes and structures data whereas HTML only displays data e uses a self describing and personalized syntax e 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 Workspace a E Resume gy Diagram_1 19g Simple Types G Code Complex Types AddressType B sequence E City E Country E State E StreetAddress E ZipCode Elements E E Resume B sequence H E Contact H E Education H E Experience H E Interests E Objective E jobReference B Groups H 6 Achievement Description B sequence E Paragraph Title lob Retrence testirg hore bakmi E CellPhone snr E Diploma i H aa aa al e iid 38 3 BF a Bator xe gYeationh 3 O 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 generate and reverse engineer XSD DTD and XDR files and also generate an XML model from a Physical Data Model PDM Object Oriented Mode
45. SM on page 69 XML Modeling 15 Linking Objects in an XML Model 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 The following tables list the allowed links Element symbol Group symbol Complex type symbol ee S H C a C E Ee ae as e E aoe C apm fe C sin a Warning 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 PowerDesigner CHAPTER 2 Building XML Diagrams For more information see Link Child Objects to Elements on page 26 Adding a Child Object to a Group Particle on page 32 Linking Child Objects to a Group on page 51 Linking a Child Object to a Complex Type on page 59 Creating an XML Diagram You can create an XML diagram in an existing XSM in any of the following ways e Right click the model in the Browser and select New gt XML Model Diagram e Right click the background of any diagram and select Diagram gt New Diagram To create anew XSM with an XML diagram select File gt New Model choose to create an XML model from the Model type list choose XML Model Diagram and click OK Note The Symbol gt Group Symbols feature is only avai
46. SYBASE XML Modeling PowerDesigner 15 3 Windows DOCUMENT ID DC20014 01 1530 01 LAST REVISED November 2010 Copyright 2010 by Sybase Inc All rights reserved This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or technical notes Information in this document is subject to change without notice The software described herein is furnished under a license agreement and it may be used or copied only in accordance with the terms of that agreement To order additional documents U S and Canadian customers should call Customer Fulfillment at 800 685 8225 fax 617 229 9845 Customers in other countries with a U S license agreement may contact Customer Fulfillment via the above fax number All other international customers should contact their Sybase subsidiary or local distributor Upgrades are provided only at regularly scheduled software release dates 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 Sybase trademarks can be viewed at the Sybase trademarks page at Attp www sybase com detail id 1011207 Sybase and the marks listed are trademarks of Sybase Inc A indicates registration in the United States of America Java and all Java based marks are trademarks or registered trademarks of Sun Microsystems
47. 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 property sheet XML Modeling 17 Data Types 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 E Customer Directory Diagram_1 Elements E Customer A sequence E Name E Job Address Shortcut Customer CUSTOMER Job JOB_TYPE Address Shortcut 6 EA Complex Types DENS H Corporate Directory Fil Diagram_1 Elements E Address a a Complex Types Job Type 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 18 PowerDesigner CHAPTER 2 Building XML Diagrams SI Workspace B Tree_structure Diagram_1 is fas B E XML_declaration XML_declaration I sequence XML_DECLARATION E Encoding_attribute E Standalone_attribute E Version_attribute a gt ML_document choice B E DTD_file B sequence E E
48. Simple Types Ea Complex Types Elements Achievement SE Groups E E H E Descriptio G XML Diagram Objects PowerDesigner supports all the objects necessary to build XML diagrams 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 Element Element The basic object of an XML model An element can Element contain other elements or attributes See Elements XSM on page 18 Any B Any type of object Can only be attached to a sequence or a choice group particle See Any Elements XSM on page 33 Attribute N A Additional 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 35 Group A group of elements arranged by a group particle De fined once and reused through references See Groups XSM on page 48 14 PowerDesigner CHAPTER 2 Building XML Diagrams Attribute A group of attributes defined once and reused in the Group model thr
49. XSM on page 33 Tab N A Content 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 24 PowerDesigner CHAPTER 2 Building XML Diagrams XDR element Description attribute Order Specifies how child elements are organized within a parent element Possible values are e seq sequence group particle e one choice group particle e 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 To specify the minimum number of occurrences for a local element Usually set to Oor Tab Detail Field Minimum maxOccurs local elements only To specify the maximum number of occurrences for a local element Usually set to or unbounded Tab General Field Maximum Example of an XDR file lt xml version 1 0 encoding UTF 8 gt lt schema name XDR_elements xm ns urn schemas microsoft com xml data xm1ns dt urn schemas microsoft com datatypes gt lt ElementType
50. al correction In the attribute property sheet define a data type with the Type list or the Browse tool Automatic correction None PowerDesigner provides default model checks to verify the validity of notations Check Description and Correction Notation name and code Notations names and codes must be unique in the model uniqueness Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Undefined notation 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 XML Modeling 89 Attribute Group Checks PowerDesigner provides default model checks to verify the validity of attribute groups Attribute group name and code uniqueness Undefined reference Existence of attributes Import Checks Description and Correction 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
51. and a column name is associated with each attribute or child element of the Root element An XML model targeted with DTD allows you to generate DAD files for IBM DB2 1 Map an XSM toa 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 Wizard on page 97 2 if you do not use the wizard Attach the IBM DB2 DAD extension file To enable these extensions in your model select Model gt Extensions click the Import tool select the IBM DB2 DAD file on the XML in Database tab and click OK to attach it 3 Further specify the mappings with extended attributes see DB2 Extended Attributes for Global Elements on page 108 4 optional Click the Preview tab of the Root element property sheet and select the DB2XMLExtender 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 5 Generate the annotated schema see Generating a DB2 DAD file on page 108 XML Modeling 107 DB2 Extended Attributes for Global Elements 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 Text zone where each line describes a namespace couple name value The sepa
52. ated editor lt xml version 1 0 encoding UTF 8 gt lt xsischema xmlns xs http Avww w3 org 2001 xMLSchema xmIns sq urn schemas microsoft com mapping schema gt lt xs element _name Root sql is constant L gt lt xs comp TexType gt lt xs Sequence gt lt xsrelement_name DEPARTMENT sql relation DEPARTMENT gt lt xs complexType gt lt xs Sequence gt lt xs element name EMPLOYEE sql relation EMPLOYEE gt lt xs annotation gt lt xs appinfo gt lt sql relationship parent DEPARTMENT parent key DEPNUM child key DEPNUM child EMPLOYEE gt lt xs appinfo gt lt xs annotation gt lt xs complexType gt lt xs attribute name DEPNUM type xs int sql field DEPNUM gt lt xs attribute gt lt xsiattribute name EMPID type xs int sql field EMPID gt lt xs attribute gt lt xsiattribute name FIRSTNAME type xs string sql field FIRSTNAME gt lt xs attribute gt lt xsiattribute name LASTNAME type xs string sql field LASTNAME gt lt xs attribute gt lt xs complexType gt lt xs element gt lt xs sequence gt lt xsiattribute name DEPNUM type xs int sql field DEPNUM gt lt xs attribute gt lt xsiattribute name DEPNAME type xs string sql field DEPNAME gt lt xs attribute gt lt xs complexType gt lt xs element gt lt xs sequence gt lt xs complexType gt lt xs element gt lt xs schema gt Note the SQL namespace with the sql prefix
53. atic correction None Simple Type List Checks PowerDesigner provides default model checks to verify the validity of simple types Description and Correction Undefined base type You must define a base type when you derive a simple type by list Manual correction In the simple type property sheet click the Prop erties 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 94 PowerDesigner CHAPTER 4 Checking an XSM Simple Type Union Checks PowerDesigner provides default model checks to verify the validity of simple type unions Undefined base type Annotation Checks Description and Correction 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 PowerDesigner provides default model checks to verify the validity of annotations 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
54. chema 1 selector 41 45 stereotype 45 XPath 45 Sequence group particle 29 shortcut check model 84 managing external shortcuts through references and data types 17 simple content 60 XML Modeling 113 Index simple type 55 check model 86 create 55 derive by list 66 derive by union 67 derived by list 55 derived by restriction 55 derived by union 55 list check 94 properties 56 union check 95 SQL XML query in XML model 97 99 stereotype 41 45 U attribute group 52 constraint field 45 group 48 unique constraint 41 union member types 67 properties 67 unique 41 X check model 93 field 41 properties 41 selector 41 stereotype 41 XDR 1 any 33 AttributeType 37 xem 11 XML diagram 13 model 1 objects 14 XML diagram attribute 35 create 17 element 18 entity 70 import 72 include 72 notation 69 redefine 72 XPath 45 abbreviated syntax 45 expressions 45 XSD 1 XSM 1 changing 10 check model 83 create 4 edit definition file 10 functional overview 1 114 PowerDesigner
55. 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 xs string USaddress state ADDRESS F SE fxsctoken USaddress is a derivation by extension of the address complex type The generated schema is the following XML Modeling 61 lt xml version 1 0 encoding UTF 8 7 gt lt xsischema xmins xs http www w3 org 2001 xMLSchema gt lt xsicomplexType name ADDRESS gt lt xs i sequence lt xs element name STREET type xs string gt lt xs element name CITY type xs string gt lt xs element name COUNTRY type xs istring gt lt xs sequence sxs icomp lextype gt lt xsicomplexType name USADDRESS gt lt xs complexcontent gt lt xsiextension base ADDRESS gt lt xs i sequence lt xs element name STATE type xs token gt lt xs sequence gt lt xs rextension gt lt xs complexcontent gt lt xs complexType gt lt xsischema gt 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 and complete the following properties ID ID of the extension Its value must be of type ID and unique within the model containing the extensi
56. ctions The General tab contains the following properties Schema loca URI reference for the location of a schema file with an external namespace You can tion 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 ID of the instruction Its value must be of type ID and unique within the schema containing the instruction ae only URI reference for the namespace to import For example xml order Comment Comment Descriptive label of the instruction Descriptive label of the instruction of the instruction XML Modeling 73 Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Items Tab This tab is available for redefines only and lists the items to be redefined The following tools are available 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 Redefine Property Sheet Items Tab The Items tab lists the items to be redefined a pe 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
57. d controlling the attributes and collections displayed on object symbols see Display Preferences in Chapter 8 Customizing Your Modeling Environment of the Core Features Guide Viewing and Editing the XML Language Definition File Each XSM is linked to a definition file that extends the standard PowerDesigner metamodel to provide objects properties data types and generation parameters and templates specific to the language being modeled Definition files and other resource files are XML files located in the Resource Files directory inside your installation directory and can be opened and edited in the PowerDesigner Resource Editor Warning We strongly recommend that you make a back up of the resource files delivered with PowerDesigner before editing them To open your model s definition file and review its extensions select Language gt Edit Current Language For detailed information about the format of these files see Chapter 1 Resource Files and the Public Metamodel in Customizing and Extending PowerDesigner Note Some resource files are delivered with Not Certified in their names Sybase will 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 t
58. de on generic objects available in all model types see Checking a Model in the Models chapter of the Core Features Guide Group Particle Checks PowerDesigner provides default model checks to verify the validity of group articles Description and Correction Existence of particle 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 XML Modeling 83 Invalid cardinality Model Checks Description and Correction 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 prop erties Automatic correction None PowerDesigner provides default model checks to verify the validity of models built on a schema Check Description and Correction Identifier uniqueness Undefined identifier Shortcut code uniqueness Undefined target namespace Missing namespaces Two or more objects cannot have the same identifier 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 s
59. defined reference A group without a name or a code must have a reference Manual correction In the group property sheet define a refer ence with the Reference list or the Browse tool Automatic correction None Existence of group particle A group must contain elements groups group particles and or Any Manual correction Add items to group or delete group Automatic correction None Invalid cardinality only available for model targeted with XDR You should define a minimum 0 or 1 and a maximum cardinality 1 or unboun ded for a group particle occurrence Manual correction Double click the group particle symbol and type a value for Minimum 0 or 1 and Maximum 1 or unboun ded properties Automatic correction None 88 PowerDesigner Attribute Checks CHAPTER 4 Checking an XSM PowerDesigner provides default model checks to verify the validity of attributes Attribute name and code uniqueness Undefined reference Undefined type Notation Checks Description and Correction 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 Manu
60. desrireirsineisoini neenake esae ok 93 R stri tion CHECKS 33 os cca assiuaegeratdevesssaseesi evasecavewerte 94 Simple Type List CHECKS ssesesseceesececeesecoececseceeceo 94 Simple Type Union Checks ccccccccccccccccccccceccscees 95 Annotation CHECKS ies cicisisicsing s teoseid eea boosie svavevuedaves 95 CHAPTER 5 Working with XML and Databases 97 Mapping Database Objects to an XML Schema Via the XML B ild r Wizarda ereen e rap ea o es tinted teases tenes 97 Generating an SQL XML Query File sessessecsecsecsecoe 99 Generating an Annotated Schema for Microsoft SQL SEIVGN enoi mee E ERE eee i 100 Generating the SQL Server Annotated Schema File 102 Generating an Annotated Schema for Oracle 9i2 103 Oracle Extended Attributes for Elements and ACtriDUteS si cc ssveseysddccveesacdecdecesacdececcecdscests 104 Generating the Oracle Annotated Schema File 106 Generating a DAD File for IBM DB2 seceeeeees 107 DB2 Extended Attributes for Global Elements 108 Generating a DB2 DAD File cece eee ee eee 108 vi PowerDesigner Contents XML Modeling Vii Contents viii PowerDesigner CHAPTER 1 Getting Started with XML Modeling An XML model XSM helps you analyze an XML Schema Definition XSD Document Type Definition DTD or XML Data Reduced XDR file You can model reverse engineer and generate each of these file formats XML or eXtensible
61. e model by various elements e 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 lt schema gt tag root element See Creating an attribute group on page 53 e A reference 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 an attribute group on page 54 For example 52 PowerDesigner CHAPTER 2 Building XML Diagrams B SD_attributeGroup Fal Diagram_1 H A Attribute Groups a Attributes guarantee qualityStandards g Elements E E product 2 A 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 e Generated XSD file lt xml version 1 0 encoding UTF 8 7 gt lt xsischema xmins xs http www w3 org 2001 xmMLSchema gt lt xsiattributeGroup name quality gt lt xstattribute name qguarantee gt lt xs tattribute gt lt xsiattribute name qualitystandards gt lt xstattribute gt lt xs tattributeGroup gt lt xs element name producta gt pias eomp acta Bsa lt xsiattributecroup ref quality gt lt
62. elect Unqualified Form is not required to be qualified with the namespace prefix and is matched against the no colon name of the attribute ID of the attribute Its value must be of type ID and unique within the model con taining the attribute PowerDesigner CHAPTER 2 Building XML Diagrams Attribute Property Sheet Values Tab 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 Note In a model targeted with the XML Data Reduced language there is also a Values tab in the element property sheet Defining Attributes in XDR Files In an XML Data Reduced language model attributes tags are defined by different attributes attribute name Specifies the name of the attribute Tab General Field Name default Specifies a default value for the attribute Tab Detail Field Default 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 General Field Values type Specifies the name of a global attribute as a reference for a local attribute Tab General Field Reference The following example shows an XDR file lt xml version 1 0 encoding UTF 8 7 gt lt Schema name XDR_attributes xmIns urn schemas microsoft com xml data xmins dt urn schemas microsoft com datatypes gt lt aAttributeType name qglobalattribute gt l
63. ement 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 XML Modeling 101 use cdata 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 4 optional Click the Preview tab of the model property sheet to preview the annotated schema 5 Generate the annotated schema see Generating the SQL Server Annotated Schema File on page 102 Generating the SQL Server Annotated Schema File You generate the annotated schema file by selecting it as an additional target for standard schema generation 1 Select Language gt Generate schemaFile 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 Iof x Directory l lol V Check model Targets v XML in Database Microsoft SQL Server annotated SD Cancel Apply Help 102 PowerDesigner CHAPTER 5 Working with XML and Databases 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 associ
64. encing 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 54 PowerDesigner CHAPTER 2 Building XML Diagrams Attributes Tab This 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 page 37 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 e List contains a white space separated list of values of an inherited simple type e Restriction has a range of values restricted to a subset of those of an inherited simple type e Union contains a union of values of two or more inherited simple types For more information on simple type derivations see Derivations Extensions Restrictions Lists and Unions XSM on page 61 Once
65. enerate a bean class with this name instead of gen erating 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 to this XML element declaration Model Extended Attributes The following annotations can be specified on the Extended Attributes tab of the property sheet of the model mapUnboundedStringToLob If true unbounded strings are mapped to CLOB by default Similarly unbounded binary data get mapped to BLOB by default If false unbounded strings are mapped to VAR CHAR2 4000 and unbounded binary components are map ped 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 XML Modeling 105 Generating the Oracle Annotated Schema File You generate the annotated schema file by selecting it as an additional target for standard schema generation 1 Select Language gt G n rate 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 iof x Directory CATEMP MV Check model Targets v XML in Database Oracle XML DB 9 2 annotated SD 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 ope
66. erarchy by dragging and dropping tables and or columns from the left pane to the right pane or by using the tools above the panes XML Modeling 97 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 Element Attribute Tables 4 7 Department lt S sequence Employee E Department E Views Attributes 3 6 sequence E E Employee E Attributes Name ID Function gt For detailed information about using the wizard see Generating an XSM froma 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 H Tables o XML_madel iE Diagram_1 B Elements B E Root ES sequence E E Department E sequence Name xs string Name xsistring B E Employee ID xs decimal ID xsidecimal Attributes Location xs string Function xs string Name ID Function GM Attributes In the case of an existing XML model the generated elements appear alongside the existing elements Note The SQL XML extension file is automatically attached to the generated XML model You can optionally attach
67. ersion 1 0 encoding UTF 8 7 gt lt xsischema xmlns xs http www w3 org 2001 xMLSchema gt lt xsiredefine id REDEF1 schemaLocation CUSTOMERS xsd gt sxs group name PRIVILEGED_CUSTOMERS gt lt xsitall gt lt xs element name CUSTOMER_1 gt lt xs element name CUSTOMER_2 gt lt xs element name CUSTOMER_3 gt lt xsitall gt lt xs igroup gt lt xsicomplexType name PRIVILEGE gt lt xs comp lexType gt lt xs redefine gt lt xs ischema gt Creating an Import Include or Redefine Instruction You can create an import include or redefine instruction in any of the following ways e Select Model gt Import Include or Redefine to access the relevant list and click the Adda Row tool e Open the External Schemas tab in the property sheet of the model and click the Add Import Add Include or Add Redefine tool e Right click the model or package in the Browser and select New gt Import Include or Redefine 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 its 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 instru
68. et see Previewing XML Code on page 8 Note The PowerDesigner generation system is extremely customizable through the use of extensions see Extending your Modeling Environmenton page 11 For detailed information about customizing generation including adding generation targets options and tasks see Chapter I Resource Files and the Public Metamodel in Customizing and Extending PowerDesigner 1 Select Language gt Generateschema File to open the Generation dialog XML Modeling 75 Directory C TEMP XSD_files IV 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 Chapter 4 Checking an XSM on page 83 Note When generating an XDR file the Generation dialog contains an Options tab where you can specify whether or not to generate comments within a lt description gt 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 i XMLMODEL_2 xsd Notepad Of x File Edit Format Help lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 200
69. ey will make to the model see Chapter 7 Comparing and Merging Models in the Core Features Guide 6 Click OK to merge the selected changes into your model 7 optional Select Symbol gt Auto Layout to organize the new symbols in your diagram Generating Other Models from an XSM You can generate physical data models PDMs and other XSMs from an XSM 1 Select Tools and then one of the following commands to open the appropriate Model Generation Options window e Generate Physical Data Model Ctrl Shift P Generate XML Model Ctrl Shift M 2 On the General tab select a radio button to generate a new or update an existing model and complete the appropriate options 3 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 XML Modeling 79 4 optional Click the Target Models tab and specify the target models for any generated shortcuts 5 optional Click the Selection tab and select or deselect objects to generate 6 Click OK to begin generation Note For detailed information about the model generation feature see Chapter 10 Generating Models and Model Objects in the Core Features Guide The following table details how XSM objects are generated to PDM objects Elements Simple types Complex types Tables or columns Root elements are generated as tables N
70. fined version of the model This parameter is defined in the display preferences of the Title node XML language Specifies the model target Default diagram Specifies the diagram displayed by default when you open the model The following tabs are also available Detail XSD only Contains the following properties Target Name Specifies a URI as the namespace for all the model objects All the schema space elements with this prefix in their start tag will be associated with the namespace For example http www mycompany com myproduct XMLmodel Language Specifies the language used in the model For example en en GB en US de fr ID Specifies the ID of the model Its value must be of type ID and unique within the file containing the model For example XMOD1 Specifies defaults for the Form and Block and Final model object properties Items lists the model s global objects which have no parent symbol in the diagram and are directly linked to the lt schema gt tag 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 The following tools are available on this tab af apo ooo ape PowerDesigner CHAPTER 1 Getting Started with XML Modeling Add Simple Type XSD only Add Complex Type XSD only Add Notation a Add A
71. g 109 lt DOCTYPE DAD SYSTEM E dad dtd gt lt DAD gt lt validation gt Yes lt validation gt lt xcollection gt lt prolog gt xml version 1 0 lt prolog gt lt doctype gt DOCTYPE Root SYSTEM C TEMP DTD_files corporatemember ship dtd lt doctype gt lt root_node gt lt element_node name Root gt lt element_node name DEPARTMENT gt lt attribute_node name DEPNUM gt lt RDB_node gt lt table name DEPARTMENT gt lt column name DEPNUM type INTEGER gt lt RDB_node gt lt fattribute_node gt lt attribute_node name DEPNAME gt lt RDB_node gt lt table name DEPARTMENT gt lt column name DEPNAME type VARCHAR 254 gt lt RDB_node gt lt fattribute_node gt lt element_node name EMPLOYEE gt lt attribute_node name DEPNUM gt lt RDB_node gt lt table name EMPLOYEE gt lt column name DEPNUM type INTEGER gt lt RDB_node gt lt fattribute_node gt e DAD file defined with Xco umn as StorageType lt xml version 1 0 gt lt DOCTYPE DAD SYSTEM E dad dtd gt lt DAD gt lt validation gt yves lt validation gt lt xcol umn gt lt table name DEPARTMENT key DEPNUM orderBy DEPNUM DEPNAME gt lt column name DEPNUM type INTEGER path DEPARTMENT DEPNUM multi_occurrence No gt lt column name DEPNAME type VARCHAR 254 path DEPARTMENT DEPNAME multi_occurrence No gt lt table gt lt table name EMPLOYEE key EMPID order
72. g spaces are removed You can optionally click the Properties tool to the right of each field to open the property sheet of the facet and enter the following properties ID ID of the facet Its value must be of type ID and unique within the model con taining the facet Value s of the facet To prevent a modification of the facet value s select the Fixed property optional simple type restrictions only Click the Enumerations tab and enter a set of acceptable values Select the F ixed check box 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 64 PowerDesigner CHAPTER 2 Building XML Diagrams Restriction Properties OF x Annotation Dependencies Version Info General Detail Enumerations Patems ao aex X Team lt lt Less E v Cancel Apply Help Generated schema lt xsisimpleType name MEETINGS gt lt xsirestriction base xs gMonthDay gt lt xs enumeration value 01 20 gt lt xs enumeration value 03 20 gt lt xs enumeration value 05 20 gt lt xsi enumeration value 07 20 gt lt xs enumeration gt lt xs restriction gt lt xs simpleType gt 5 optional simple type restrictions only Click the Patterns tab and enter one or more sequences of acceptable values Select the F ixed check box to preven
73. he XML Builder Wizard on page 97 If need be you can still modify the mapping through the Mapping tab of elements and complex types property sheets To manually enable the SQL XML extensions in your model select Model gt Extensions click the Import tool select the SQL XML file on the General Purpose tab and click OK to attach it Warning The following procedure assumes you have an XML model open in the workspace and mapped to a PDM Generated SQL XML queries cannot be parameterized 1 Select Tools gt Generate SQL XML Queries to open the Generation dialog box 2 Specify the directory in which to generate the file Click the Selection tab and specify which of the global elements you want to generate queries from A separate file will be generated for each global element selected Click OK to begin the generation The Result dialog box is displayed with the path of the query file selected Click Edit to open the generated query file in your associated editor XML Modeling 99 select lt xml version 1 0 encoding UTF 8 gt XMLELEMENTC NAME Root select XMLAGG C XMLELEMENTC NAME DEPARTMENT XMLATTRIBUTES CDEPARTMENT DEPNUM select XMLAGG C XMLELEMENTC NAME EMPLOYEE XMLATTRIBUTES CEMPLOYEE DEPNUM AS from EMPLOYEE where DEPARTMENT DEPNUM EMPLOYEE DEPNUM from DEPARTMENT Generating an Annotated Schema for Microsoft SQL Server Microsoft SQL Server is an XML enabled database se
74. hortcuts with the same code cannot be in the same name space Manual correction Change the code of one of the shortcuts Automatic correction None 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 84 PowerDesigner CHAPTER 4 Checking an XSM Data Source Checks PowerDesigner provides default model checks to verify the validity of data sources Check Description and Correction Data source name and code Data sources names and codes must be unique in the model uniqueness Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Existence of model 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 Data source containing models The models in a data source represent a single set of information with different Object Language or This is why the models in the data source should share the same DBMS types DBMS
75. in the current complex type that will be mapped to PDM abstract data type attributes or OOM class attributes Once you have selected the attributes you can use the list in the Mapped to column to select corresponding PDM abstract data type attributes or OOM class attributes z Create from Sources Copies PDM abstract data type attributes or OOM class attributes in the data source to the current complex type attributes Generate Mapping Automatically generates a mapping between PDM abstract data type attributes or OOM class attributes and complex type attributes with the same name or code in the data source and the current model For detailed information about mappings see Chapter 12 Object Mappings in the Core Features Guide The following tabs are also available e Attributes lists the attributes and attribute groups associated with the complex type see Attributes XSM on page 35 Linking 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 automatically create a link between both objects The following table lists the allowed links 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 Gpe If you click a co
76. ion about creating objects see the Objects chapter in the Core Features Guide Entity Properties 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 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 ora non XML file For example http something com pictures logo gif 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 picture Viewer Notation Used to define and process non XML objects within an XML model XML Modeling 71 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 can then be easily changed within the DTD Instructions Import Include and Redefine XSM 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 Imports An
77. ions folder The General tab contains the following properties 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 con taining the notation 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 picture Viewer Entities XSM 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 Anentity reference is the entity name preceded by an ampersand and followed by asemicolon For example amp furtherinfo will be replaced by For further information see The W3C has predefined five entities for XML tags 70 PowerDesigner CHAPTER 2 Building XML Diagrams a In an XML model you just need to type the name and the value of an entity Creating an Entity You can create an entity in any of the following ways e Select Model gt Entities to access the List of Entities and click the Add a Row tool e Right click the model or package in the Browser and select New gt Entity For general informat
78. its property sheet OH If you click a group symbol with the Anytool a sequence group particle and an any symbol are created You can modify the group particle via its property sheet C FL XML Modeling 51 To Ta If you click a group symbol with the Group tool a sequence group particle and a refer encing group are created You can modify the group particle via its property sheet You must now select a group for the reference C 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 C If you click a group symbol with the Choice tool a choice group particle is displayed linked to the group symbol C 0 If you click a group symbol with the A tool an all group particle is displayed linked to the group symbol Note 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 Attribute Groups XSM Attribute groups are not supported by XDR An attribute group is a set of attributes which is referenced in th
79. l OOM or another XSM XML Modeling G XML Model R E Reverse Engineering GS Generation DTD XSD or XDR The structure of an XSM is described by a DTD an XSD or an XDR file DTD file XML document XDR file A DTD 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 lt xml version 1 0 encoding UTF 8 gt lt Project Management gt lt ELEMENT Database DIVISION EMPLOYEE CUSTOMER PROJECT TEAM MATERIAL PARTICIPATE MEMBER USED COMPOSE gt lt ELEMENT DIVISION EMPTY gt lt ATTLIST DIVISION DIVNUM DIVNAME DIVADDR lt ELEMENT EMPLOYEE EMPTY gt lt ATTLIST EMPLOYEE EMPNUM EMP_EMPNUM DIVNUM EMPF NAM EMPLNAM EMPFUNC EMPSAL CDATA CDATA CDATA gt CDATA CDATA CDATA CDATA CDATA CDATA CDATA gt An 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 PowerDesigner CHAPTER 1 Getting Started with XML Modeling lt xml version 1 0 encoding UTF 8 gt lt Project Management gt lt xsischema xmIns xs http www w3 org 2001 xMLSchema gt lt xs element name Database gt lt xs rcomplexType gt lt xs 1Sequence gt lt xs
80. l object If the new global object does not appear in the diagram select Symbol gt Show Symbols and click the corresponding tab to select the new global object e 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 e 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 e 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 gt Show Symbols and click the corresponding tab to select the new global object Example Converting a Local Object into a Global Object In the following example Job is a child element of the Customer element and Nickname is the attribute of the Name element Workspace H Customer Directory Diagram_1 GA Complex Types E Job Type gj Elements Address E E Customer ES sequence Address Shortcut ac E E Name G E Attributes nickname lt None gt Job JOB_TYPE Address Shortew iK Customer CUSTOMER The Job entry in the Browser is selected and dragged and dropped onto the model element
81. l Data 2 Technology Model Ga B Requirements and Planning a m 2j Model types p Physical Data UML Class Diagram MultiDimensional Data Templates physical data model PDM helps you to analyze the tables views and other objects in a database including multidimensional objects necessary for data warehousing 4 PDM is more concrete than a conceptual CDM or logical LOM data model You can model reverse engineer and generate for all the most popular DBMS s zi Model name Development PDM DBMS Sybase AS Enterprise 15 5 7 al Extensions m Cancel Help PowerDesigner CHAPTER 1 Getting Started with XML Modeling 1 Select File gt New Model to open the New Model dialog 2 Click a button and then select a category or model type XML Model in the left hand pane 3 Select an item in the right hand pane Depending on how your New Model dialog is configured these items may be first diagrams or templates on which to base the creation of your model Use the Views tool on the upper right hand side of the dialog to control the display of the items 4 Enter a model name The code of the model which is used for script or code generation is derived from this name using the model naming conventions 5 Select a target XML language which customizes PowerDesigner s default modifying environment with target specific properties objects and generation templates By default PowerDesigner
82. l or its Browser entry beneath its parent object XML Modeling 31 The following sections detail the property sheet tabs that contain the properties most commonly entered for group particles The General tab contains the following properties 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 unlimited number of times select unbounded ID ID of the group particle Its value must be of type ID and unique within the model containing the group particle Items Tab This tab list the child elements associated with the group particle You can add additional children directly on this tab using the following tools EW 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 mu
83. lable for free symbols in an XML diagram Note Right click a symbol in an XML diagram and select one of these features Expand the hierarchy below a symbol is partially expanded only the first level Expand AJI the hierarchy below a symbol is fully expanded all levels Colapse 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 Element Properties on page 21 You can define external shortcuts for any global object with no parent object in the diagram except for imports includes redefines and annotations 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 References 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
84. lass attributes to the element attributes using following tools on the Attributes Mapping tab a Add Mapping Selects 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 Mapped to column to select corresponding PDM columns or OOM class attributes XML Modeling 23 a Create from Sources Copies PDM columns or OOM class attributes in the data source to the current element attributes H Generate Mapping Automatically generates 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 For more information on complex type mapping see Chapter 12 Object Mappingsin the Core Features Guide The following tabs are also available e Attributes lists the attributes and attribute groups associated with the element see Attributes XSM on page 35 e Constraints lists the constraints associated with the element see Constraints Keys Uniques and KeyRefs XSM on page 41 XDR Specific Element Properties In a model targeted with the XML Data Reduced language elements are defined by different attributes XDR element Description attribute Model Specifies if an element can contain new local elements Possible values are e closed default e open if an Any element is attached to the element See Any Elements
85. lect a group particle from the Group type list For general information about creating objects see the Objects chapter in the Core Features Guide Creating a Group Particle from the Palette You can create a group particle with the Group Particle tool in 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 e Element_1 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 3 Right click in order to recover the Pointer Element_1 Element_1 Note 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 30 PowerDesigner CHAPTER 2 Building XML Diagrams Creating a Group Particle from the Property Sheet of an Element You can create a group particle from the property sheet of a
86. lements 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 21 You can derive an XSD element data type to extend or restrict its values see the Derivation property in Element Properties on page 21 Creating an Element You can create an element in any of the following ways e Use the Element tool in the diagram Palette e Select Model gt Elements to access the List of Elements and click the Add a Row tool e Right click the model or package in the Browser and select New gt Element 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 following properties for XDR element properties see the subsequent table 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 Com
87. les XMLMODEL_5 xsd E v Show symbols IV Expand nodes Display filter MV Show elements M Show complex types IV Show groups IV Show simple types IV Convert unique references to elements Cancel Help 5 On the Options tab specify the file you want to reverse engineer and select any appropriate options XML Modeling 77 option oen O OOOO Show sym Creates symbols for the reversed objects in the diagram If you select to show bols 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 models as expand unique refer able nodes instead of simple shortcuts Since global objects with a single ref ences to ele erence in the model will be converted into child objects you should not use this ments option if you want to keep the global scope of some objects You can subse quently perform this conversion by selecting Tools gt Convert Unique Refer ences in the XML model 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
88. loyee Automatic correction Deletes unassigned keyRef For more information on fields see Specifying Constraint Fields on page 45 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 em ployee Automatic correction None For more information on XPath expressions see Specifying a Con straint Selector on page 45 92 PowerDesigner Unique Checks CHAPTER 4 Checking an XSM PowerDesigner provides default model checks to verify the validity of uniques Check o Description and Correction Unique name and code uniqueness Existence of fields Undefined Selector Extension Checks 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 Specifying Constraint Fields on page 45 You must define an XPath expression for a unique constraint selector attribute Manual correction In the unique constraint property sheet define an XPath expression for the unique constraint
89. mEmployee attribute must be unique or null within the employee element e A Keyconstraint 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 IPROJECT code xs positivelnteger Generated schema lt xml version 1 0 encoding UTF 8 gt lt xsischema xmIns xs http Awww w3 org 2001L xMLSchema gt lt xs element name PROJECT gt lt xs complexType gt lt xs sequence lt xs element name EMPLOYEE gt lt xs element name PRODUCT gt lt xs i complexType gt lt xsiattribute name CODE type xs positivelnteger gt lt xstattribute gt lt xs icomplexType gt lt xs element gt lt xs 1sequence gt lt xs complexType gt lt xsikey name KEYCODE gt lt xsiselector xpath product gt lt xsifield xpath G code gt lt xsikey gt lt xs element gt lt xs schema gt 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 e A KeyRefconstraint 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 42 PowerDesigner CHAPTER 2 Building XML Diagrams gold xs boolean
90. me Fax Phone lt xs element id CPH name CellPhone lt xsiall gt x XSD File l More gt gt Sj OK Cancel Apply Help Me Cancel fon Hee You can use the following tools and keyboard shortcuts from the Preview toolbar Editor Menu Shift F11 Provides access to various editor features including the insertion of and navigation through bookmarks in the Preview tab Toggle Bookmark Ctrl F2 Inserts or removes a bookmark a blue box at the cursor position Next Bookmark F2 Previous Bookmark Shift F2 Note that bookmarks are not printable and are lost if you refresh the tab 8 PowerDesigner CHAPTER 1 Getting Started with XML Modeling Refresh F5 Refreshes the Preview tab You can debug the GTL templates that generate the code shown in the Preview tab To do so open the target or extension resource file select the Enable Trace Mode option and click OK to return to your model You may need to click the Refresh tool to display the templates Select Generation Targets Ctrl F6 Lets you select additional generation targets defined in extensions and adds a sub tab for each selected target For information about generation targets see Specifying Additional Generation Targets in Chapter 1 Resource Files and the Public Metamodelin Customizing and Extending Pow erDesigner Customizing your Modeling Environment The PowerDesigner XML model provides various means fo
91. men Descriptive label of the element Descriptive label of the element of the element Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined XML Modeling 21 Reference 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 ref erence 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 Group type Specifies that the element has child elements and how they are used see Group Particles XSM on page 29 You can choose between e all All children may be present e choice Only one child must be present e group Reference to a predefined group see Groups XSM on page 48 e sequence All children must be present in order element Embedded XSD only Locally defined data type It applies to the current element only Au type tomatically set to Complex if you define a derivation for the element da
92. 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 XML Modeling 57 Name Name of the complex type which must be a no colon name and unique among all simple types and complex types Code Code of the complex type which must be a no colon name and unique among all ee types and complex types Commem Descriptive Descriptive label of the complex type of the Descriptive label of the complex type type Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Group type Specifies that the complex type has child elements and how they are used see Group Particles XSM on page 29 You can choose between all All children may be present choice Only one child must be present group Reference to a predefined group see Groups XSM on page 48 sequence All children must be present in order Content Content type of the complex type see Specifying the Type of Content ofa Complex Type on page 60 Derivation Derivation method for the complex type Once you have selected a derivation method you must define a base type Click the Pro
93. mplex type symbol with the Any tool a sequence group particle and an any symbol are created You can modify the group particle via its property sheet CH XML Modeling 59 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 GCs 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 CoP el ies TO T If you click a complex type symbol with the Choice tool a choice group particle is A e ial displayed linked to the complex type symbol If you click a complex type symbol with the A tool an all group particle is displayed linked to the e complex type symbol ae Note 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 Specifying the Type of Content of a Complex T A complex type can contain either 1 Open
94. n 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 fElement_1 e 2 Click an empty space in the diagram to deselect the element and then click the Expand tab to reveal the group particle symbol in this case a sequence Element_1 fone O Note that you can click the Co apse 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 fence 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 Note Child elements are defined within the namespace of their parent element Therefore there cannot be a conflict between a parent and a child name Element_1 Element_1 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 symbo
95. n the generated annotated schema in your associated editor lt xml version 1 0 encoding UTF 8 gt lt xs schema xmins xs http www w3 arg 200L xmMLschema xmins sql http xmins oracle com xdb gt lt xs element name Branch sq1 SQLName branch gt lt xs complexType gt lt xs Sequence gt lt xs element name Department type DepType sq1 SQLName office gt lt xs sequence gt lt xs i complexType gt lt xs element gt lt xs complexType name DepType sql saLType officeType gt lt xsicomplexType gt lt xs ischema gt 106 PowerDesigner CHAPTER 5 Working with XML and Databases Note the Oracle namespace with the sql prefix and annotations for tables sql SQLName and ADTs sql SQLType 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 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
96. n the schema and validate any attribute of the specified namespaces Constraints Keys Uniques and KeyRefs XSM 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 e A Uniqueconstraint specifies that an element or an attribute value or set of values must be unique or null within a specified scope For example project numEmployee xs string PROJECT Generated schema XML Modeling 41 lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001 xmMLSchema gt lt xs element name PROJECT gt lt xs complexType gt lt xs sequence gt lt xs element name EMPLOYEE gt lt xs rcomplexType gt lt xsiattribute name NUMEMPLOYEE type xsistring gt lt xstattribute gt lt xsicomplexType gt lt xs element gt lt xs element name PRODUCT gt lt xs sequence lt xs icomplexType gt lt xsiunique name UNIQUENUM gt lt xsiselector xpath employee gt lt xs field xpath Gnumemployee gt lt xs tunique gt lt xs element gt lt xsischema gt The UNIQUENUM unique constraint defined on the project element specifies that the nu
97. nnotation XSD only External Schemas XSD only Allows you to link to and reuse in your model global objects from other schemas The following tools are available on this tab Add Include Add Import Add Redefine Add Annotation e Namespaces XSD and XDR only Lists the namespaces used to declare objects used in the model e Preview Displays a preview of the XSD DTD or XDR file generated from the XSM XML Modeling 7 Previewing XML Code Click the Preview tab in the property sheet of the model elements and various other model objects in order to view the code that will be generated for it E Element Properties Resume Resume Oo x General Detail Attributes Constraints Annotation Notes Preview S M a9 4 an 2 inico lt xs element id RES name Resume gt lt xs complexType gt lt xsisequence id SQ5 maxOccurs 1 minOccurs 1 gt lt xs element id JBREF name jobReference maxOccurs lt xs element id CONT name Contact maxOccurs 1 mit lt xs complexType gt lt x3 sequence id SQ1 maxOccurs 1 minOccurs _ lt xs element id FN name FirstName maxOccu lt xs element id LN name LastName maxOccur lt xs element id PADD name PersonAddress mi lt xs element id PH name Phone maxOccurs lt xs complexType gt lt xsi all id ALL1 gt lt xs element id HPH name HomePhone lt xs element id 0PH name O0fficePhe lt xs element id FPH na
98. nt property sheet double click its diagram symbol or its Browser entry beneath its parent object The General tab contains the following properties Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined Minimum Minimum number of times the Any can occur To specify that the Any is optional set this attribute to zero Maximum Maximum number of times the Any can occur For an unlimited number of times select unbounded ID 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 34 PowerDesigner CHAPTER 2 Building XML Diagrams Namespace 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 ocal objects that are not qualified with a namespace can be used If you select target Namespace objects from the target namespace of the schema can be used 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 Process con Indicator of how an XML processor should handle validation of XML documents tents containing the objects specified by the
99. nt 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 gen erating a name from the element name columnProps 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 defaultTable 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 javaClassname Used to specify the name of a Java class that is derived from the corre sponding 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 maintainDOM If true instances of this element are stored so that they retain DOM fidelity on output This implies that all comments 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 maintainOrder If true the collection is mapped to a VARRAY
100. o assist Sybase by testing fixes of the definition provided by Sybase and report any continuing inconsistencies Changing the XML Language You can change the XML language being modeled in your XSM at any time 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 In this example HighDefinition is a global complex type reused as data type for the deluxeTV element e In the model with target XSD Fean a fae deluxeTV highDefinition deluxe TY 10 PowerDesigner CHAPTER 1 Getting Started with XML Modeling e The model target is changed to DTD or XDR dolbyStereo deluxe TV fdeluxeTV Note You may be required to change the XML language if you open a model and the associated definition file is unavailable 1 Select Language gt Change Current Language Change XML Language gq x New XML language XML Schema Definition 1 0 z allal r Current XML language XML Data Reduced 1 0 Bl Cancel Help 2 Select a XML language from the list By default PowerDesigner creates a link in the model to the specified file To copy the contents of the resource and save it in your model file click
101. o its containing element 56 PowerDesigner CHAPTER 2 Building XML Diagrams The following illustration shows a diagram containing a complex type dolbyStereo flatScreen highDefinition deluxeTV highDefinition deluxe TV In the example above HighDefinition is a global complex type reused as data type for the deluxeTV element The generated schema is the following lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001 xMLSchema gt lt xsicomplexType name highDefinition gt lt xs i sequence lt xs element name dolbystereo gt lt xs element name fFlatScreen gt lt xs sequence gt lt xs complexType gt lt xs element name deluxeTv type highbefinition gt lt xsischema gt Warning Global complex types appear in the model as objects with their corresponding 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 e Use the Complex Type tool in the diagram Palette e Select Model gt Complex Types to access the List of Complex Types and click the Add a Row tool e Right click the model or package in the Browser and select New gt Complex Type For general information about creating objects see the Objects chapter in the Core Features Guide Complex Type Properties You can
102. olon name If specified it must be unique among all simple types and complex types Code Code of the simple type which must be a no colon name If specified it must be a among all simple types and complex types Comment Descriptive label of the simple type Descriptive label of the simple type of the simple type Stereotype 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 Fina Property to prevent derivation of the current simple type to prevent derivation Property to prevent derivation of the current simple type 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 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 e aglobal scope when it has no parent element in the diagram and when it is directly linked to the lt schema gt tag It can then be reused or derived by extension or restriction in other parts of the schema e a local scope when integrated into an lt element gt tag It applies only t
103. on Base Type Data type on which the extension is based 3 Specify an ID select a base type and then click OK to return to the element or complex type Deriving by Restriction You can derive an element simple type or complex type by restriction to restrict the values of their base type 1 Open the property sheet of an element simple type or complex type and select Restriction in the Derivation list 62 PowerDesigner CHAPTER 2 Building XML Diagrams Simple Type Properties barCode BARCODE Iof x Extended Dependencies Version Info Preview General Annotation Notes Rules Dependencies Name barCode Code BAR CODE E Comment Stereotype Derivation iestriction Final lt Undefined gt ID Cn lt lt Less E a7 Cancel Apply Help For elements and complex types 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 field to open the restriction property sheet and complete the following fields on the General tab 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 type If selected the base type disappears and a simple type is created in the schema simple
104. on root elements with complex types are generated as tables or columns depending on the option chosen in the Persistent group box on the Detail tab of the element property sheet Non root elements with primitive or simple types are generated as table columns Note Root elements with a primitive or simple type are not generated except where they are referenced by other elements or complex types If you have a single root element and want to generate its immediate children as tables select the Skip single root element option on the PDM Generation Options window Detail tab Domains The datatype of the domain depends on the derivation of the simple type simple types with a list derivation varchar simple types with a restriction derivation the datatype of the base type simple types with a union derivation the most permissive of the unioned types Merged with their parent element If the complex type is the restriction or extension of a simple type it will be generated as a column called Va lue linked to the domain generated from the simple type Columns with datatypes determined by resolving any derivation At tributes and attribute groups defined at the model level are not generated except where they are referenced 80 PowerDesigner CHAPTER 3 Generating and Reverse Engineering XML Schemas and Other Models Ea References if the referenced constraint is a key Note References substitutions import
105. ons at this level and each can contain multiple documentation and or application information tags e 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 e 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 Modeling 67 lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001 xmMLSchema gt lt xsSiannotation id ANNOTL gt lt xsidocumentation source attributes dtd xml ang en us gt lt xml version 1 0 encoding UTF 8 gt lt ELEMENT COMPANY CEMPLOYEES PRODUCTS CLIENTS gt lt gt lt ATTLIST COMPANY FOUNDATION CDATA STATUS CDATA gt lt ELEMENT EMPLOYEES EMPTY gt lt gt lt ATTLIST EMPLOYEES NUMBER CDATA gt lt ELEMENT PRODUCTS EMPTY gt lt gt lt ATTLIST PRODUCTS REFERENCES CDATA QUANTITIES CDATA gt lt ELEMENT CLIENTS EMPTY gt lt gt lt ATTLIST CLIENTS FIDELITY CDATA SOLVENCY CDATA gt lt xs documentation gt lt xsiappinfo source http www parsersandco com gt lt xs appinfo gt lt xs tannotation gt lt xs ischema gt This global annotation is composed of a documentation with a well formed XML content extract of a
106. ough references See Attribute Groups XSM on page 52 Simple Type XSD only Used in the case of elements or attributes with text only content See Simple Types XSM on page 55 Complex Type Complex XSD only Used to introduce elements or attributes within an element declaration See Complex Types XSM on page 56 Sequence s 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 29 Choice O This group particle arranges a set of elements from which one element must be chosen See Group Particles XSM on page 29 F This group particle arranges a set of elements where each element can appear or not in any order See Group Particles XSM on page 29 e wee Constraint XSD only Specifies uniqueness of element values See Constraints Keys Uniques and KeyRets XSM on page 41 An import include or redefine instruction See Jnstruc tions Import Include and Redefine XSM on page 72 Extends or restricts the values of elements and simple and complex types See Derivations Extensions Re strictions Lists and Unions XSM on page 61 Entity Provides documentation or application information See Annotations XSM on page 67 DTD only Specifies a predefined value or external XML or non XML file See Entities XSM on page 70 Defines and processes non XML objects within an XML model See Notations X
107. particle All 29 check model 83 Choice 29 create 30 properties 31 Sequence 29 IBM DB2 107 identity constraint 41 field 45 key 41 keyRef 41 selector 45 unique 41 import 72 check model 90 create 73 properties 73 include 72 check model 86 create 73 properties 73 key 41 112 PowerDesigner field 41 properties 41 selector 41 stereotype 41 key check model 91 keyRef 41 check model 92 field 41 properties 41 selector 41 stereotype 41 L link 16 child object to complex type 59 child object to element 26 child object to group 51 child object to group particle 32 child object to parent object 16 local objects 27 M manipulate XML objects graphically 27 member types 67 mixed content 60 model check model 84 copy XSM 4 create 4 model options 9 preview code 8 properties 5 share XSM 4 XML 1 XML language 4 model options 9 modeling environment customize 9 N namespace 33 40 node context node 45 root node 45 notation 69 Index check model 89 create 70 properties 70 O Oracle 9i2 103 P parent element 29 preview code 8 process contents 33 40 R RDB 97 redefine 72 check model 91 create 73 properties 73 reference 41 48 52 restriction check model 94 detail properties 62 reverse engineering options 77 target models 77 to existing XML model 78 to new XML model 77 XSD DTD or XDR file to existing XML model 77 XSD DTD or XDR file to new XML model 77 root node 45 S s
108. particle via its property sheet po B If you click an element symbol with the Group tool a referencing group is created You must now select a group for the reference Epc 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 e 26 PowerDesigner CHAPTER 2 Building XML Diagrams If you click an element symbol with the Choice tool a choice group particle is displayed linked to the element symbol If you click an element symbol with the A tool an all group particle is displayed linked to the element symbol a Note 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 elements in Tool column Manipulating XML Objects Graphically The graphical interface of PowerDesigner allows you to manipulate your XML schema by moving XML objects within the Browser within the diagram or by dragging them from the Browser into the diagram or from the diagram into the Browser Global Objects Note Select Tools gt
109. pe or attribute group click the Add Group with Reference to Group tool see Element Properties on page 21 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 The General tab contains the following properties Name unavailable to references to attribute groups Name of the attribute group which must be a no colon name Required when the attribute group is global Code unavailable to references to attribute groups Code of the attribute group which must be a no colon name Required when the attribute group is global Descriptive label of the attribute group Stereotype Sub classification used to extend the semantics of an object 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 which must be a qualified name If you select an attribute group from another model a shortcut is created with the refer
110. perties tool beside the derivation box to display the derivation property sheet In the General tab select a base type in the Base Type list Detail Tab The Detail tab contains the following properties Final Property to prevent derivation of the current complex type to prevent derivation Property to prevent derivation of the current complex type the current complex type Block Property to prevent another complex type with the specified type of derivation from being used in place 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 Abstract If selected this property indicates that the complex type can be used in the instance document ID ID of the complex type Its value must be of type ID and unique within the model containing this complex type 58 PowerDesigner CHAPTER 2 Building XML Diagrams Mapping Tab This tab lets you map the complex type to PDM or OOM objects You associate one or more PDM abstract data types or OOM classes to the complex type using the Add Objects tool on the Complex Type Sources sub tab You can associate PDM abstract data type attributes or OOM class attributes to the complex type attributes using following tools on the Attributes Mapping tab a Add Mapping Selects the attributes
111. queness 3 q Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Complex Type Checks PowerDesigner provides default model checks to verify the validity of complex types Complex type name and code Complex type names and codes must be unique in the model uniqueness q Manual correction Modify the duplicate name code Automatic correction Appends a number to the duplicate name code Existence of attribute A complex type should have at least one attribute Manual correction Define an attribute for the complex type Automatic correction None 86 PowerDesigner Element Checks CHAPTER 4 Checking an XSM Check Description and Correction Existence of particle 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 PowerDesigner provides default model checks to verify the validity of elements Element name and code unique ness Undefined type Undefined reference Existence of attribute Existence of particle Description and Correction 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 elemen
112. r customizing and controlling your modeling environment Setting XSM Model Options You can set XSM model options by selecting Tools gt Model Options or right clicking the diagram background and selecting Model Options You can set the following options on the Model Settings page Option Description S Name Code case Specifies that the names and codes for all objects are case sensitive allowing you sensitive to have two objects with identical names or codes but different cases in the same model If you change case sensitivity during the design process we recommend that you check your model to verify that your model does not contain any duplicate objects Enable links to Displays a Requirements tab in the property sheet of every object in the model requirements which allows you to attach requirements to objects see the Requirements Mod eling guide For information about controlling the naming conventions of your models see Naming Conventions in Chapter 8 Customizing Your Modeling Environment of the Core Features Guide Setting XSM Display Preferences PowerDesigner display preferences allow you to customize the format of object symbols and the information that is displayed on them To set XML model display preferences select Tools gt Display Preferences or right click the diagram background and select Display Preferences from the contextual menu XML Modeling 9 For detailed information about customizing an
113. raints on the Constraints tab of an element using one of the following tools FJ 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 XML Modeling 43 Add Unique Constraint The element value must be unique or null within the specified scope a Add KeyRef Constraint The element value corresponds to those of the specified key or unique constraint 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 an entity The General tab contains the following properties 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 constraint Its value must be of type ID and unique within the model containing the constraint Reference Name of a key or a unique constraint defined in the current model or another model KeyRef on with a specified namespace The Reference value must be a qualified name ly Selector An XML Path Language expression that selects a set of elements across which the XPath values specified in the Fields tab
114. rator character is Generating a DB2 DAD File You generate the DAD file by selecting it as an additional target for standard schema generation 1 Select Language gt Generate schemaFile 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 108 PowerDesigner CHAPTER 5 Working with XML and Databases Generation Iof x ol Directory IV Check model Targets Options v XML in Database IBM DB2 DAD Document Access Definition Cancel Apply Help 3 optional Click the Options tab and set any appropriate generation options Character ending an in Character ending instructions in the SQL file for stored procedures struction Generates procedures de Generation of a SQL script for stored procedures enabling XML data ployment storage and facilitating XML data retrieval Path of DAD dtd Path of the DTD file installed with IBM DB2 Extender and describing the specific syntax of DAD files Schema validation Validation tag in the DAD files to check the conformity of DAD files with the DAD syntax 4 Click OK to begin the generation The Result dialog box is displayed with the path of the generated DAD DTD and SQL files 5 Click Edit to open the generated DAD file in your associated editor e Extract of a DAD file defined with Xco lection as StorageType and RDB as MappingType XML Modelin
115. rom 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 General tab contains the following properties 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 Commen Descriptive label of the attribute label Descriptive label of the attribute the attribute Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined XML Modeling 37 Reference 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 select 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 the name and code are those of the target attribute and these properties are grayed Type Attribute data type which must be a qualified name Use the list to select a built in data type Use the Browse tool to select a simple type
116. roperties tool to open the property sheet of the field XML Modeling 45 Field Properties olx General Annotation Dependencies Version Info XPath numEmployee Stereotype PO ID PY lt lt Less z Cancel Apply Help 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 node 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 of the full XPath language defined in the W3C Recommendation XML Path Language 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 Ee l Selects the context node parent Selects all the child elements of the context node Selects all the employee child elements of the context node s employee Selects all the employee child elements of the context node defined in the namespace with the s prefix 46 PowerDesigner CHAPTER 2 Building XML Diagrams company employee Selects the employee descendants of the company child ele ments of the context node company employee Selects all the employee elements with company as parent ele ment in the context node book chapter 2 section
117. rver 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 1 Map an XSM toa 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 Wizard on page 97 2 if you do not use the wizard Attach the Microsoft SQL Server extension file To enable these extensions in your model select Model gt Extensions click the Import tool select the Microsoft SQL Server file on the XML in Database tab and click OK to attach it 3 optional Reinforce the mappings of elements and attributes to tables and columns with extended attributes Note If the element and attribute names match the table and column names you do not need to define extended attributes for XML objects encode 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 field Maps an XML item to a database column Available for Element Attribute hide Hides the element or attribute specified in the schema in the resulting XM
118. s and includes are always resolved and attributes and attribute groups defined at the model level are generated only where they are used Notations redefines anys and for DTDs entities are not generated to PDMs XML Modeling 81 82 PowerDesigner CHAPTER 4 Checking an XSM The XML model is a very flexible tool which allows you quickly to develop your model without constraints You can check the validity of your XSM at any time A valid XSM conforms to the following kinds of rules e Each complex type should have at least one attribute e Each group must contain elements groups group particles and or Any Note We recommend that you check your XML model before generating an XML document or another 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 your model in any of the following ways e Press F4 or e Select Tools gt Check Model or e Right click the diagram background and select Check Model from the contextual menu The Check Model Parameters window opens allowing 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 in the Models chapter of the Core Features Guide The following sections document the XSM specific checks available by default For information about checks ma
119. scsesesesesososose 43 Constraint Properties cccessesscccccccsssccssvess 44 Specifying a Constraint Selector sssssssessesseseo 45 Specifying Constraint Fields ssessessesssssssessesso 45 XPath Abbreviated Syntax ssssssessssesssessseseso 46 Selector and Field Property Sheet General Tab EE EE EE E T 48 GROUPS XSM i eii resisio seesi a teii ino iia iE 48 Creating a Group ssesesesessocsesosoecesessocsesesose 50 Creating a Reference to a Group cece cece cece ee 50 Group Properties sessesessessesesreseeresecseseeceere 50 Linking Child Objects to a Group ssssssssssessesess 51 Attribute Groups XSM cccscscssccscssccccsccsccsccccees 52 Creating an Attribute Group cece cess ee eeeeee 53 Creating a Reference to an Attribute Group 54 Attribute Group Properties ceee sees eee e cence 54 Simple Types XSM cccscsscsccscccccccccccccccscsscssseeees 55 Creating a Simple Type ccccesessesccsccccscerees 55 Simple Type Properties ceeceecsecceecsees 56 Complex Types XSM cccccccccccccccccccccsscssssssssssscess 56 Creating a Complex Type cccsecscccceesesssseces 57 Complex Type Properties cccceceeseseesesccees 57 Linking a Child Object to a Complex Type 59 Specifying the Type of Content of a Complex Type 60 iv PowerDesigner Contents Derivations Extensions
120. st have previously defined a group in the current model Adding a Child Object to a Group Particle 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 The following table lists the allowed links Warning 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 32 PowerDesigner CHAPTER 2 Building XML Diagrams Sequence symbol Choice symbol All symbol A referencing group is cre No link Note 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 Any Elements XSM Any elements allow you to attach any type of object to a choice or a sequence group particle The following illustration shows an Any in a diagram Resources Resources e Inan XSD file Any is declared with the lt any gt tag lt xml version 1 0 encoding UTF 8 gt lt xsischema xmins xs http www w3 org 2001 xMLschema gt lt xs element name RESOURCES gt lt xs rcomplexType gt
121. t lt xs i complexType gt lt xs element gt lt xSiattribute name NUMBER type xs positivelnteger gt lt xstattribute gt lt xs schema gt In a schema attributes are declared with lt attribute gt tags 36 PowerDesigner CHAPTER 2 Building XML Diagrams Creating an Attribute You can create attributes and attribute groups on the Attributes tab of an element complex type or attribute group using the following tools CE 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 Se lection 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 Selection dialog box Any Attribute Adds any attribute of a specified namespace For more information see Any Attributes on page 40 For general information about creating objects see the Objects chapter in the Core Features Guide Attribute Properties You can modify an object s properties f
122. t lt xs relement gt lt f xsichoice gt lt xsicomplexType gt lt xs element gt lt xs element name ML_DECLARATION gt lt xs icomplexType gt lt xs 1sequence gt lt xsrelement name VERSION_ATTRIBUTE gt lt xs element name ENCODING_ATTRIBUTE gt lt xs element name STANDALONE_ATTRIBUTE gt lt xs rsequence gt lt xsitcomplexType gt lt xsrelement gt lt xs schema gt In a schema elements are declared with lt element gt tags There are two broad kinds of elements e Global elements have no parent element in a diagram and are directly linked to the lt schema gt tag root element in a schema They can be reused in the model through referencing elements see XML_declaration in the example e 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 21 20 PowerDesigner CHAPTER 2 Building XML Diagrams Note In a model targeted with the XML Data Reduced language local elements are first declared separately like global 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 lt ElementType name Jocalelement lt ElementType name globalelement lt element type Jocalelement gt lt fElementType gt Parent e
123. t elementType name parentElement content empty gt lt AttributeType name Jocalattribute default 0 dt values 1 2 3 gt lt attribute default 0 type Jlocalattribute gt lt f ElementType gt lt schema gt XML Modeling 39 Any Attributes 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 lt xml version 1 0 encoding UTF 8 gt lt xs schema xmins xs http ZANNI w3 org 2001 xmMLSchema gt lt xs element _name PRODUCT gt lt xs i complexType gt lt xsiattribute name EXPIRYDATE type xs date gt lt xstattribute gt lt x ranya Attribute namespace local processcontents skip gt lt xs complexType gt lt xs element gt lt xs ischema gt Warning 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 E Element Properties product PRODUCT iol x Rules Dependencies Extended Dependencies Version Info Preview General Detail Attributes Constraints Annotation Mapping Notes TEER IBEX MY I eee EXPIRY DATE _ lt None gt Attr oF ite MV Any Attribute lt
124. t 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 refer ence 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 com plex element Automatic correction None XML Modeling 87 Check Description and Correction Invalid cardinality only available for model targeted with XDR You should define a minimum 0 or 1 and a maximum cardinality 1 or unbounded for a group particle occurrence 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 Group Checks PowerDesigner provides default model checks to verify the validity of groups Check Description and Correction Group name and code uniqueness 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 Un
125. t 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 XML Modeling 65 Restriction Properties iol x Annotation Dependencies Version Info General Detail Enumerations Patterns S amp Be wx A M m f m m f m m E m m f m E E m m f m lt lt Less E v Cancel Apply Help Generated schema lt xs simpleType name ZIPCODE gt lt xsirestriction base xs string gt lt xsipattern value a z a z 0 9 5 gt lt xstrestriction gt lt xsisimpletype gt 6 Click OK to close the restriction property sheet and return to the element simple type or complex type 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 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 and complete the following properties ID of the simple type list Its value must be of type ID and unique within the model 66 PowerDesigner CHAPTER 2 Building XML Diagrams Data type for the list of values Embedded If selected
126. ta type Content XSD only Content type of the element If you select Complex 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 Type 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 the values of the element data type When you define a derivation the data type disappears Click the Properties tool to select a base type in the derivation property sheet see Derivations Extensions Restrictions Lists and Unions XSM on page 61 Detail Tab The Detail tab contains the following properties Minimum Minimum number of times the element can occur To specify that the element is optional set this attribute to zero PowerDesigner CHAPTER 2 Building XML Diagrams 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 be substituted It must group have the same type or a derived type Its value
127. tent to an annotation at the global schema level Documentation and Application Information Properties The General tab contains the following properties 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 The Content tab allows you to write or paste any well formed XML content Notations XSM Notations allow you to define and process non XML objects within an XML model The following example shows the generated schema for a notation lt xml version 1 0 encoding UTF 8 gt exs i schema xml ns xs http Zwan w3 org 2001 xXMLSchema gt l Integrating GIF files in your XML model gt lt xstnotation name PICTURES public pictures gif system user local picturevVi ewer gt lt xs schema Notations are not available on models targeted with XDR XML Modeling 69 Creating a Notation You can create a notation in any of the following ways e Select Model gt Notations to access the List of Notations and click the Add a Row tool e Right click the model or package in the Browser and select New gt Notation For general information about creating objects see the Objects chapter in the Core Features Guide Notation Properties 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 Notat
128. the Embed Resource in Model button to the right of this field Embedding a file in this way enables you to make changes specific to your model without affecting any other models that reference the shared resource 3 Click OK A message box opens to tell you that the XML language has been changed 4 Click OK to return to the model Extending your Modeling Environment You can customize and extend PowerDesigner metaclasses parameters and file generation with extensions which can be stored as part of your model or in separate extension files xem for reuse with other models To access extension defined in a xem file simply attach the file to your model You can do this when creating a new model by clicking the Select Extensions button at the bottom of the New Model dialog or at any time by selecting Model gt Extensions to open the List of Extensions and clicking the Import an Extension tool In each case you arrive at the Select Extensions dialog which lists the extensions available sorted on sub tabs appropriate to the type of model you are working with XML Modeling 11 W Select Extensions xi Hio mo ta aA X Excel Import To get started extending objects see Extending Objects in Chapter 4 Objects of the Core Features Guide For detailed information about working with extensions see Chapter 1 Resource Files and the Public Metamodel in Customizing and Extending PowerDesigner Creating Links
129. the XML Document extension file to generate a simplified XML file that will help you understand the annotated schema see Extending your Modeling Environment on page 11 98 PowerDesigner CHAPTER 5 Working with XML and Databases Generating an SQL XML Query File 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 You can generate SQL XML queries for g obal elements in your XSM whatever the targeted XML language XSD DTD or XDR SQL XML has five main elements XMLELEMENT to edit an element witha 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 You can generate an SQL XML query file from an XSM if you have attached the SQL KML extension file These extensions are automatically linked to your XSM if you have created it from a PDM via the XML Builder Wizard see Mapping Database Objects to an XML Schema Via t
130. the property sheet of a complex type and select a type in the Content field e simple content character data or a simple type but no elements or e complex content elements or elements and character data 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 ID ID for the complex content Its value must be of type ID and unique within the model containing the complex content Mixed complex Specifies that character data is allowed to appear between child elements of content only the complex type 4 Click OK to return to the diagram 60 PowerDesigner CHAPTER 2 Building XML Diagrams Derivations Extensions Restrictions Lists and Unions XSM You can use derivations to extend or restrict the values of elements and of simple and complex types An XML model allows you to derive e Elements by extension restriction list or union e Simple types by restriction list or union e Complex types by extension or restriction Note 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
131. tool see Group Particle Properties on page 31 For general information about creating objects see the Objects chapter in the Core Features Guide Group Properties 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 Name unavailable to references to groups Name of the group which must be a no colon name Required when the group is global Code unavailable to references to groups Code of the group which must be a no colon name Required when the group is global Comment Descriptive label for the group Stereotype Sub classification used to extend the semantics of an object without changing its structure It can be predefined or user defined 50 PowerDesigner CHAPTER 2 Building XML Diagrams Reference for references to groups only Name of a group in the current model or another model opened in the workspace which must be a qualified name 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
132. xstattributecroup gt lt xs rcomplexType gt lt xs element gt lt xsischema gt In a schema a group of attributes is declared with the lt attributeGroup gt tag It can contain the following tags lt attribute gt lt attributeGroup gt or lt anyAttribute gt e 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 For more information on references see Creating a reference to an attribute group on page 54 You can create an attribute group in any of the following ways e Select Model gt Attribute Groups to access the List of Attribute Groups and click the Add a Row tool e Right click the model or package in the Browser and select New gt Attribute Group XML Modeling 53 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 You can create an attribute group in the following way e On the Attributes tab of the property sheet of an element complex ty
Download Pdf Manuals
Related Search
Related Contents
SyncBraille User Manual GLOBAL LIFT CORP - Swimtown Pool Supplies Scarica il Manuale d`Uso 5800 Refrigerated Sampler User Manual Operação e Manutenção Categories FLEX STRIP CONTROL MANUEL D`UTILISATION Samsung DVD-V7100K Vartotojo vadovas 取扱説明 書 品 番 SVW-AQAー 。。。 Istruzioni per l`uso SCHICK – Set per fresare le ceramiche Copyright © All rights reserved.
Failed to retrieve file