Manuale d’uso / di manutenzione del prodotto XML del fabbricante Sybase
Vai alla pagina of 290
XML Model User's Guide Sybase ® Pow erDesigner ® 11.1 W indows.
DOCUMENT ID: DC20014-01-1110- 01 L AS T REV I SED : June 2005 Copyri ght © 1991- 2005 Sybase, Inc. A ll rig hts reserved. Inf orm ati on in thi s m anu al m ay chan g e with out n oti ce and does n ot represen t a com m i tm ent on th e part of Sybase, I nc.
XSM Us er 's G ui de iii Contents A bout T his Book ............................................................................................ ix 1 XML Mod el Ba sics .............................................................. 1 Functional overview .
iv PowerDesigner Defining Any Attribute properties ...................................... 61 Defining identity constraints .................................................... 64 Defining a unique constr aint ..........................................
XSM Us er 's G ui de v Defining an include ......................................................... 127 Defining a redef ine ......................................................... 128 Defining business rules ..................................
vi PowerDesigner Understanding objec t mapping ...................................... 166 Defining data sourc es in an XML m odel ........................ 166 Mapping XML Model objects to PDM objects ................ 169 Mapping XML Model objects to OOM objec ts .
XSM Us er 's G ui de vii 5 Exchanging data w ith da tabases supporti ng XML ...... 215 W hy use XML in databases? ................................................ 216 Generating an annotated sc hema f or Micros oft SQL Server 2000 ...............
viii PowerDesigner.
XSM Us er 's G ui de ix About This Book This book des cribes th e Pow erDesig ner XML Model env ironm ent . It show s you how to do the followin g: ♦ Build an XML m odel ♦ Work on an XML m od.
About This Book x PowerDesigner ♦ Object Oriented Model (OOM) to model a so ftware system using an obj ec t -orie nted a ppr oac h for J ava o r ot he r ob je c t language s ♦ Business Pr o cess M.
About This Book XSM Us er 's G ui de xi Repository Getting Started To learn the basics of th e Repository . Repository User’s G uide T o w ork in a mu lti-user en vironmen t using a central repository .
About This Book xii PowerDesigner.
XSM Us er 's G ui de 1 CHAPTER 1 XML Model Basics This chapter presents PowerDesig ner XML Model . It provides y ou w it h an introduction to the basic notions of XML modeling.
Functional over view 2 PowerDesigner Functional ov erv iew With the graphi cal interface and th e B r owser tree view of PowerDesig ner XML Model, y o u can design an XML diagram which repres ents the con tent of an XML Sch ema Defi nition file (.XSD), a Docum ent Type Definition f ile (.
Chapter 1 XML Model Basics XSM Us er 's G ui de 3 What is an XML model? An XML model is a graphical representation of an XML Schem a Definition file (.
What is an XML model? 4 PowerDesigner A bout XM L The eXtensi ble M arkup Language is use d for differ ent r e asons: ♦ It describes an d structures data , wh ereas HTML only di splay s data ♦ It .
Chapter 1 XML Model Basics XSM Us er 's G ui de 5 Extract of an XSD f ile: An XSD f ile alw ays s tarts w ith the <schema> tag (root element). All objects cr eated in the model will appear in the XSD f ile between th e schem a start-tag and en d-tag ♦ An XDR fi le is a s im plifie d XSD fi le (or sch ema).
What is an XML model? 6 PowerDesigner An XML model is a tree structu re of child elem ents attached to parent elemen ts. Elem ents are the bas ic describing item s of an XML m odel. T hey can b e made o f other elements c ombine d in di ffe rent ways thro ugh group particles.
Chapter 1 XML Model Basics XSM Us er 's G ui de 7 Tool Object Description — Notation A nota tion is used to de fine and proce ss non- XML objec ts within an XML mode l These tools are available in th e palette of the diag ram w indow . The mai n objects of an XML model are repres ented by sy mbols i n its diagram .
What is an XML model? 8 PowerDesigner How to link a child object to a parent object in an XM L model? XML objects do n o t support standard l ink objects. To link a ch ild object to a parent object, you must click the child ob j ect tool in the palette and then click the sym bol o f the parent obj ect in the diagram .
Chapter 1 XML Model Basics XSM Us er 's G ui de 9 Tool Sequence sy mbol Choice sy mbol All sy mbol No link No link All No link No link No link Caution A group parti cle (s equence, choice, all) cannot be created f rom scr atch in a diagram. It must be the chi ld element of an elem ent, a group or a complex t ype.
Defining the XML model environment 10 PowerDesigner Defining the XML model env ironment The XML m odel environ men t includes a set of parameters and conf iguration options t hat def ine vari ous aspect s of th e model conten t and behavior.
Chapter 1 XML Model Basics XSM Us er 's G ui de 11 Changing the XML language of an XM L model If you cha nge the X M L language of an XM L model , you have to defi ne the status o f t he language: XML language Description Share To use th e sh ared XM L language stor ed in th e X ML Languages director y of your installa tion.
Defining the XML model environment 12 PowerDesigner 4 Click OK. A message bo x i nfo rms you that the c urrent XML langua ge has be en chang ed. 5 Click OK. Changes concerning simple and compl ex ty pes Sim ple types an d comple x ty pes are only s upported by XSD s (schem as).
Chapter 1 XML Model Basics XSM Us er 's G ui de 13 Selecting extended model definitions at model creation Extended model definitions (.XEM f iles) provide means for customizin g and extend ing Po werD esigner meta classes, par a meters and genera tion.
Defining the XML model environment 14 PowerDesigner For more inform ation on extended model definitions, see ch ap ter Extended Model Definitions Referen ce Guide, in the Advanced Us er Documentatio n . Defining model options You can define the case sens itivity of n ames and codes for all objects in the current m odel.
Chapter 1 XML Model Basics XSM Us er 's G ui de 15 To define XM L model options: 1 Select Tools → Model Options. or Right-click the diagram backg round and select Model Optio ns in the contextual m enu. The Model Options dialog box opens to t he Model Sett ing s pane.
Defining the XML model environment 16 PowerDesigner You can ty pe stereotypes directly in the Stereotype colum n of the object property sheet or s elect a val ue from the dropdow n listbox if you hav e previous ly defin ed stereoty pes in an em bedded or imported ex tended model definition (.
Chapter 1 XML Model Basics XSM Us er 's G ui de 17 Defining an XML model This section presents the main operations you h ave to perform before starting to build or w ork on an X ML m odel. Defining model properties The model prop er ty sh eet d isplays th e definition of the current m o d e l.
Defining an XML model 18 PowerDesigner If you want to d ispla y the X ML language , clic k the P r ope rties t ool besid e the X ML language box in t he Gener al p a ge to d ispla y the pro per ty sheet o f t he XML la nguage.
Chapter 1 XML Model Basics XSM Us er 's G ui de 19 Model Detail page The Detail page of a m odel property sheet (only available in a m odel targeted with XSD) displays the follow ing properties: Property Description Targe t Namespace Namespace of all the model ob jects.
Defining an XML model 20 PowerDesigner Model Items page The Item s page of the m odel property sh eet displays the lis t of g lobal objects (with no parent sym bo l in the diagram , d ir ectly linked to the <schem a> tag) created in the model. This list reflects the order in which global obj ects ar e being declared in th e schema.
Chapter 1 XML Model Basics XSM Us er 's G ui de 21 Tool Tooltip Description Add A nnotation Adds an annotation to the mode l, to provide docum entation or a pplication inf o rmation. Only a vailable in a mode l targeted with XSD For more inform ation on these item s, see chapter Building an XML model .
Defining an XML model 22 PowerDesigner Model Namespaces page A nam espace is a URI indicating a loca tion w here objects are declared. The prefix of a namespace, follow ed by a colon (:) an d the name of an object, indicates that th is object is declared in that nam espace.
Chapter 1 XML Model Basics XSM Us er 's G ui de 23 ♦ In the case of a model targeted w ith XDR, two n amespaces are predefined in th e list of names paces.
Defining an XML model 24 PowerDesigner Model Preview page The Preview page of the m odel property s heet display s a preview of the XSD, DTD or XDR file generated from th e XML m odel. Exam ple of an XSD f ile (or schema file): The schem a file starts w ith the XML declaration follow ed by th e <schem a> (root elemen t) declaration.
Chapter 1 XML Model Basics XSM Us er 's G ui de 25 Creating an XML model using t he New model opt i on When you c reat e a new XML mod e l using the N e w m o del o pti o n, you have to sel ect an X ML langua ge .
Defining an XML model 26 PowerDesigner 6 <optional> If you w ant to attach one or more extended m odel definitions to the model, click the Ex tended Model Definitions tab, and select the extended model defin itions of y our choice.
Chapter 1 XML Model Basics XSM Us er 's G ui de 27 Creating an XML model using t he New model f r om t em pl ate option To create a new XM L model using the New model from template option: 1 Select File → New to display the New dialog box .
Defining an XML model 28 PowerDesigner Opening an existing XML model An XML model has the file ex tension .XSM. If P o werDes i gner ca nnot find the XM L language atta c hed t o the XM L model you want to o p en, the Choos e XML Langua ge dia log b o x app ear s t o let you selec t anothe r XML la ngua ge to a ttach t o the mode l.
Chapter 1 XML Model Basics XSM Us er 's G ui de 29 Saving and closing an XML model To save an XML model, choose on e of the follow ing option s: ♦ Select File → Save ♦ Click the Save tool i.
Defining an XML model 30 PowerDesigner.
XSM Us er 's G ui de 31 CHAPTER 2 Building an XML model This chapter describ es how to build an XML m odel (XSM). I t explains the role of each object in an XML m odel and how to create and m odify th em.
XML diagram basics 32 PowerDesigner XML diagram basics You can create XML diagram s in an XML model. Defining an XML diagram An XML diagram is a graph ical view of an XML m odel. The follow ing ex ample sh ows the diagram of the Resu me XML model: The mai n objects of an XML model are repres ented by sy mbols i n its diagram .
Chapter 2 Building an XML model XSM Us er 's G ui de 33 Objects in a diagram Some objects m ay not appear in a diag ram becau se they do not have a sy mbol or thi s sy mbol has been delete d or hidden. Alw ays check the existen ce of objects in the Browser tree v iew .
XML diagram basics 34 PowerDesigner Creating an XML diagram There are two w ays to create an XML diagram : ♦ From a new XML m odel ♦ From an exis ting XML m odel For inform ation on creating an XML diagram from a new XML model, see section Creatin g an XML model in chapter XML Model Basics.
Chapter 2 Building an XML model XSM Us er 's G ui de 35 Defining elements Elemen ts are the basic bu ilding blocks of an XML m odel. An XML model is a tree structu re of elem ents w here child elemen ts are attached to parent elem ents.
Defining elements 36 PowerDesigner Gener ated sc hema: In a schem a, elements are declared w ith <elemen t> tags. Defining element properties To display an elem ent property sheet, dou ble-click its sym bol in a diag ram.
Chapter 2 Building an XML model XSM Us er 's G ui de 37 Element general properties There are global and local elem ents: ♦ Global elemen ts have n o parent elem ent in a diagram . T hey are directly linked to the <s chema> tag (root elem ent) in a schem a.
Defining elements 38 PowerDesigner Property Description Refe rence Nam e of a globa l element. T he current elem ent will hav e the same properties as t he glob al el ement. The Reference prop erty is only availa ble for child elem ents. Use the dropdown lis tbox to select a gl obal element i n the cu rren t model.
Chapter 2 Building an XML model XSM Us er 's G ui de 39 In a mod el tar geted with the XML-D ata Red uced language , elements a re defin ed by di ffe rent attri butes: XDR attribute for an element Description Property or page in element property sheet Mod el To specify if a global el ement can contai n new local el ements.
Defining elements 40 PowerDesigner Exam ple of an XDR file: Element deta i l pr oper t i e s The Detail page of an elem ent property sh eet displays the follow ing properties: Property Description Minimum Min imum number of times the element can o ccur.
Chapter 2 Building an XML model XSM Us er 's G ui de 41 Property Description Nillable Property def ining if the e lem ent is null or not In the case of a m o d el targeted with XDR, the Detail page is only available for local elem ents. Element attributes properties Attributes give additional inform atio n about an elem ent.
Defining elements 42 PowerDesigner Element constr ai nt s pr oper t i e s Identity constraints allow you to indicate that elem ent values m ust be unique with in their specified scope.
Chapter 2 Building an XML model XSM Us er 's G ui de 43 The Attrib utes Ma ppi ng p age a l l ows you to de fine the map ping b e tween PDM columns or OOM class attribut es and the elem ent attributes.
Defining elements 44 PowerDesigner 3 Click the Pointer tool in the palette. or Right-click to recover the Po inter. 4 Double- click the elem ent sym bol in the diagram. The element property sheet appears. 5 Type a nam e and a code for the elem ent. 6 Select a dat a type f or the element .
Chapter 2 Building an XML model XSM Us er 's G ui de 45 How to link a child object to an element? XML objects do n o t support stan dard link objects. To link a ch ild object to an elem ent, you must click the child ob j ect tool in the palette and then click the elem ent sym bol in the diagram.
Defining elements 46 PowerDesigner Tool Action Result If you click an element symbol with the Com plex Ty pe tool, a com plex ty pe sym bol appears superpose d, but not linked, to the element symbol.
Chapter 2 Building an XML model XSM Us er 's G ui de 47 For exam ple: Gener ated sc hema: In a schem a, attributes are d eclared w ith <attribute> tags.
Defining elements 48 PowerDesigner A ttribute general pr oper t i es There are global and local attribut es: ♦ Global attributes are defined with th e Model menu.
Chapter 2 Building an XML model XSM Us er 's G ui de 49 Property Description Ref erenc e Nam e of an attribute in the current m odel or anothe r mode l open ed in th e worksp ace. A reference allows you to reu se an attribute w ith all its properties w ithout having to def ine it aga in.
Defining elements 50 PowerDesigner Exam ple of an XDR file: A ttribute detail pr oper t i es The Detail page of an attribute prop er ty sh eet d isplays th e followin g properties: Property Description Defa ult Def ault value. Ente r a default va lue only if there is no fixed value Fixed Fixed va lue.
Chapter 2 Building an XML model XSM Us er 's G ui de 51 Element values with XDR In a mod e l tar ge ted with the X ML-Data Reduce d langua ge, ther e is al so a Values page in the elem ent property sheet. A dding an attribute to an element To add an attribute to an element: 1 Double- click the elem ent sym bol in the diagram.
Defining elements 52 PowerDesigner The element s ym bol appears in the diagram with the attribu te nam e. In the exam ple, <None> indicates that no data ty pe has been defined f or the attribute.
Chapter 2 Building an XML model XSM Us er 's G ui de 53 Child e lements ar e linked to the ir pa rent e l ement thro ugh a gro up par ticle . Defining gr oup par t i cles Group particles indicate how child elem ents are related with th eir parent elemen t.
Defining elements 54 PowerDesigner Group parti cles properties To display a group parti cle property sheet, double- click its s ym bol in a diagram . The General pag e of a grou p particle property s heet display s the f ollowing properties: Property Description Ty pe Ty pe of the g roup particle .
Chapter 2 Building an XML model XSM Us er 's G ui de 55 You can access directly to th e Items page of a g roup particle property sheet thro ugh t he cont e xtual menu. Right -c lick a gr oup p arti cle symbol in t he diagram and select Item s in the contextual m enu.
Defining elements 56 PowerDesigner 7 Click OK. The group parti cle sy mbol appears se lected, w ith an Expan d tab on its right sid e. 8 Click an empty space in the diagram , to deselect the group particle sy mbol, an d click the Expan d tab to reveal the ch ild elemen t symbols and their link .
Chapter 2 Building an XML model XSM Us er 's G ui de 57 The child elemen ts appear one by one in the diagram, link ed to the group particle symbol.
Defining elements 58 PowerDesigner Tool Sequence sy mbol Choice sy mbol All sy mbol A re ferenc ing gr oup is created. Yo u must now s elect a group for the reference A re ferenc ing gr oup is created.
Chapter 2 Building an XML model XSM Us er 's G ui de 59 ♦ Generated XSD file: In an XSD file, A ny is declared with th e <any> tag . ♦ Generated DTD file: In a DTD file, Any is declar ed within an <! ELEMENT > tag w ith the key word “ ANY ”.
Defining elements 60 PowerDesigner Property Description ID ID of the Any . Its value must be of ty pe ID and unique w ithin the m odel containing the Any. Only a vailable in a m odel targete d with XSD Namespace Nam espaces con t ai ning th e objects t hat can b e u sed.
Chapter 2 Building an XML model XSM Us er 's G ui de 61 5 Defi ne the A ny propertie s in th e different pag es of the property sheet. 6 Click OK. Modifying the A ny display preference You can m odify the Stereoty pe display preferen ce for An y by selecting Tools → Display Preferences.
Defining elements 62 PowerDesigner For exam ple: Caution Any Attribut e only appears in a s chema (see t he Preview page of a model property s heet). The Any Attribute feature is av ailable via a check box in th e bottom- left corner of an Attribut es page.
Chapter 2 Building an XML model XSM Us er 's G ui de 63 A ny A ttribute general pr oper t i e s The General page of an Any Attribute pro perty sheet display s the follow ing properties: Property Description ID ID of the Any A ttribute.
Defining identity constr aints 64 PowerDesigner Defining identity constraints Identity constraints en ab le you to indicate th at element v alues must be unique with in their specified scope. There are three kinds of identity cons traints: unique, k ey and k eyRef .
Chapter 2 Building an XML model XSM Us er 's G ui de 65 The UNIQUENUM unique con straint, defined on the project elemen t, specifies that the nu mEm plo yee attribute must be uniqu e or null with in the employ ee element To display a uniqu e property sheet , double-cl ick it s nam e or its icon i n the Brows er tree view .
Defining identity constr aints 66 PowerDesigner Defining a key constraint A key constraint specifies that an elem ent or an attribute value (or s et of values) m ust be a key within a specif ied scope. A key means that data should be unique, not nu ll and alway s present within a specified sc ope.
Chapter 2 Building an XML model XSM Us er 's G ui de 67 Key genera l pr oper t i e s The General pag e of a ke y property sheet displ ays the follow ing properties: Property Description Nam e Nam e of the ke y constra int. It m ust be a no- colon-nam e (See Glossary) Code Code of the key constra int.
Defining identity constr aints 68 PowerDesigner For exam ple: Gener ated sc hema: The KEYREF_UNIGOLD key Ref, defin ed on the produ ct elemen t, by reference to th e UNIGOLD uni que constrain t , spec.
Chapter 2 Building an XML model XSM Us er 's G ui de 69 Key Ref gener al pr oper t i es The General pag e of a key Ref property sheet display s the follow ing properties: Property Description Nam e Nam e of the ke yRef constra int. It m ust be a no- colon-nam e (See Glossary) Code Code of the key Ref constra int.
Defining identity constr aints 70 PowerDesigner To create an identity constraint from an element property sheet: 1 Click th e Constraints tab of an elemen t property sh eet. 2 Cli ck th e Add Un ique, A dd Key or Add Ke yR ef Con strain t tool in the Constra ints page .
Chapter 2 Building an XML model XSM Us er 's G ui de 71 XPath abbrevi a t ed sy ntax You can u se the follow ing abbreviated sy ntax to defin e an XPath expression: Sy ntax Description / Root node of the XML doc ument. It is the root elem ent with its ramif ications .
Defining identity constr aints 72 PowerDesigner Sy ntax Description /book/cha pter[2]/section[3] Select s the third se ction in the second cha pter of the book employee[@dep t=”doc”] Sel ect s all.
Chapter 2 Building an XML model XSM Us er 's G ui de 73 2 Click A pply. 3 Cli ck th e Properties t ool beside th e XP ath box. The selector property s heet appears. 4 Defi ne the s elector properties in th e different pag es of th e property sheet .
Defining identity constr aints 74 PowerDesigner Defining f i el d general properties The General pag e of a f ield property sheet display s the follow ing properti es: Property Description XP ath A n XP ath exp ression rel ative to each el ement selected b y the selector of the identity constraint.
Chapter 2 Building an XML model XSM Us er 's G ui de 75 The field property sheet appears. 6 Defi ne the f ield properties in t he diff erent pages of t he property sheet.
Defining groups 76 PowerDesigner Defining groups You can def ine grou ps of elem ents or attributes in an XML model. Defining a group of elements A grou p of elemen ts is a s et of elem ents arrang ed by a group parti cle (all, choice or sequ ence).
Chapter 2 Building an XML model XSM Us er 's G ui de 77 ♦ In the generated XSD file, th e group is first declared with th e <gro up> tag and then re use d thr o ugh a re fe rence (ref) se.
Defining groups 78 PowerDesigner ♦ Referencin g groups are created in a diagram within an elem ent, a compl ex ty pe or a global group. You mu st select a global group f o r their Reference property.
Chapter 2 Building an XML model XSM Us er 's G ui de 79 Once you ha ve de fined t he refe r ence o f a re ferenc ing gro up , you ca n loca te the re fere nc ed gr oup i n t he dia gram by right -c licking t he refe renci ng group sy mbol an d selecting Fin d Referenced Grou p in the contextual m enu.
Defining groups 80 PowerDesigner 5 Type a n ame an d a code for the group. 6 Click OK. 7 Select a group particle tool in the palette (Sequence, Choice or All). 8 Click the g r oup sym bo l in the diagram . The group parti cle sy mbol appears at tached to th e group sym bol.
Chapter 2 Building an XML model XSM Us er 's G ui de 81 How to link a child object to a group of elements? XML objects do n o t support standard l ink objects. To link a ch ild object to a group, you m ust click the child object too l in the palette and then click the group sym bo l in the diagram .
Defining groups 82 PowerDesigner Pointer indications When y o u cann ot click a sy mbol or an empty space in a diagram, th e Pointer displays a forbidden sign (See complex ty p e in Tool column).
Chapter 2 Building an XML model XSM Us er 's G ui de 83 ♦ Generated XSD file: In a sch ema, a g roup of attribu tes is declared w ith th e <attributeGroup> tag. It can contain th e followin g tags: <attribute>, <attributeGroup> or <anyA ttrib ute>.
Defining groups 84 PowerDesigner The General pag e of an at tribute g roup property sheet display s the foll owi ng properties: Property Description Nam e Nam e of the attribute group. It must be a no-c olon-nam e (See Glos sary ). Required w hen the attribute group is global Code Code of the attribute group.
Chapter 2 Building an XML model XSM Us er 's G ui de 85 Tool Tooltip Description Add A ttribute Group w ith Refe rence to A ttribute Group f rom a Sele ction Adds one or several a ttribute groups w ith a ref erence to a ttribute groups defined in the curre nt mode l.
Defining groups 86 PowerDesigner 3 Type a nam e and a code for the attribu te group. 4 Click OK. 5 Select the A ttributes page. 6 Select different tools to add items to the attribute group. 7 Click A pply. 8 Doubl e-click on the left of a row to display an item property sheet.
Chapter 2 Building an XML model XSM Us er 's G ui de 87 Managing external shortc uts through references and data types External sh ortcuts allow y ou to share objects betw een diff erent m odels.
Managing external shortcuts through references and data types 88 PowerDesigner Example o f short c uts thro ugh a refe r ence a nd a d ata type :.
Chapter 2 Building an XML model XSM Us er 's G ui de 89 Defining simple types You can only define simple ty pes in a model targeted with XSD. What is a simple ty pe? A sim p le type is a data ty pe definition for elements or attributes w ith text- only content.
Defining simple types 90 PowerDesigner Defining simple ty pe properties To d isp lay a simple ty pe pro p erty sh eet, double-click its nam e or its icon in the Brow ser tree view . The General pag e of a sim ple type property sheet displa ys the fol low ing properties: Property Description Nam e Nam e of the sim ple type.
Chapter 2 Building an XML model XSM Us er 's G ui de 91 The sim p le type property sheet appears. 3 Type a nam e and a code for the sim ple type. 4 Click OK.
Defining complex types 92 PowerDesigner Defining complex types You can only define complex ty pes in a model targeted with XSD. What is a complex ty pe? A com plex type is a data type definition used to define attributes and child elemen ts of a parent elemen t.
Chapter 2 Building an XML model XSM Us er 's G ui de 93 Caution Global complex ty pes appear in the model as objects, w ith their corres ponding symbol in the diagr am. Local complex types only appear in the schem a (see Previ ew page of an element property sheet) .
Defining complex types 94 PowerDesigner Complex ty pe detail propert i es The Detail page of a complex type property sheet display s the follow ing properties: Property Description Final Proper ty to .
Chapter 2 Building an XML model XSM Us er 's G ui de 95 Tool Tooltip Description Add A ttribute Group w ith Refe rence to A ttribute Group f rom a Sele ction Adds one or several a ttribute groups w ith a ref erence to a ttribute groups defined in the curre nt mode l.
Defining complex types 96 PowerDesigner Icon Tool Description Create from Sources To copy abstract data type att r i butes o r cl ass attributes to the c u rrent complex ty pe attributes Ge nerate Ma .
Chapter 2 Building an XML model XSM Us er 's G ui de 97 To create a complex type from the palette: 1 Select the Com plex Type tool in the palette. 2 Click an empty space in the diagram . A complex type sy mbol appears in the diagram at th e click position.
Defining complex types 98 PowerDesigner 10 Click th e group particle sym bol in the diagram for each child elem ent you w ant to create. The child elemen t sym bols appear attached to the g roup particle sy mbol. 11 Double-click a child elem ent sym bo l to display its property sheet.
Chapter 2 Building an XML model XSM Us er 's G ui de 99 Tool Action Result If y ou click a com plex type sy mbol w ith the Group tool, a ref erencing g roup is created.
Defining complex types 100 PowerDesigner Defining simple content properties A sim ple content allow s you to extend or restrict th e values of a complex ty pe supportin g character data or a sim ple type. It cannot contain elements . The General page of a s im ple content property sheet allows y ou to define an id for the simple content.
Chapter 2 Building an XML model XSM Us er 's G ui de 101 Defining complex content properties A com plex content allow s you to extend or restrict the v alues of a complex type w ith mix ed content (character data and elem ents) or elements only .
Defining derivations 102 PowerDesigner Defining deriv ations You use d eriva tions when you want to exte nd or restr i ct the val ues of simple and com p lex ty pes.
Chapter 2 Building an XML model XSM Us er 's G ui de 103 Gener ated sc hema: The General page of an extension property sheet displays the follow ing properties: Property Description ID ID of the e xtension.
Defining derivations 104 PowerDesigner 4 Type an ID an d select a base ty pe. 5 Click OK. Deriving by restriction You derive a simple ty p e or a complex ty pe by restriction w hen y o u w ant to restrict the valu es of their base ty pe.
Chapter 2 Building an XML model XSM Us er 's G ui de 105 The General pag e of a sim ple type res triction property s heet display s the following properties: Property Description ID ID of the simple ty pe restriction.
Defining derivations 106 PowerDesigner Icon Facet Description Fraction dig its Maxim um numbe r of decim al digits in the fra ctional par t Whitespace Way o f handli ng white spaces. If the value is Preserve , white spaces are u nchanged . If the value is Replace , tabs, lin e feeds an d carriage returns are rep laced with spaces.
Chapter 2 Building an XML model XSM Us er 's G ui de 107 For exam ple: the m eetings s imple ty pe, based on the xs:g MonthDay data ty pe, is rest ricted to th e follow ing date s: 01/20, 03/20, 05/ 20 and 07/20.
Defining derivations 108 PowerDesigner For exam ple: the zipCode si mple type, bas ed on the xs:s tring data ty pe, is restricted to the following pattern: tw o uppe r case letter s, from A to Z, follow ed by a five- digit number, each digit ranging f rom 0 to 9.
Chapter 2 Building an XML model XSM Us er 's G ui de 109 2 Select Restri ction in the dropdown listbox of t he Deriv ation box . 3 Click Apply. 4 Click the Prop erties tool besid e the Derivation box. The restriction property sheet appears. 5 T ype an ID and a base ty pe for the simple ty pe restriction.
Defining derivations 110 PowerDesigner If y ou select Em bedded ty pe, the base t ype dis appears and a sim p le type is created in the schem a with in the current sim ple type. Click Apply, and then the Properties tool beside the Em bedded type box, to def ine a derivati on and a base t ype f or the embedded sim ple type.
Chapter 2 Building an XML model XSM Us er 's G ui de 111 10 Type an ID and select the Fix ed box, if needed. 11 Click OK. Enumeration and Pattern facets For Enum eration and Pattern facets, click.
Defining derivations 112 PowerDesigner The Content box is set to Co mplex. 2 Click Apply. 3 Click the Prop erties tool besid e the Derivation box. The restriction property sheet appears. 4 T ype an ID and a base ty pe for the complex ty pe restriction.
Chapter 2 Building an XML model XSM Us er 's G ui de 113 To define a simple type derivation by list: 1 Select Lis t in th e Derivation dropdow n listbox of a simpl e ty pe property sheet. 2 Click Apply. 3 Click the Prop erties tool besid e the Derivation box.
Defining derivations 114 PowerDesigner The General pag e of a si mple t ype u nion property sheet di splay s the following properties: Property Description ID ID of the sim ple type union. Its value m ust be of ty pe ID and unique w ithin the m odel containing the simple ty pe union Member Ty p es White space separated list of built-in data types.
Chapter 2 Building an XML model XSM Us er 's G ui de 115 Defining annotations You d efine a nno tati o ns when you want to ad d infor mation a b out a n XML model .
Defining annotations 116 PowerDesigner This global annotation is composed of a documentation, w ith a well- formed XML conten t (extract of a DTD file), and an application inf ormation.
Chapter 2 Building an XML model XSM Us er 's G ui de 117 You can dis p lay a docum entation property sheet: ♦ By double-clickin g its nam e o r icon in the Browser tree vi ew ♦ By double-clic.
Defining annotations 118 PowerDesigner A pplication inform a t i on cont ent The Content page of an application information property sheet allow s you to w rite or paste any well-form ed XML content. Creating an annotation You can create a gl obal annotation f r om the Item s page or the Ex ternal Schem as page of a m odel property s heet.
Chapter 2 Building an XML model XSM Us er 's G ui de 119 6 T ype an ID for the ann otation. 7 Click OK..
Defining notations 120 PowerDesigner Defining notations Notations allow y o u to d e fine and process non-XML objects within an XML model . For exam ple: picture files w ith a .GIF extension. Gener ated sc hema: Notations are not available on models targeted w ith XDR.
Chapter 2 Building an XML model XSM Us er 's G ui de 121 Creating a notation You can create a notation : ♦ From th e B row ser tree view ♦ From the Li st of Notations in the Model menu To create a notation from the Brow ser tree view: 1 Right-click the n ame or the icon of the m odel to display the contex tual menu.
Defining entities 122 PowerDesigner Defining entities Entities enable y ou to include predefined values, external XML o r 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 th is entity ref erence by its value defined in th e DTD file of the XML docum ent.
Chapter 2 Building an XML model XSM Us er 's G ui de 123 Property Description Value Value of the entity. A string of cha racter s in the case of a predef ined value. A URI in the ca se of an XML or a non-XML file. For e xam ple: http://som ething.
Defining entities 124 PowerDesigner 4 T ype a valu e. 5 Click OK..
Chapter 2 Building an XML model XSM Us er 's G ui de 125 Defining import, in clude and redefine Import, Include and Redefine allow you to enrich y our XML m odel with external n ames paces, schem a files or schem a components. Import, In clude and Redef ine are only av ailable in a m odel targeted w ith XSD.
Defining import, include and redefine 126 PowerDesigner Property Description Comm ent Descriptive labe l of the import Stereot ype Sub- classification used to extend t h e semantics of an ob ject without c hanging its structure.
Chapter 2 Building an XML model XSM Us er 's G ui de 127 Defining an include An in clude allow s you to in clude a specified schema f ile in the target nam espace of the cu rrent schem a.
Defining import, include and redefine 128 PowerDesigner Creating an include You can create an in clude: ♦ From th e B row ser tree view ♦ From th e List of Includes in the Model m enu To create an include from the Brow ser tree view: 1 Right-click the n ame or the icon of the m odel to display the contex tual menu.
Chapter 2 Building an XML model XSM Us er 's G ui de 129 With a redefine, y ou can use sch ema compon ents from any sch ema w ith the sam e target nam espace as the current schem a or with n o specified targ et nam espace. In a schem a, a redefine is declared w ith the <redefine> tag .
Defining import, include and redefine 130 PowerDesigner The Item s page of a redefine property s heet display s a list of item s to be redefin ed. Tool Tooltip Description Group Adds a group of elem e.
Chapter 2 Building an XML model XSM Us er 's G ui de 131 3 Define redefi ne properties in th e diff erent pages . 4 Click OK..
Defining business rules 132 PowerDesigner Defining business rules You can def ine busi ness ru les in an XML model and attach th em to objects. What is a business rule? A business rule is a w ritten statement specify ing w hat an XML model mu st contain or how it mus t be structured to s upport bus iness needs.
Chapter 2 Building an XML model XSM Us er 's G ui de 133 You can de fine several types o f business rules in an XML model: Ty pe Description Example Constrai nt Additional chec k constr aint on a.
Defining business rules 134 PowerDesigner To create a business rule from the List of Business Rules: 1 Select Model → Business Rule s to displa y the List of Busine ss Rule s. 2 Click the Add a Row tool. or Click a blank line in th e list. A rule appears w ith generic nam e, cod e and rule type (Definition, by default).
Chapter 2 Building an XML model XSM Us er 's G ui de 135 6 In the General page, select a busin ess rule ty pe in the Type dropdow n listbox. 7 Click OK. A pplying a business rule to an XML object Once you have d efined a b usiness rule in the List o f Business Rules, you ca n apply this business rule to an XML object.
Defining business rules 136 PowerDesigner To apply a business rule to an XML object: 1 Double-click an object in the m odel to display the object property sheet. 2 Click the Rules tab to disp lay th e Rules page. 3 Click the Add Rules tool to d isplay the list of business rules.
Chapter 2 Building an XML model XSM Us er 's G ui de 137 4 Select the busines s rules y ou wan t to add to the object. 5 Click OK. The busines s rules are added to th e obj ect and appear in th e list of business rule s fo r the ob jec t . 6 Click OK.
Defining business rules 138 PowerDesigner.
XSM Us er 's G ui de 139 CHAPTER 3 Working w ith an XML model This chapter describes h o w you can w ork with an XML m odel and how y ou can gen erate an XML m odel from a PDM or an OOM. When building an XML m odel, you can check the validity of y our model at any time, w ith the Check Model feature.
Checking an XML model 140 PowerDesigner Checking an XML model The XML Model is a very flexible tool. It should allow you to build y our model w ithout any controls or constraint s on data exch ange an d consisten cy of the system.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 141 These m essag es represent tw o different lev els of problem severity . You can modif y the level of problem s everity for each object param eter verified by the Check m o d el. This severity level can depend on the degree of normalization you want to ac hieve in your model.
Checking an XML model 142 PowerDesigner Checking an XML model You can check the validity of an XML m odel at any time. To check an XML model: 1 Select T ools → Check Model. or Righ t-click th e diagram backgroun d and select C heck Model from the contextual m enu.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 143 7 Click an object tab at the bo ttom of th e Selection page. The corresponding object page displays all the objects in the cu rrent XML m odel. 8 Select check boxes on ly f o r obj ects y ou w ant to be checked.
Checking an XML model 144 PowerDesigner The Check Model Resu lt List dis plays errors and warn ings based on the check o ptio ns you have d efined . Dockable result w indow When you rig ht-click an object p arameter in the Resu lt List, a contextu al men u appears listin g corr ection options.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 145 Making corrections based on XM L model check results You use th e Check Model feature to locate and correct problem s in an XML model .
Checking an XML model 146 PowerDesigner Making manual correcti ons t o an XML model Some errors cannot be corrected auto m atically, they have to be corrected manually. To make manual corrections to an XML model: 1 Select an object parameter from the Result Lis t.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 147 XML Model objects v erified by Check Model The Check Model verifies the validity of XML m odel ob j ects. When errors are en countered du ring a check m odel, corrections can be m ade man ually or autom atically.
XML Model objects verified by Check Model 148 PowerDesigner Model check This check only applies to models built on a schem a. During a m odel check, the f ollowin g object controls are made. Identifi er uniqueness Two or more objects cannot have the same identif ier (ID).
Chapter 3 W orking with an XML model XSM Us er 's G ui de 149 Missing namespaces There should be at least on e namespace defi ned for the m odel. Manual correction Automatic correction Ty pe a URI and a pref ix in the Namespaces page of the model p roperty sheet Adds the target n amespace URI and a pref ix “ns ” follow ed by a num ber (e.
XML Model objects verified by Check Model 150 PowerDesigner Data source name and code uni queness There cannot be tw o data sources with iden tical names and/or codes in a model .
Chapter 3 W orking with an XML model XSM Us er 's G ui de 151 Embedded fil e nam e uni queness A m o del cannot contain tw o embedded files w ith identical nam es.
XML Model objects verified by Check Model 152 PowerDesigner Include check During an include check, the follow ing object control is m ade. Undefined schema location You must de fine a sche ma locat ion for an incl ud e. Manual correction Automatic correction Define a URI or select a sch ema f ile for the schema locat ion.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 153 Existence of at t r i but e A complex type should have at least one attribute. Manual correction Automatic correction Define an attribute f or the com plex ty pe — Existe nce of p article A com plex type m ust cont ain elem ents, grou ps, grou p particles an d/or Any .
XML Model objects verified by Check Model 154 PowerDesigner Undefined ref er ence An elem ent with out a defin ed data type m ust have a ref erence. Manual correction Automatic correction In the el em.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 155 Group check During a group check , the followin g object controls are m ade. Group name and code uni queness A m odel cannot contai n tw o groups w ith identical nam es and/or codes.
XML Model objects verified by Check Model 156 PowerDesigner A ttribute check During an attribute check, the follow ing object controls are m ade. A ttribute name and code uniqueness The parent of an attribute cannot contain tw o attr ib utes w ith identical names and/or codes.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 157 Notation nam e and code uni queness A m o del cannot contain tw o notations w ith identical names and/or codes.
XML Model objects verified by Check Model 158 PowerDesigner Existence of at t r i but es An attribu te group m ust contain at leas t one attribute. Manual correction Automatic correction Add a ttribut.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 159 Existence of com ponent A redefine m ust contain at least one of the followin g items : simple ty pe, compl ex ty pe, group or attribu te group.
XML Model objects verified by Check Model 160 PowerDesigner For more in form ation on XPath expres sions , see section Def ining an identity cons traint selector in chapter Building an XML m od e l. Key Ref check During a k eyRef check , the followin g object controls are m ade.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 161 Undefined select or You m ust define an XPath ex pression for a key Ref selector attribute. Manual correction Automatic correction In the ke yRef property sheet, def ine an XP ath expressi on for th e sel ector attrib u te.
XML Model objects verified by Check Model 162 PowerDesigner Undefined Select or You m ust define an XPath expressi on for a un ique constraint selector attribute. Manual correction Automatic correction In the unique c onstraint pr operty sheet, def ine an XPat h expre ssion for the unique constr aint sele ctor attribute .
Chapter 3 W orking with an XML model XSM Us er 's G ui de 163 Replication check During a replication check, the follow ing object control is made. Partial o bject rep lication A replica object is p a r tially synch ronized with its replicated object.
XML Model objects verified by Check Model 164 PowerDesigner Undefined base ty pe You m ust define a bas e type w hen y ou derive a sim ple or a complex type by restriction .
Chapter 3 W orking with an XML model XSM Us er 's G ui de 165 Simple ty pe union check During a s imple type un ion check, the follow ing object control is m ade. Undefined base ty pe You m ust define at least tw o data types w hen y ou derive a sim ple type by union.
Mapping objects in an XML model 166 PowerDesigner Mapping objects in an XML model Object mapping is the ability to establish a correspondence between objects belo nging to he tero geneous mod els and diagr ams.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 167 Data source propert i es i n an XM L model To display a dat a source property sheet, double- click its n am e or its icon in the Brow ser tree view .
Mapping objects in an XML model 168 PowerDesigner 5 Click the Proper ties to ol to display the data source prop erty sheet. 6 In the General page, select a model type i n the Model Type dropdow n listbox. 7 In the Models pag e, click the A dd Models tool.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 169 Mapping XML M odel objects to PDM objects You can m ap elements or com plex types an d their correspondin g attributes to PDM objects.
Mapping objects in an XML model 170 PowerDesigner In the Mapping page, you can u se the follow ing tools to select a data sou rce for the curren t elemen t: Tool Description Adds a mappin g between th e cu rrent element an d an exist ing dat a source.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 171 You ha ve to use t he Map p ing pa ge of a co mplex type p rop erty shee t to de fine compl ex ty pe mappin gs. For more in formation on how to select a data s ource, see section Mapping elem ents.
Mapping objects in an XML model 172 PowerDesigner For more in formation on how to select a data s ource, see section Mapping elem ents. The Element Sou r ces page allows y ou to associate one or several class es in the data source to the cu rrent elem ent.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 173 2 Select the Mappin g tab to dis play the Mappin g page. 3 Click the Add a Mappin g for a Data Source tool to select a data s ource for th e mappi ng. or Select a data s o urce in the Mappin g For dropdow n listbox if y ou have already s elected one or several data s ources.
Mapping objects in an XML model 174 PowerDesigner 8 Select the Attributes Mapping tab in the Mapping page. 9 Click the Add Mapping tool to disp lay an attribute selection box. Create From Sources and Generate Mapping tools Click the C reate From Sou rces tool to automatically create attr ib utes from the colum ns selected in the data source.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 175 Modifying the mapping of an attribute You can m odify the def ault mapping creat ed for an attribute.
Manipulating XML objects graphically 176 PowerDesigner Manipulating XML objects graphically The graphical interf ace of Po werDesigner allow s you to man ipulate XML objects with in or between th e Browser tree v iew and the diag ram wi ndow . A global object is right under the m o del item in th e B rowser tree view .
Chapter 3 W orking with an XML model XSM Us er 's G ui de 177 Global objects You can m ove global objects with in or betw een the Browser tree v iew and the diag ram w indow . Mov e Select Tools → General Options to make sure that Move is the Def ault action of the Drag & Drop option.
Manipulating XML objects graphically 178 PowerDesigner If the n ew g lobal obj ect does not appear in th e diagram, select Sy mbol → Show Sy mbols and click the corres ponding tab t o select th e object sy mbol . Job is a child elem ent of the C ustomer elem ent.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 179 Comparing and merging XML models You c a n compa re and merge two XM L model s with the same XML la nguage. The comparison process allow s you to highlight the d iffere nces b etween two XML m odels.
Generating an XML model from a Physic al Data Model 180 PowerDesigner Generating an XML model from a Phy sical Data Model This section explains how to generate an XML model from a Phy sical Data Model.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 181 Select Sym bo l → Show Sym bols to reveal th e other generat ed XML Model objects (sim ple types an d complex ty pes).
Generating an XML model from a Physic al Data Model 182 PowerDesigner You can generate a PDM into an existin g XML m od e l. If y o u choos e to update an exis ting XML model w hen the curren t P DM has never been generated, th e Select m odel dropdown listbox is em pty by default.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 183 Option Description Save gener a t ion depende ncies W hen selected, PowerDe signer k eeps track of the identity of each generated object . It is useful when merging two XM L mode ls whic h have been g enera ted fr om the sam e P DM.
Generating an XML model from a Physic al Data Model 184 PowerDesigner Generating a new XM L model from a PDM You can g enerate an XML model f r om a PDM or from a pack age in a PDM. PowerDesig ner creates a new XML model con taining all the objects that y o u selected to generate in the XML model.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 185 5 Click the Detail tab to define options and generation parameters. 6 Click the Target Mod els tab to select the target models of shortcuts in the current m odel. 7 Click the Selection tab to disp lay the Selection page.
Generating an XML model from a Physic al Data Model 186 PowerDesigner You can only generate an XML model f rom th e active PDM diagram w indow . To update an existing XM L model by generating from a PDM : 1 Select T ools → Generate XML Model to d isplay the XML Mo d el Generati on Option s dialog box.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 187 4 Click the Detail tab to define options and generation parameters. 5 Click the Target Mod els tab to select the target models of shortcuts in the current m odel. 6 Click the Selection tab to disp lay the Selection page.
Generating an XML model from an Object- Oriented Model 188 PowerDesigner Generating an XML mode l from an Object- Oriented Model This section explain s how to gen erate an XML m odel from an Object- Oriented Model.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 189 XML model naming conventions If th e code of th e generat ed XML m odel objects does not correspon d to the ta r get la ngua ge naming conve ntions, you can de fine a c o de na ming convent ion scr i pt to c onvert o bj ect names into cod es.
Generating an XML model from an Object- Oriented Model 190 PowerDesigner You can generate an OOM in to an existin g XML m o d e l. If y o u choos e to update an exis ting XML model w hen the curren t OOM has never been generated, th e Select m odel dropdown listbox is em pty by default.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 191 Option Description Save gener a t ion depende ncies W hen selected, PowerDe signer k eeps track of the identity of each generated object . It is useful when merging two XM L mode ls whic h have been g enera ted fr om the sam e OOM.
Generating an XML model from an Object- Oriented Model 192 PowerDesigner Generating a new XM L model from an OOM You can g enerate an XML model f rom an OOM or from a package in an OOM. PowerDesig ner creates a new XML model con taining all the objects that y ou selected to generate in the XML model.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 193 5 Click the Detail tab to define options and generation parameters. 6 Click the Target Mod els tab to select the target models of shortcuts in the current m odel. 7 Click the Selection tab to disp lay the Selection page.
Generating an XML model from an Object- Oriented Model 194 PowerDesigner You can only generate an XML model f rom th e active OOM diagram w indow . To update an existing XM L mode l by generating from an OOM: 1 Select T ools → Generate XML Model to d isplay the XML Mo d el Generati on Option s dialog box.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 195 4 Click the Detail tab to define options and generation parameters. 5 Click the Target Mod els tab to select the target models of shortcuts in the current m odel. 6 Click the Selection tab to disp lay the Selection page.
Editing an XML model report 196 PowerDesigner Editing an XML model report You can edit a report of y our XML m odel. The Report Ed ito r allows y ou to use a predefined repo r t template or to b uild you r own report. For more information on reports, see the Reports User’s Guide .
Chapter 3 W orking with an XML model XSM Us er 's G ui de 197 The List of Reports appear s. I t displays the alph abetical list of all repor ts saved in the m o del. If there are no existing reports, all the tools in the List of Reports dialog box are gray ed, except for th e New Report tool.
Editing an XML model report 198 PowerDesigner Language in a template When you use a templ a te cr eate d in a la nguage d i fferent fr om the o n e you select to create y o ur report, only user-def ined items su ch as T itle or T ext par agraph will keep the la nguage of the template.
Chapter 3 W orking with an XML model XSM Us er 's G ui de 199 In the f ollowin g structu r e, the graphical representation of the diagram w ill appear in th e report just bef ore the descript ive paragraph s. To have a preview of y our re p o rt, click the Print Preview tool in th e Rep ort Editor window .
Editing an XML model report 200 PowerDesigner.
XSM Us er 's G ui de 201 CHAPTER 4 Generating and reverse engineering an XSD, a DTD or an XDR file This chapter describes h o w to generate an d reverse en gineer an XML Schem a Definition file (.XSD), a Docum ent Type Definition file (.DTD) or an XML- Data Reduced file (.
Generating an XSD, a DTD or an XDR file 202 PowerDesigner Generating an XSD, a DTD or an XDR file PowerDesign er allows y ou to generate an XSD, a DTD or an XDR file from an XML m odel. File preview You can hav e a preview of an XSD, a DTD or an XDR file by clicking the Preview tab of an XML model property sheet.
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 203 Defining generation parameters You c a n define vario us par ameters b efor e gener ating a n X SD, a D TD o r an XDR file. Check model You can check your model bef o re generation if you select the C heck m odel check b ox.
Generating an XSD, a DTD or an XDR file 204 PowerDesigner Defining gener at ion options If you do not see the Options page in th e Generation dialog box, it means th at no op tio n ha s bee n d efine d in the c orr espo nding XM L language (.XS L file) .
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 205 How to generate an XSD, a DTD or an XDR file? The type of ge ne rate d file d epe nds on which XM L language the mode l has been targeted w ith: Model targeted with Generated file XML Sche ma Def inition 1.
Generating an XSD, a DTD or an XDR file 206 PowerDesigner 2 T ype a destination directory for the gen e r a ted file in th e Directory box. or Click the Sel ect a Path bu tton besi de the Direct ory box and browse t o select a directory path.
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 207 A Result box appears indicating that the XSD, DTD or XDR file has been generated in the destination directory. The result is also disp layed in the Generation page of the Output wi ndow, located in the bottom part of th e main w indow.
Reverse engineer ing an XSD, a DTD or an XDR file 208 PowerDesigner Rev erse engineering an XSD, a DTD or an XDR file PowerDesigner allow s you to reverse engineer an XML Schema Definition file, a Docum ent T ype Def inition file or an XML -Data Reduced file to create or update an XML m odel.
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 209 Reverse engi neer i ng opt i ons The O ptio ns page o f the Rever se Engine ering d i alog b ox.
Reverse engineer ing an XSD, a DTD or an XDR file 210 PowerDesigner The New XML Model dialog box appears. 2 In the G enera l page , sele ct an XM L language in the XM L language dropdow n li stbox.
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 211 6 In the Options page, click the Select a File tool beside the File name box to select the XSD, DTD or XDR file you w ant to reverse engineer. Select or clear options (See Reverse engi neering o ptio ns).
Reverse engineer ing an XSD, a DTD or an XDR file 212 PowerDesigner 9 Click OK. The XML diagram corresponding to the rev erse engineered XSD, DTD or XDR file appears in the diagram w indow. The Brow ser tree view reveals the new XML model with all its objects.
Chapter 4 Generating and rev erse engineering an XSD, a DTD or an XDR file XSM Us er 's G ui de 213 The Merge Models dial og box appears , w ith th e newly generated XML model in the lef t pane, and the existing XML m odel in the right pane.
Reverse engineer ing an XSD, a DTD or an XDR file 214 PowerDesigner.
XSM Us er 's G ui de 215 CHAPTER 5 Exchanging data w ith databases supporting XML This chapter describ e s how to use an XML m ode l to store or retrieve da ta in databases supporti ng X ML.
Why use XML in databases? 216 PowerDesigner Why use XML in databases? XML is becom ing a univ ersal data exchange f ormat. A n XML f ile can be read with an y plain tex t editor. Mo st o f relatio nal d atab ases (RDB) now support XML so that y ou can st ore or retrieve data thro ugh XML file s.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 217 Generating an annotated schema for Microsoft SQL Serv er 2000 Microsoft SQL S erver 2000 is an XML-enable d database se rver. It su pports annotations that can be used on XSD or XDR files, to map XML data to relational data.
Generating an annotated sc hema for Microsoft SQL Serv er 2000 218 PowerDesigner To generate an annotated schema by mapping through the XML Builder Wizard: 1 I n the P D M menu bar , select T oo ls → XML Builder Wizard. The Model Selecti on dialog box appears.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 219 The Tables and Views Selection dial og box appears w ith the PD M tables list. All tables are selected by default. 4 <o p tional> Click the Deselect All tool an d select the tables y ou want to generate into XML elem ents.
Generating an annotated sc hema for Microsoft SQL Serv er 2000 220 PowerDesigner The XML Hierarchy Design dialog box appears. 6 Click the Elem ent radio button, if you wan t to create columns as elemen ts. or Click the Attribu te radio button, if y ou wan t to create colum ns as attributes.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 221 7 Drag and drop tables from left to righ t panel, an d build an XML hierarchy .
Generating an annotated sc hema for Microsoft SQL Serv er 2000 222 PowerDesigner In the case of an existing XML m odel, the generated elem ents appear next to the ex isting elem ents. Extended model definitions The SQL/XML extended model definition is automatically attached to the generated XML m odel.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 223 11 In th e XM L in Database page, select Microsoft SQL Serv er. Note: In the General Purpos e page, y ou can select the XML Docum ent extended model definition to generate a sim p lified XML file that w ill help you und ersta nd the anno tate d schema.
Generating an annotated sc hema for Microsoft SQL Serv er 2000 224 PowerDesigner The Generati on dialog box appears w ith Micros oft SQL Serv er selected in the Targets page. 15 Click the Select a Path bu tton, beside the Direct ory box , to select a path for the annotated schem a file.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 225 The annotated sche ma appears in the editor w indow. Note the SQL nam espace (with th e sql prefix) and th e SQL annotations for tables (sql:relation), co lum ns (sql:field) and reference (sql:relationship).
Generating an annotated sc hema for Microsoft SQL Serv er 2000 226 PowerDesigner To generate an annotated schema by reinforcing mapping w ith extended attributes: 1 Do uble-click an elemen t sym b o l in the diagram to d isplay its property sheet.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 227 Annotation E A Description key-fields 9 — Allow s specifica tion of colum ns that uniquely identify the rows in.
Generating an annotated sc hema for Microsoft SQL Serv er 2000 228 PowerDesigner 5 Sele c t Language → Generate XML Schem a Definition File. or Selec t Language → Generate XML-Data Reduced File. The Generati on dialog box appears w ith Micros oft SQL Serv er selected in the Targets page.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 229 8 Click Edit. The annotated sche ma appears in the editor w indow. Note the SQL nam espace (with th e sql prefix) and th e SQL annotations for tables (sql:relation), co lum ns (sql:field) and reference (sql:relationship).
Generating an annotated sc hema for Oracle 9i2 230 PowerDesigner Generating an annotated schema for Oracle 9i2 Oracle 9i2 is a database serv er with a native XML storage an d retrieval technology called Oracle XML DB. There is no mapping betw een XML data and relational data.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 231 The Extended Model Definition Selection dialog box appears. 3 In the XML in Database pag e, select Oracle XML DB 9.2. 4 Click OK. Oracle XML DB 9.2 appear s in the List of Extended Model Definitions.
Generating an annotated sc hema for Oracle 9i2 232 PowerDesigner 7 In the Extended Attributes page, ty pe the nam e of a table or a column in the Value colum n of the SQLName annotati o n, if you want to c reat e a table or a colum n from the s elected elemen t.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 233 Annotation Description javaClassname Used to sp ecify the name of a Java class that is deri ved from the corresponding bean class, to e nsure that an object o f this class is i n stantiat ed duri ng bean access.
Generating an annotated sc hema for Oracle 9i2 234 PowerDesigner 11 In the Exten ded Attributes page, type the n ame of an abstract data type (ADT) in the Value colum n of the SQLType anno tatio n, if you want to create an ADT from the selected complex type.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 235 15 In th e Extended Attribu tes page, you can select a value (f alse or true) for the followi ng annotations: Annotation Description ma pUnboundedStringToL ob If true, unbounded s trings are ma pped to CLOB by de fault.
Generating an annotated sc hema for Oracle 9i2 236 PowerDesigner The Resu lt dialog box appears w ith the pat h of th e generated sch em a file. 20 Click Edit.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 237 Generating a DA D file for IBM DB2 IBM DB2 v8.1 (or hig her) is a database se rver w ith an add-i n for XML storage and retrieval called IBM DB2 Extender.
Generating a DAD file for IBM DB2 238 PowerDesigner The Model Selecti on dialog box appears. 2 Select the new model option. Type a nam e and a code for the new model , and select Docum ent Type Def inition 1.0 in t he XML la nguage dropdow n li stbox.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 239 The Tables and Views Selection dial og box appears w ith the PD M tables list. All tables are selected by default. 4 <Op tio nal> Click the Deselect All tool and select the tables you w ant to generate into XML elem ents.
Generating a DAD file for IBM DB2 240 PowerDesigner The XML Hierarchy Design dialog box appears. 6 Click the Elem ent radio button, if you wan t to create columns as elemen ts. or Click the Attribu te radio button, if y ou wan t to create colum ns as attributes.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 241 7 Drag and drop tables from left to righ t panel and buil d an XML hierarchy .
Generating a DAD file for IBM DB2 242 PowerDesigner In the case of an existing XML m odel, the generated elem ents appear next to the ex isting elem ents. Extended model definitions The SQL/XML extended model definition is automatically attached to the generated XML m odel.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 243 11 In the XML in Database page, select IBM DB2 DAD. Note: In the General Purpos e page, y ou can select the XML Docum ent extended model definition to generate a sim p lified XML file that w ill help you und ersta nd the anno tate d schema.
Generating a DAD file for IBM DB2 244 PowerDesigner 15 In the Exten ded Attributes page, click the DB2XM LExtender tab and select a value f or the StorageType (Xcollection or Xcolum n). In the case of an Xcollection , select a value for the MappingTy pe (RDB or SQL).
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 245 Extended attribute Description Stor ageName If StorageType is X colu mn, t hen it i s the name of the s idetable colum n Storage Type T ype of st orage (Xcollection or Xcolum n) 16 Click OK.
Generating a DAD file for IBM DB2 246 PowerDesigner 19 <optional> In the Options page, generation options are set by default. You can chan ge their value.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 247 The Resu lt dialog box appears w ith the pat hs of the gen erated DAD, DTD and SQL files. 22 Select the path of a DA D file and click Edit. The selected DAD file appears in the Editor win dow.
Generating a DAD file for IBM DB2 248 PowerDesigner ♦ DAD file defin ed with Xcolumn as Storag eT ype: 23 Repeat st ep 22 to edit another DA D file. or Click Close in the Result dialog box.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 249 Generating SQL/XML queries SQL/XM L i s an XML e xtensio n o f the Str ucture d Quer y Language. W ith SQL/XML, y ou retr ieve relatio nal data using extended SQL sy ntax, and pro duce a resul t using XML.
Generating SQL/XML queries 250 PowerDesigner The List of Extended Model Definitions appears. 2 Click the Import an Extended Model Definition button. The Extended Model Definition Selection dialog box appears. 3 In the General Purpose page, select SQL /XML.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 251 The SQL/XML extended m o del definition appears in the Browser tree view , attached to the model. 6 < o p tio nal > Double-click a gl obal elem ent in the diagram to display its property sheet.
Generating SQL/XML queries 252 PowerDesigner The Generation dialog box appears w ith SQL/XML selected in the Targ ets pag e. 10 Click the Select a Path bu tton beside the Direct ory box to select a path for t he SQ L/ XML q ueri es.
Chapter 5 Exchanging data with databas es supporting XML XSM Us er 's G ui de 253 11 In the Selection page, select the global elem ents for which y ou want to generate a SQL /XML query . (Only one g lobal elemen t in the example) 12 Click OK. The Result dialog box appears w ith a path for each SQL/ XML query .
Generating SQL/XML queries 254 PowerDesigner 14 Repeat st ep 13 to edit another SQL /XML query. or Click Close in the Result dialog box. Once generated, SQL/XML queries are processed by SQL interpreters in databases supporti ng XML.
XSM Us er 's G ui de 255 CHAPTER 6 Generating from an XML model This chapte r describes h ow t o generate an XML m odel from an XML m odel. Topic Page Ge neration ba sics 256 Ge nerating an XML m.
Generation basic s 256 PowerDesigner Generation basics You can g enerate an XML m odel from an XML m odel. There are two options to generate an XML m odel from an XML m od el: Generation option Descri.
Chapter 6 Generating from an XML model XSM Us er 's G ui de 257 The model generation process allows y ou to define the target object of a shortcut in a generated m odel.
Generation basic s 258 PowerDesigner You can also preserv e the link between an external replication and its targ et model t hrough ge ne rati o n. For more information on th e generation of object rep licatio ns, see section Generating replications, in chapter Managin g Obj ect Replications, in the General Featur es Guide .
Chapter 6 Generating from an XML model XSM Us er 's G ui de 259 Generating an XML mode l from an XML model This section explains how to generate an XML model from an XML m od el.
Generating an XML model from an XML model 260 PowerDesigner For more information on model options wh en generating an XML model from an XML m o d el, see section Definin g model optio ns in chapter XML Model Bas ics. You can generate an XML model into an existing XML m odel.
Chapter 6 Generating from an XML model XSM Us er 's G ui de 261 Defining gener at ion options The Detail page of the XML Model Generation Options dialog box displays the followin g options: Optio.
Generating an XML model from an XML model 262 PowerDesigner You can only generate an XML model from the active XML m odel d iagram. To generate a new XM L model from an XM L model: 1 Select Tools → Generate XML Model to disp lay the XML Model Generati on Option s dialog box.
Chapter 6 Generating from an XML model XSM Us er 's G ui de 263 11 Select the ch eck boxes f or the objects you wan t to generate, and clear the check box es for the objects y ou do not wan t to generate. 12 Click OK. The Output w indow show s the progress of the generati on process.
Generating an XML model from an XML model 264 PowerDesigner 3 Select a m odel from th e Select model dropdow n listbox , if the current model h as already been gen erated. or Click the Ellips is button , beside the Select m odel dropdown listbox , and select a m odel model available in the workspace in th e Select a model dialog box .
Chapter 6 Generating from an XML model XSM Us er 's G ui de 265 9 Click OK. If y o u selected the Preserve modif ications check box, th e Merge Models w indow appears. If y o u cleared the Preserve modif ications check box, th e updated XML model diag ram appears in the w ork area.
Generating an XML model from an XML model 266 PowerDesigner.
XSM Us er 's G ui de 267 XML Model Glossary A grou p particle indicating th at child elements can appear in any order, each of th em on ce or not Additional inform ation about a model and its obj.
XML Model Glossary 268 PowerDesigner Derivation of a complex ty pe to extend the values of its base type A constraint on th e set of values of a sim p le type An XPath ex pression th at specifies the value (or on e of the v alues) us ed to define an identity constraint (unique, key or keyRef) A gl obal object has a g lobal scope.
XML Model Glossary XSM User’s G uide 269 A nam e beginnin g w ith a prefix and a colon (:). The prefix is associated w ith a nam espace URI. For exam ple: xs:schem a, xs being associated w ith ht t p: / /www. w3 . o r g/ 2001/XMLS chem a Relational database.
XML Model Glossary 270 PowerDesigner Derivation of a simple ty pe to r estrict its values to a collection of built-in and simple data types An identity constraint used to specify that an elemen t or attribute value (or set of valu es) m ust be un ique or null w ithin a specified scope Uniform Resource Identifier.
Index XSM Us er 's G ui de 271 A all 53 annotate d schem a for Mic rosof t SQL Se rver 2000 217 for O racle 9i2 230 annotation 115 application inf ormation 115 check 16 5 crea te annota tion 118 .
272 Pow erDesigner C check model 140 annotation 165 attribute 156 attribute g roup 157 autom atic corr ection 140, 145 business rule (X SM) 149 com plex ty pe 152 correct error 145 data sour ce 149 di.
XSM Us er 's G ui de 273 databas e ( continue d ) Orac le 9i2 230 SQL/XML queries 216, 249 XML in data base 216 defa ult 40, 50 deriv ation 102 exte nsion 102 restr iction 104 simple ty pe list 1.
274 Pow erDesigner facet ( continued ) whitespace 1 0 5 fie ld 64, 66, 67, 73 stereotype 73 XPath 73 file check 15 0 fina l 19, 40, 90, 94 fix ed 40, 50, 105 form 40, 50 fra ction digits 104 functiona.
XSM Us er 's G ui de 275 L length 104 level of problem se verity error 140 wa rning 140 link 8, 45, 57, 81, 98 child object to c omplex type 98 child object t o element 45 child object to g roup .
276 Pow erDesigner redef ine 128 check 15 8 create redefine 13 0 schem a location 128 ref erenc e 37, 48, 67, 76, 82 replicat i o n check 1 63 report 196 crea te m odel report 196 underline hie rarchi.
XSM Us er 's G ui de 277 V value attribute (DT D, XDR) 50 element (XDR) 50 W wa rning 140 whitespace 1 0 4 workspace 28 X XDR 3 any 58 attribute ty pe 48 Attribute Ty pe 48 element type 37 Elemen.
278 Pow erDesigner.
Un punto importante, dopo l’acquisto del dispositivo (o anche prima di acquisto) è quello di leggere il manuale. Dobbiamo farlo per diversi motivi semplici:
Se non hai ancora comprato il Sybase XML è un buon momento per familiarizzare con i dati di base del prodotto. Prime consultare le pagine iniziali del manuale d’uso, che si trova al di sopra. Dovresti trovare lì i dati tecnici più importanti del Sybase XML - in questo modo è possibile verificare se l’apparecchio soddisfa le tue esigenze. Esplorando le pagine segenti del manuali d’uso Sybase XML imparerai tutte le caratteristiche del prodotto e le informazioni sul suo funzionamento. Le informazioni sul Sybase XML ti aiuteranno sicuramente a prendere una decisione relativa all’acquisto.
In una situazione in cui hai già il Sybase XML, ma non hai ancora letto il manuale d’uso, dovresti farlo per le ragioni sopra descritte. Saprai quindi se hai correttamente usato le funzioni disponibili, e se hai commesso errori che possono ridurre la durata di vita del Sybase XML.
Tuttavia, uno dei ruoli più importanti per l’utente svolti dal manuale d’uso è quello di aiutare a risolvere i problemi con il Sybase XML. Quasi sempre, ci troverai Troubleshooting, cioè i guasti più frequenti e malfunzionamenti del dispositivo Sybase XML insieme con le istruzioni su come risolverli. Anche se non si riesci a risolvere il problema, il manuale d’uso ti mostrerà il percorso di ulteriori procedimenti – il contatto con il centro servizio clienti o il servizio più vicino.