xmldb 04 queryi - tu braunschweig · 2008. 11. 18. · •querying xml documents – "querying xml...

63
XML Databases 4. XML Query Languages, 17.11.08 Silke Eckstein Andreas Kupfer Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de

Upload: others

Post on 16-Feb-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • XML Databases4. XML Query Languages, 17.11.08

    Silke EcksteinAndreas KupferInstitut für InformationssystemeTechnische Universität Braunschweighttp://www.ifis.cs.tu-bs.de

  • 4.1 Introduction

    4.2 XPath

    4.3 XPointer

    4. XML Query Languages I

    4.4 XLink

    4.5 Overview

    4.6 References

    2XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Querying XML Documents– "Querying XML data" essentially means

    • to identify (or address) nodes,

    • to test certain further properties of these nodes,

    • then to operate on the matches,

    • and finally, to construct result XML documents as answers.

    4.1 Introduction

    – In the XML context, the language XQuery plays the role that SQL has in relational databases.

    – XQuery can express all of the above constituents of XML querying:• XPath, as an embedded sublanguage, expresses the locate and test

    parts;

    • XQuery can then iterate over selected parts, operate on and construct answers from these.

    • There are more XML languages that make use of XPath as embedded sublanguages.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 3[Scholl07]

  • • Xpath – Navigational access to XML documents

    – In a sense, the traversal or navigation of trees of XML nodes lies at the core of every XML query language.

    – To this end, XQuery embeds XPath as its tree navigation sub-language:

    4.1 Introduction

    sub-language:

    • Every XPath expression also is a correct XQuery expression.

    • XPath 2.0: http://www.w3.org/TR/xpath20/ .

    – Since navigation expressions extract (potentially huge volumes of) nodes from input XML documents, the efficient implementation of the sub-language XPath is a prime concern when it comes to the construction of XQuery processors.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 4

  • • XPath as an embedded sublanguage– XPath is a declarative, expression-based language to locateand test doc nodes (with lots of syntactic sugar to make querying sufficiently sweet).

    – Addressing document nodes is a core task in the XML world.XPath occurs as an embedded sub-language in

    4.1 Introduction

    XPath occurs as an embedded sub-language in• XSLT (extract and transform XML document [fragments] into XML,

    XHTML, PDF, . . . )

    • XQuery (compute with XML document nodes and contents, compute new docs, . . . )

    • XPointer (representation of the address of one or more doc nodes in a given XML document)

    • XMLSchema (represent sets of elements as scopes for uniqueness or key concepts)

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 5

  • • XML Pointer Language

    – Allows to use XPath expressions in URIs

    – Used to identify ranges within XML documents

    • XML Linking Language

    – To define links, which can…

    4.1 Introduction

    – To define links, which can…

    • Be as easy as HTML links

    • Have multiple end points

    • Be stored independently of the referenced documents

    – Allows to add metadata to links

    – Uses XPointer and XPath

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 6

  • 4.1 Introduction

    4.2 XPath

    4.3 XPointer

    4. XML Query Languages I

    4.4 XLink

    4.5 Overview

    4.6 References

    7XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Context node

    – In XPath, a path traversal starts off from a sequence of context nodes.

    • XPath navigation syntax is simple:

    4.2 XPath

    An XPath step

    • It is a common error in XQuery expressions to try and start an XPath traversal without the context node sequence being actually defined.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 8[Scholl07]

    An XPath step

    cs0/step

    • cs0 denotes the context node sequence, from which a navigation in direction step is taken.

  • • Multiple steps

    – An XPath navigation may consist of multiple stepsstepi ,i ≥ 1 taken in succession.

    – Step step1 starts o from the context node sequence cs0 and arrives at a sequence of new nodes cs1.

    4.2 XPath

    arrives at a sequence of new nodes cs1.

    – cs1 is then used as the new context node sequence for step2, and so on.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 9[Scholl07]

    Multi-step XPath path

    cs0/step1/step2/…

    ((cs0/step1)/step2)/…

    cs1

  • • XPath location steps

    – A step (or location step) stepi specifies

    4.2 XPath

    1 n

    XPath step

    ax :: nt [p1] … [pn]

    A step (or location step) stepi specifies

    1. the axis ax, i.e., the direction of navigation taken from the context nodes,

    2. a node test nt, which can be used to navigate to nodes of certain kind (e.g., only attribute nodes) or name,

    3. optional predicates pi which further filter the sequence of nodes we navigated to.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 10[Scholl07]

  • • XPath axes

    – XPath defines a family of 12 axes allowing for flexible navigation within the node hierarchy of an XML tree.

    – XPath axes semantics

    • ○○○○ marks the context node

    4.2 XPath

    • ○○○○ marks the context node

    • @ marks attribute nodes,

    • ● represents any other node kind (inner ● nodes are element nodes).

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 11[Scholl07]

    @@ @@

    @@

    @@

  • • XPath axes: child, parent, attribute

    – The child axis does not navigate to the attribute nodes below ○○○○.

    4.2 XPath

    – The only way to access attributes is to use the attribute axis explicitly.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 12[Scholl07]

    @@ @@

    @@

    @@

  • • XPath axes: descendant, ancestor, self

    – In a sense, descendant and ancestor represent the transitive closures of child and parent,

    4.2 XPath

    closures of child and parent, respectively.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 13[Scholl07]

    @@ @@

    @@

    @@

  • • XPath axes: preceding, following, ancestor-or-self

    – Note: In the serialized XML document, nodes in the preceding (following) axis appear completely

    4.2 XPath

    axis appear completelybefore (after) the context node.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 14[Scholl07]

    @@ @@

    @@

    @@

  • • XPath axes: preceding-sibling, following-sibling, descendant-or-self

    4.2 XPath

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 15[Scholl07]

    @@ @@

    @@

    @@

  • • XPath axes: Examples (1)

    – In these first examples, there is a single initial context node, i.e., a context node sequence of length 1: the root element a.

    • Here, we set the node test nt to simply node() which

    4.2 XPath

    • Here, we set the node test nt to simply node() which

    means to not filter any nodes selected by the axis.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 16[Scholl07]

    XPath example

    (

    f

    )/child::node()

    (

    f

    ,

    )

    ⇒⇒⇒⇒

  • • XPath axes: Examples (2)

    4.2 XPath

    XPath example

    (

    f

    )/attribute::node()

    attribute b { "0" }⇒⇒⇒⇒

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 17[Scholl07]

    )/attribute::node()

    XPath example

    (

    f

    )/descendant::node()

    (f,

    f,

    text { "f" },

    ),

    )

    ⇒⇒⇒⇒

  • • XPath axes: Examples (3)

    4.2 XPath

    XPath example

    (

    f

    )/child::node()/child::node()

    (f,

    )⇒⇒⇒⇒

    – Notes:

    • If an extracted node has no suitable XML representation by itself, XQuery serializes the result using the XQuery node constructor syntax, e.g.,

    attribute b {"0" } or text { "f" } .

    • Nodes are serialized showing their content. This does not imply that all of the content nodes have been selected by the XPath expression!

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 18[Scholl07]

    )/child::node()/child::node()

  • • XPath results: Order & duplicates

    – XPath Semantics: The result node sequence of any XPath navigation is returned in document order with no duplicate nodes (remember: node identity).

    – Examples:

    4.2 XPath

    – Examples:

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 19[Scholl07]

    Duplicate nodes are removed in XPath results . . .

    (

    f

    )/child::node()/parent::node()

    ...

    ⇒⇒⇒⇒

    (

    )/child::node()/following-sibling::node()

    (,

    )⇒⇒⇒⇒

  • • XPath: Results in document order

    – Note:

    4.2 XPath

    XPath: context node sequence of length > 1

    (,

    )/child::node()(,,

    ,)⇒⇒⇒⇒

    – Note:

    • The XPath document order semantics require to occur before and to occur before .

    – The result (,,,) would have been OK as well.

    – In contrast, the result (,,,) is inconsistent with respect to the order of nodes from separate trees!

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 20[Scholl07]

  • • XPath: Node test

    – Once an XPath step arrives at a sequence of nodes, we may apply a node test to filter nodes based on kind and name.

    4.2 XPath

    Kind Test Semantics

    node() let any node pass

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 21[Scholl07]

    node() let any node pass

    text() preserve text nodes only

    attribute() preserve attribute nodes only

    comment() preserve comment nodes only

    processing-instruction() preserve processing instructions

    processing-instruction(p) preserve processing instructions of the form

    document-node() preserve the (invisible) document root node

  • • XPath: Name test

    – A node test may also be a name test, preserving only those element or attribute nodes with matching names.

    4.2 XPath

    NameTest Semantics

    name preserve element nodes with tag name only

    – Note:

    • In general we will have cs/ax::* ⊆⊆⊆⊆ cs/ax::node().

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 22[Scholl07]

    name preserve element nodes with tag name only(for attribute axis: preserve attributes)

    * preserve element nodes with arbitrary tag names(for attribute axis: preserve attributes)

  • • XPath: Node test example

    4.2 XPath

    Collect and concatenate all text nodes of a tree

    string-join

    (AB

    C

    /descendant-or-self::node()/child::text()

    – The XQuery builtin function string-join has signature string-join(string*, string) as string .

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 23[Scholl07]

    , "")

    Equivalent: compute the string value of node a

    string(AB

    C

    )

    "ABC"⇒⇒⇒⇒

  • • XPath: Ensuring order is not for free– The strict XPath requirement to construct a result in

    document order may imply sorting effort depending on the actual XPath implementation strategy used by the processor.

    4.2 XPath

    (

    (,

    ⇒⇒⇒⇒

    • In many implementations, the descendant-or-self::x step will yield the context node sequence (...,... ) for the child::y step.

    • Such implementations thus will typically extract before from the input document.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 24[Scholl07]

    )/descendant-or-self::x/child::y

    (,

    )⇒⇒⇒⇒

  • • XPath: Predicates– The optional third component of a step formulates a

    list of predicates [p1]...[pn] against the nodes selected by an axis.

    – XPath predicate evaluation:

    4.2 XPath

    – XPath predicate evaluation:• Predicates have higher precedence than the XPath step

    operator /,i.e.:cs/step[p1][p2] ≡ cs/((step [p1])[p2])

    • The pi are evaluated left-to-right for each node in turn. In pi, the current context item is available as '.'.

    – Context item: predicates may be applied to sequences of arbitrary items (not only nodes)

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 25[Scholl07]

  • • XPath: Predicates– An XPath predicate pi, may be any XQuery expression evaluating

    to some value v. To finally evaluate the predicate, XQuery computes the effective Boolean value ebv(v).

    4.2 XPath

    Value v ebv(v)

    () false()

    • Item x ∉ {0,""; NaN; false()}, items xi arbitrary. Builtin function boolean(item*) as boolean also computes the eective Boolean value.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 26[Scholl07]

    0, NaN false()

    "" false()

    false() false()

    x true()

    (x1, x2,..., xn) true()

  • • XPath: Predicate example

    4.2 XPath

    Select all elements with an id attribute

    (

    e

    (

    ...

    ,

    ,

    e

    ⇒⇒⇒⇒

    – Note: Existential semantics of path predicates.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 27[Scholl07]

    )/descendant-or-self::*[./attribute::id]

    e

    )

    Select all elements with a "b" grandchild element(

    e

    )/descendant-or-self::*[./child::*/child::b]

    ⇒⇒⇒⇒

  • • XPath: Predicates and atomization

    – In XQuery, if any item x – atomic value or node – is used in a context where a value is required, atomization is applied to convert x into an atomic value.

    • Nodes in value contexts commonly appear in XPath predicates. Consider:

    4.2 XPath

    Consider:

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 28[Scholl07]

    Value comparison in a predicate

    (

    42

    42

    43

    )/descendant-or-self::*[. eq 42]

    (42,

    42,

    42

    )⇒⇒⇒⇒

  • • Atomization– Atomization turns a sequence (x1,...,xn) of

    items into a sequence of atomic values (v1,...,vn):1. If xi is an atomic value, vi ≡ xi2. if xi is a node, vi is the typed value of xi .

    4.2 XPath

    2. if xi is a node, vi is the typed value of xi .

    – Remember: the typed value is equal to the string value if xi has not been validated. In this case, vi has type untypedAtomic.

    – The XQuery builtin function data(item*) as anyAtomicType*may be used to perform atomization explicitly (rarely necessary).

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 29[Scholl07]

  • • XPath: Predicates and atomization–

    4.2 XPath

    Atomization (and casting) made explizit

    (

    42

    42

    43

    – Note: the value comparison operator eq is witness to the value context in which '.' is used in this query.

    – For the context item 42 (a non-validated node), data(.) returns "42" of type untypedAtomic.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 30[Scholl07]

    43

    )/descendant-or-self::*[data(.) cast as double

    eq

    42 cast as double]

  • • Atomization and subtree traversals– Since atomization of nodes is pervasive in XQuery

    expression evaluation, e.g., during evaluation of• arithmetic and comparison expressions,• function call and return,• explicit sorting (order by),

    4.2 XPath

    • explicit sorting (order by),

    – efficient subtree traversals are of prime importance for any implementation of the language:

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 31[Scholl07]

    Applying data() to a node and its subtree

    data(

    foo

    bar

    )

    ≡ data

    a

    ed

    cb

    "fo"

    "o"

    "b" "ar"

  • • XPath: Positional access

    – Inside a predicate [p] the current context item is '.'.

    • An expression may also access the position of '.' in the context sequence via position(). The first item is located at position 1.

    • Furthermore, the position of the last context item is available via

    4.2 XPath

    • Furthermore, the position of the last context item is available via last().

    • A predicate of the form [position() eq i] with i being any

    XQuery expression of numeric type, may be abbreviated by [i].

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 32[Scholl07]

    Positional access

    (x1,x2,...,xn) [position() eq i] ⇒⇒⇒⇒ xi(x1,x2,...,xn)[position() eq last()] ⇒⇒⇒⇒ xn

  • • XPath: The context item '.'– As a useful generalization, XPath makes the current

    context item '.' available in each step (not only in predicates)

    – In the expression

    4.2 XPath

    – In the expressioncs/e

    expression e will be evaluated with '.' set to each item in the context sequence cs (in order). The resulting sequence is returned.

    • Remember: if e returns nodes (e has type node*), the resulting sequence is sorted in document order with duplicates removed.

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 33[Scholl07]

  • 4.2 XPath

    Accessing '.'

    (1,2,3)/(. + 42)

    ⇒⇒⇒⇒(43.0,44.0,45.0)

    (1,2,3)/name(.)

    ⇒⇒⇒⇒

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 34[Scholl07]

    ⇒⇒⇒⇒

    (1,2,3)/name(.)

    ⇒⇒⇒⇒ ("a","b","c")

    (1,2,3)/position()

    ⇒⇒⇒⇒ (1,2,3)

    ()/(./child::b, .)

    ⇒⇒⇒⇒ (,)

  • • Combining node sequences– Sequences of nodes (e.g., the results of XPath location step)

    may be combined via• |, union (used synonymously), intersect, except

    – These operators remove duplicate nodes based on identity and return their result in document order.

    – Note: Introduced in the XPath context because a number of

    4.2 XPath

    – Note: Introduced in the XPath context because a number of useful navigation idioms are based on these operators:

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 35[Scholl07]

    Selecting all x children and attributes of context nodecs/(./child::x | ./attribute::x)

    Select all siblings of context nodecs/(./preceding-sibling::node()

    | ./following sibling::node())

    orcs/(./parent::node()/child::node() except .)

  • • XPath: Abbreviations

    – Since XPath expressions are pervasive in XQuery, query authors commonly use the succinct abbreviated XPath syntax to specify location steps.

    4.2 XPath

    Abbreviation Expansion

    1(At the beginning of a path expression.)

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 36[Scholl07]

    Abbreviation Expansion

    nt child::nt

    @ attribute::

    .. parent::node()

    // /descendant-or-self::node()/

    /1 root(.)/

    step1 ./step

  • • XPath abbrevation examples

    4.2 XPath

    Abbreviation Expansion

    a/b/c ./child::a/child::b/child::c

    a//@id ./child::a/descendant-or-self::node()/attribute::id

    //a root(.)/descendant-or-self::node()/child::a

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 37[Scholl07]

    //a root(.)/descendant-or-self::node()/child::a

    a/text() ./child::a/child::text()

  • 4.2 XPath

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 38

  • 4.2 XPath

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 39

  • • PurchaseReport– regions [RegionsType]

    • {keyref pNumKeyselector: zip/partfield: @number}

    – parts [PartType]– @period

    • RegionsType

    – zip*

    • part*

    – @number

    – @quantity

    4.2 XPath

    – @period– @periodEnding– {unique

    selector: regions/zipfield: @code}

    – {key pNumKeyselector: parts/partfield: @number}

    – @quantity

    • @code

    • PartsType

    – part*

    • @number

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 40

  • 4.1 Introduction

    4.2 XPath

    4.3 XPointer

    4. XML Query Languages I

    4.4 XLink

    4.5 Overview

    4.6 References

    41XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • XML Pointer Language– Allows to use XPath expressions in URIs

    – Used to identify ranges within XML documents

    – URI + XPath == XPointer

    – [XPointer] 4 specifications:

    4.3 XPointer

    – [XPointer] 4 specifications:• http://www.w3.org/TR/xptr-framework

    XPointer Framework (Recommendation 25 March 2003)

    • http://www.w3.org/TR/xptr-xmlnsxmlns() Scheme (Recommendation 25 March 2003)

    • http://www.w3.org/TR/xptr-elementelement() Scheme (Recommendation 25 March 2003)

    • http://www.w3.org/TR/xptr-xpointer(Working Draft 19 December 2002)

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 42

  • • Framework– Syntax: uri#pointer1 … pointer_n

    pointer ::= ( idValue | linkSchema '(' schemaData ')' )*• IdValue references an element

    • The values "xpointer", "xmlns" and "element" are allowed as

    4.3 XPointer

    • The values "xpointer", "xmlns" and "element" are allowed asvalues for LinkSchema

    – Provides extensibility

    – Resolving of multiple references from left to right• BUT: Break on success

    – Context of XPointer expressions: root node of theXML document referenced by URI

    43XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • xpointer() scheme: ranges and points– Every location expression in XPath returns a node set– XPointer can identify parts of documents which can not

    be represented as XPath node set– Additional concept: location and location setsLocation: Point, range or standard XPath node

    4.3 XPointer

    Location: Point, range or standard XPath node• Point location: standard node and index (points either to a child

    node or to a character)• Range location: 2 points, seperated by the keyword "to"

    – 2 new node tests: range() and point()– New functions working on ranges and points:range-to, string-range, range, range-inside, start-point, end-point, here andorigin

    44XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • xmlns() scheme

    – Namespaces are used only with the xmlns() scheme

    – xmlns() scheme expressions

    • always fail

    4.3 XPointer

    • assign a namespace to a prefix

    – Following schema expressions can use the prefix

    – Syntax: NamespacePrefix = namespace URI

    45XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

    Examplexmlns(xlink=http://www.w3.org/1999/xlink)

    xpointer(//*[@xlink:role="rollen.xml#author"])

  • • element() scheme

    – Identify ranges in documents by id values and / orelement numbers (position of child nodes)

    – Examples:

    4.3 XPointer

    46XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

    Element node with the id value xmldat06032005

    element(xmldat06032005)

    2nd child of that node

    element(xmldat06032005/2)

    2nd child of the 2nd child of the root node

    Element(1/2/2)

  • 4.1 Introduction

    4.2 XPath

    4.3 XPointer

    4. XML Query Languages I

    4.4 XLink

    4.5 Overview

    4.6 References

    47XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • XML Linking Language

    – To define links, which can…

    • be as easy as HTML links

    • have multiple end points

    • be stored independently of the referenced documents

    4.4 XLink

    • be stored independently of the referenced documents

    – Allows to add metadata to links

    – Uses XPointer and XPath

    – [XLink] W3C Recommendation 27 June 2001http://www.w3.org/TR/xlink

    48XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • XLink namespace

    – The XLink namespace has to be declared, so thatapplications and tools can recognize XLink markup:

    4.4 XLink

    XLink namespace

  • • Simple links– … link exactly 2 resources with a reference from the local

    to the remote– … are indicated by the attributexlink:type='simple'

    – … contain special attributes with information about:

    4.4 XLink

    – … contain special attributes with information about:• The remote resource: xlink:href• Properties of the link: xlink:role rsp. Xlink:arcrole

    (the value must be an URI)• The meaning of the link: xlink:title• The type of presentation of the remote resource: xlink:show

    (possible values: new, replace, embed, other, none)• When the link shall be followed: xlink:actuate (values can

    be: onLoad, onRequest, other, none)

    50XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • 4.4 XLink

    Simple links – examplesHuckleberry Finn

  • • Extended XLinks– Components:

    • Element with attribute xlink:type containing all otherlink components

    • Elements representing local resources( )

    4.4 XLink

    • Elements representing local resources(xlink:type='resource')

    • Elements representing remote resources(xlink:type='locator')

    • Elements representing the actual link between 2 resources(xlink:type='arc')

    • Elements containing descriptions of the links (xlink:type='title')

    • Some other attributes

    52XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • 4.4 XLink

    53XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • 4.4 XLink

    simple extended locator arc resource title

    type R R R R R R

    href O R

    role O O O O

    arcrole O O

    title O O O O O

    R: required, O: optional

    54[XLink] XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

    title O O O O O

    show O O

    actuate O O

    label O O

    from O

    to O

  • 4.4 XLink

    55[XLink] XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Extended links – example

    xlink:type (extended) #FIXED "extended"

    xlink:role CDATA #IMPLIED

    xlink:title CDATA #IMPLIED>

    xml:lang CDATA #IMPLIED>

    4.4 XLink

    xml:lang CDATA #IMPLIED>

    xlink:href CDATA #REQUIRED

    xlink:role CDATA #IMPLIED

    xlink:title CDATA #IMPLIED

    xlink:label NMTOKEN #IMPLIED>

    xlink:href CDATA #REQUIRED

    xlink:role CDATA #FIXED "http://www.example.com/linkprops/course"

    xlink:title CDATA #IMPLIED

    xlink:label NMTOKEN #IMPLIED>

    56XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Extended links – example

    xlink:role CDATA #FIXED "http://www.example.com/linkprops/gpa"

    xlink:title CDATA #IMPLIED

    xlink:label NMTOKEN #IMPLIED>

    4.4 XLink

    xlink:arcrole CDATA #IMPLIED

    xlink:title CDATA #IMPLIED

    xlink:show (new |replace |embed |other |none) #IMPLIED

    xlink:actuate (onLoad |onRequest |other |none) #IMPLIED

    xlink:from NMTOKEN #IMPLIED

    xlink:to NMTOKEN #IMPLIED>

    57XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Extended links – example

    Course Load for Pat Jones

    3.5

    58XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Extended links – example

    59XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Simple vs. Extended links

    – Simple links can not

    • link an arbitrary number of localand remote resources

    • specify a link from a remote

    4.4 XLink

    • specify a link from a remote resource to a local resource

    • set a title to a fixed link

    • set a role or title to the localresource

    • set a role or totle to the link itself

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 60

  • 1. Introduction

    2. XML Basics

    3. Schema definition

    4. XML query languages I

    5. Mapping relational

    8. XML query languages II

    9. XML storage I

    10. XML storage - index

    11. XML storage - native

    3.6 Overview

    üüüü

    üüüü

    5. Mapping relational data to XML

    6. SQL/XML

    7. XML processing

    11. XML storage - native

    12. Updates / Transactions

    13. Systems

    14. XML Benchmarks

    61XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • http://www.w3.org/ [W3C]

    – XPath, XPointer, XLink, XQuery, XSLT

    • M. Scholl, "XML and Databases", Lecture, Uni Konstanz, WS07/08 [Scholl07]

    • XML und Datenmodellierung [EE04]

    3.7 References

    • XML und Datenmodellierung [EE04]– R. und S. Eckstein

    – Dpunkt-Verlag, 2004, ISBN 3898642224

    • XML in a Nutshell [HM04]– Harold & Means

    – O'Reilly, 2004, ISBN 0596007647

    62XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig

  • • Now, or ...

    • Room: IZ 232

    • Office our: Tuesday, 12:30 – 13:30 Uhr

    Questions, Ideas, Comments

    • Office our: Tuesday, 12:30 – 13:30 Uhr

    or on appointment

    • Email: [email protected]

    XML Databases – Silke Eckstein – Institut für Informationssysteme – TU Braunschweig 63