tailieunhanh - Professional XML Databases phần 5

Chúng tôi thảo luận về các tiêu đề và các thuộc tính của hành vi khi chúng tôi nói chuyện về các liên kết đơn giản. Những người mới là arcrole (mà chúng ta trở lại để sau này) và các thuộc tính traversal. Việc đến và đi từ các thuộc tính được sử dụng trong vòng cung của chính nó để hiển thị directionality. | Relational References with XLink We discussed the title and the behavioral attributes when we talked about simple links. The new ones are arcrole which we come back to later and the traversal attributes. The to and from attributes are used within the arc itself to show directionality. As a value these attributes take the value of the label attribute of the resource or element type elements. In our last example we defined the resource that represented our home with a label of myhouse HOME xlink type resource xlink href xlink label myhouse Now let s modify our earlier extended link so that we have to go to two different stores on our ROUTE the GROCERY store and another resource called BOOKSTORE. Because arcs are describing generic behavior if you use the same label on different resources the arc will define a relationship between all the elements with the same label. If we make the label for both stores a generic store we can see how the arc is extended. The changes have been highlighted here ROUTE xmlns xlink http 1999 xlink xlink type extended xlink title A sample extended link HOME xlink type resource xlink label myhouse address 123 Main St. I live in my home HOME GROCERY xlink type locator xlink href xlink label store BOOKSTORE xlink type locator xlink href xlink label store GETSTUFF xlink type arc xlink from store xlink to myhouse ROUTE The traversal of links now defined allows both the bookstore and the grocery store to be linked into myhouse . We can see this in the following diagram When we define an arc with the to and from attributes this creates a traversal rule. Each traversal rule will explicitly set the behavior for a set of resources. Thus it is significant to note that each arc element within an extended link must define a unique traversal rule. This makes sense because once it is possible to traverse a certain direction from one resource to another there is no need to define that traversal path again. 359 .