XML Linking

Document Sample
XML Linking Powered By Docstoc
					Overview
•   Some hyperlinking history
   XML-Linking goals and status
   XML Base
   The XPointer language
   The XLink language
   Controlling traversal behavior




7/4/2012         XML Linking / DeRose and Durand   1
                                                       1
Some Hyperlinking History




7/4/2012   XML Linking / DeRose and Durand   2
                                                 2
History repeats itself
 In word processing                         In hypermedia:
       Early systems knew text                      Many early systems had
        structure                                     linking structure
       WYSIWYG took over but                        HTML <A> took over but
        skipped structure                             skipped structure
       As it scaled, people started                 As projects scale, people
        to “fake” structure                           are “faking” link structure
       Software gradually built
        structure all over again                     So…




7/4/2012                XML Linking / DeRose and Durand                      3
                                                                                    3
Hypermedia in the 60s (!)
 For example, FRESS (Brown, 1969)
       800,000 lines of 370 assembler -- still runs
       Grandfather of most Word processors
       Teaching; databases; typesetting
 Some features still not on Web:
       Links were structured w/ types, keywords
       Links were truly bidirectional
       Links overviews
       Supported document structures / ranges
 Out-of-line links later (1983, Intermedia)

7/4/2012                XML Linking / DeRose and Durand   4
                                                              4
HTML and hypermedia
 WWW is powerful because of Internet, URIs, and
  documents; linking is weak
 HTML linking strengths:
       Easy syntax: <a href="http://foo.net/x.html">
 Trivial to implement
       Can go to few specific targets (ID only)
         <a href="http://foo.net/x.html#sec2">
         <a name="sec2">
       Anchors move along with editing
         • (unlike, say, byte offsets)

7/4/2012               XML Linking / DeRose and Durand   5
                                                             5
     Anatomy of an HTML link
 <a href="http://z.uk/x.htm#ch2">Info.</a>

                             Locator                           Local
                                                             link-end

HTML’s locator is                “Link”                       Remote link-end
a “URI Reference”                                            must be marked up
                                                             (unless whole doc)
  Really, the link is
the relationship itself.                        <!DOCTYPE…
  An <a> element                                <html>…
                             Remote
     expresses or                              <a name="ch2">…</h1>
                            link-end
    “represents” it                            ...</html>
     7/4/2012              XML Linking / DeRose and Durand                 6
                                                                               6
HTML Linking Limitations




7/4/2012   XML Linking / DeRose and Durand   7
                                                 7
1: Limited elements
 People can’t create their own subtypes
       What if you need several sub-types of link?
       REL/REV attributes non-standardized
 CLASS attributes don’t make it
       Semantics/processing second-class
       Maybe no HTML element to start from
       It’s like C++ without subclasses
 CSS cannot make elements into links

7/4/2012             XML Linking / DeRose and Durand   8
                                                           8
2: Link behavior tied to type
 A means (usually):
       Replaces document in same window
       Activated by user
 IMG means (usually):
       Embeds target inline
       Activated upon loading
       Graphics only
 Why can’t I have other combinations?
       CSS doesn't have what you’d need
       Browsers can’t embed HTML/XML yet

7/4/2012            XML Linking / DeRose and Durand   9
                                                          9
3: No real type system
 Few have tackled the link type problem
       Trigg, Bieber, DeRose, Connolly
 REL/REV provide a hook, at least
       No standard/portable set of types
       Need an orderly but extensible system
 Most proposed type-sets are grab-bags
       Mixing rhetorical, topological, and syntactic types




7/4/2012             XML Linking / DeRose and Durand          10
                                                                   10
4: A privileged end
 The link is physically at one of its ends
       Infeasible to allow annotation
 Thus no links from read-only documents
       Nearly all documents, for any one person
       So no annotations that readers of the annotated
        document can see
 Doesn’t allow link databases, so:
       Can’t buy or sell link-sets
       Can’t filter or select links on demand
       Can’t share many users’ links

7/4/2012             XML Linking / DeRose and Durand      11
                                                               11
5: Few possible destinations
 Can point to a whole document
 Can point to HTML <a name> if it exists:
   <a href="http://xyz.com/foo.html#id37">
     points to <a name="id37">
 Author controls what others can reference
       “You can only quote paras 1, 12, or 20.”
 Can't do some links at all
       Impossible to supply handles for links that partly overlap
       Impractical to supply handles even at word level

7/4/2012             XML Linking / DeRose and Durand       12
                                                                12
6: No aggregate
destinations
   No multi-ended links in HTML
   No multiple locations for a single end
   No dynamic document assembly
   Some uses for multi-ended links
       Back-of-book indexes
       Pull up multiple commentaries at once
       Editing after multiple document reviews
       Parallel views of editions and translations


7/4/2012             XML Linking / DeRose and Durand   13
                                                            13
7: One way: A or IMG to
somewhere
 Why can’t I ask who links to me?
       (without doing a global search)
       (even for a limited domain)
 Why can’t I make a two-way link?
 Why can’t I make multi-ended links?
 “Go back”  2-way link
       Only works after you’ve gone the one way
       You can’t start at the “other” end


7/4/2012             XML Linking / DeRose and Durand   14
                                                            14
Overview
 Some hyperlinking history
 XML-Linking introduction
       Goals
       History
       Pointing vs. Linking
   XML Base
   The XPointer language
   The XLink language
   Controlling traversal behavior
7/4/2012            XML Linking / DeRose and Durand   15
                                                           15
XML-Linking goals: end
user
 Links from un-writable documents
       Which is most of the Web, for any person
       Perhaps the most important single feature
       ->Bidirectional and multi-ended links
       ->Annotations and annotation sharing
         • Dynamic updates, patches, highlighting
 Precise link attachment in any media
 Large sets/databases of managed links
       An entirely new market for links per se
       Anyone can publish/sell their commentary

7/4/2012            XML Linking / DeRose and Durand   16
                                                           16
The XML-Linking effort
 Started 1/1996 in the XML WG
 Separate Working Group 1998
 Specs:
       XPath complete 11/1999 (joint w/ XSL WG)
       XLink complete 6/2001
       XML Base complete 6/2001
       XPointer being refactored
         • first 3 documents out “soon”


7/4/2012            XML Linking / DeRose and Durand   17
                                                           17
Pointing vs. linking
 In HTML, many things are combined:
    <a href="eg.org/foo">wow</a>
 Technically:
       "eg.org/foo" is a pointer (namely a URI)
       The abstract connection itself is the link
       The <a> element is a link representation
       "wow" is the local anchor
          • Anchors are also called link-ends
       Data at eg.org is the remote anchor
       HTML specifies the link behavior



7/4/2012               XML Linking / DeRose and Durand   18
                                                              18
Why pick all this apart?
 Engineering/theory:
       Design each one better
       Ease implementation
       More easily combine them in new ways
 Practically:
       Multiple locations can be linked at once
       Link-ends can be organized and labeled
       Meta-information can be added
       Links can live outside of linked docs

7/4/2012             XML Linking / DeRose and Durand   19
                                                            19
XML-Linking specifications
 XPath: expressions on infoset nodes
       REC: http://www.w3.org/TR/xpath
 XPointer: XPath + ranges, in URIs
       CR: http://www.w3.org/TR/WD-xptr
   Xpointer Schemes: failover for fragment Ids
   Xpointer NS scheme (declare namespaces)
   Xpointer Element scheme
   XLink: gather locations to make links
       REC: http://www.w3.org/TR/xlink/
 (XML Base)

7/4/2012              XML Linking / DeRose and Durand   20
                                                             20
     XPointer: locators
                                                                            <xml>…
      A way of locating data in
                                                                            <xref target=
      XML structure — used to                                               "http://z.com/foo.xml
      attach link end(s) to data                                            #id('p37')">
                                                                            See Section 1.</xref>
                                                                ROOT

                                                                 doc

                                  title       abstract          chapter      chapter       chapter
A pointer identifies or                                        intro        concepts      summary
locates some part of a        Introduction           title      section     section
document -- this is only
the yellow part above                        title        p       p       list     p
                                                         p37                ...
                                                           a                      xref
     7/4/2012                                            name='baz'
                           XML Linking / DeRose and Durand                        href='#id(intro)'
                                                                                               21
                                                                                                      21
                                                             Someplace
    XLink: connections
    Describes a relationship                                               Someplace

       of referenced location(s),                   A link connects data and
           To each other                           meta-data portions,
           To descriptions                         including their relationship
                                                    -- really just the lines
             • XLink provides
               some key ones
                                           role                role          role
A link may be expressed at a
unique source end, or out in
       a link database

                               Someplace             Someplace           Someplace
    7/4/2012               XML Linking / DeRose and Durand                     22
                                                                                     22
Overview
 Some hyperlinking history
 XML-Linking introduction
 XML Base
 The XML Pointer Language (XPointer)
       Fragment identifiers
       XPointer schemes
       XPointer syntax/semantics
 The XML Link language (XLink)
       Controlling traversal behavior
7/4/2012             XML Linking / DeRose and Durand   23
                                                            23
XPointer…
 Locates parts of XML resources
       Even things without IDs
       Even things that aren't whole nodes
 XPointer adds (beyond XPath):
       Way to refer to point and range selections
       Way to use inside URI fragment identifiers
 Typically, a browser might load a document and
   scroll to/highlight the part


7/4/2012            XML Linking / DeRose and Durand   24
                                                           24
Anatomy of a URI reference
                  URI reference


                   URI


     http://example.com/foo.htm#bing


   scheme      domain                     path   fragment
                                                 identifier


                                 XPointer
7/4/2012      XML Linking / DeRose and Durand                 25
                             defines this part
                                                                   25
Fragment identifiers
 Part of URIs after "#"
       Says where in document is actual target
 Separate form for each media type
       Identifiers for graphics  for text
       IETF MIME definition specifies form
 HTML
       To scroll to <a name="coyote">

    http://example.com/hello.html#coyote



7/4/2012            XML Linking / DeRose and Durand   26
                                                           26
The XPointer scheme
system
 A way to have several pointing mechanisms in one
  fragment ID
 Each scheme in a fragment is tried in sequence
       scheme1(args) scheme2(args)…
 unimplemented schemes and pointers that fail to
  locate, are simply ignored.
 recent changes
       Things are more split by scheme. Full XPointer delayed
        (again)
       “Last call” drafts imminent

7/4/2012            XML Linking / DeRose and Durand     27
                                                             27
The 3 XPointer/XPath
schemes
 Bare names
       An XML "name"* finds element with that ID
       Only exception to the scheme system
                                                       *Name: Letters,
 element() scheme                                     digits, hyphen,
                                                       underscore, period.
       Counts Stepwise down through elements: /1/4/27/2
       May start with an ID: element(intro/4/3/2)
 xmlns() binds namespaces for schemes
 xpointer scheme (awaits disposition of comments)
       Full Xpointers, xpath and more
       For now, the only "scheme" is "xpointer"
7/4/2012             XML Linking / DeRose and Durand                 28
                                                                             28
All work on XML tree
 Address Infoset, not markup
 Count nodes of different types:
       Root, elements, attributes, text chunks
       Comments, PIs, namespace dcls
       Can also work down in character data
 Note: Most of XPointer = XPath
       Adds ranges
       Adds way to put into fragment identifier


7/4/2012             XML Linking / DeRose and Durand   29
                                                            29
XPointer's 2 parts
 Provide 'scheme' mechanism
       Identify media-specific pointer types
       Allow multiple ones to co-exist
 Pointing methods for XML
       Point to ranges, sets, id's, coords…
       Point descriptively




7/4/2012             XML Linking / DeRose and Durand   30
                                                            30
XPointer schemes
 XML medias type may need pointer types
       pngRect(0,10 100,200)
       vrml(camera=1,2,3 light=4,50,500)
       map(W010’/ N5130’)
 Schemes label fragment identifier types
       #scheme1(args) scheme2(args)…
         • Escape any extra ( ) -- tlg('^(apax')
 element(), xmlns() is the first scheme

7/4/2012             XML Linking / DeRose and Durand   31
                                                            31
Multiple schemes in a URL?
 When a server responds to a URI, it
       Checks what media the client can handle
       Picks one of those to send
       “content negotiation”
 If a visually-impaired user clicks
    <a href="http://www.example.com/foo.gif# gif(0,0 1,1)
      xpointer(id(chap1))">
     The server may fall back to an XML file

     The client tries fragment identifiers left-to-right, and
      uses the first one that works
7/4/2012            XML Linking / DeRose and Durand         32
                                                                 32
Full XPointers
 The content of the 'xpointer' scheme
 Provides way to walk around trees
 Provides way to select nodes/ranges




7/4/2012       XML Linking / DeRose and Durand   33
                                                      33
XPath/XPointer expressions
 XPointers produce a location set
       Location = node | point | range
        (XPath only produces nodes)
 Locating is stepwise
       A step generally look along some axis
       Candidates are then filtered by predicates
       Special functions locate strings, ids, etc.
 Each step operates on a context, and
 Step are separated by a slash
       id(foo) / child::SEC[3] / child::LIST[4]


7/4/2012                 XML Linking / DeRose and Durand   34
                                                                34
Points and Ranges
 Point                                                   Hello, world.
       What you get by click-selection
       Gap before/after node or char
 Range                                                   Hello, world.
       What you get by drag-selection
       From a start point to an end point
       Not generally a WF XML subtree
         • May partially contain some elements:
         • <p>Hello, world.</p><p>Hi, back</p>
 Crucial for creating hypertext links
       How often do you click/drag exactly one entire element?


7/4/2012               XML Linking / DeRose and Durand            35
                                                                       35
Absolute linking functions
 origin()
       Locates where traversal “came from”
         • So if paragraphs P1 and P2 are linked, and the user clicks on
           P1 to follow a link, P1 is “origin”
       Can make abstract links, "next chapter"...
 here()
       Locates the link representation itself
       With one-way links like HTML <a>, here = origin
       Can make a web-ring of one-ended links




7/4/2012               XML Linking / DeRose and Durand             36
                                                                        36
     here() and origin()
           href="#xpointer(here()/
          following-sibling::chapter)"                         origin()/ancestor[2]
Assuming you
clicked on the title
                                                       ROOT                     Assuming you
                                                                                clicked on the xref
                                                       doc

                       title      abstract          chapter       chapter       chapter
                                          href="..."
                                                   intro         concepts      summary
                  Introduction           title      section      section

                                 title        p         p      list     p
                                             p37                 ...
                                                         a             xref
                                                       name='baz'      href='#id(intro)'
     7/4/2012                  XML Linking / DeRose and Durand                               37
                                                                                                  37
Summary: axes and
functions
       root( ), id( )                                Absolute
       parent, self, child
       ancestor, ancestor-or-self
       descendant, descendant-or-self                Relative
       preceding-, following-sibling
       preceding, following
       attribute, namespace
       here( ), origin( )
                                                      Absolute


7/4/2012            XML Linking / DeRose and Durand     38
                                                             38
More about ranges
 Nodes are great handles for linking;
  but most selections are not whole nodes
 Typical link creation:
       Select something; do "make link"
       A click indicates a point, not a node
       A drag indicates a range, not a node
 A range is not a set of nodes (!)
       It is one object, not a huge number
       Characters are not nodes in DOM                  Defined
       Range does not have properties of node            in the
                                                         DOM 2
                                                           spec


7/4/2012               XML Linking / DeRose and Durand    39
                                                               39
string-range
 string-range(n,"string", offset,length)
       Locates selections (think “cursor”)
       Finds nth occurrence of string provided
       Offset counts positions before characters
         • +1 is before first character; -1 before last
       Length specifies length of result
 In “the cards are dealt”: string-range…
   (1,"cards",1,1)        “c”
   (1,"cards",1,0)        point before “c”
   (1,"cards")            point before “c”
   (1,"cards",3,2)        “rd”
   (1,"cards",-1,5)       “s are”




7/4/2012                XML Linking / DeRose and Durand   40
                                                               40
range-to
 Range-to(xptr)
     From start of context to end of xptr
     The xptr would typically be an ID or relative

    id('sec2')/range-to(id('sec4'))
    id('fn37')/range-to(following-sibling[3])
 A typical form:
       xpointer(
          id('sec2.1')/4
            range-to(id('sec2.1')/2))




7/4/2012                 XML Linking / DeRose and Durand   41
                                                                41
Some range applications
 A typical hypertext interface
       User selects some text
         (a selection is hardly ever a node)
       "make link", "make annotation"…
       Application generates an XPointer
       Application saves links in a link-db
 Great for referring to "milestones" or other non-
   hierarchical units



7/4/2012             XML Linking / DeRose and Durand   42
                                                            42
XPointer new datatypes
 Extending nodes:
       Points
       Ranges
 Locations
       The supertype of the extensions.
 Location sets
       set of locations




7/4/2012             XML Linking / DeRose and Durand   43
                                                            43
Reducing pointer/link
fragility
 Consider what will break an XPointer
       If you just used offsets (easy but weak)
           the slightest edit
       If you describe paths through the tree,
           only changes “on the path”
       If you use paths with element type names, only ancestors or pr-
        siblings of same type
       If you use IDs,
           only a specific change to that ID
       When you can describe the true intent, they can re-attach when
        possible
 Use IDs, or relative from an ID
7/4/2012               XML Linking / DeRose and Durand             44
                                                                          44
XPointer robustness
 Absolute robustness is not possible
       Servers go down
       Pages are deleted or moved
       Author can mangle documents any time
       Author can even change all IDs any time
 But, how you construct pointers counts
       IDs are good until explicitly changed
       Software can manage IDs to be persistent
       These are not true of counters, offsets, etc.

7/4/2012             XML Linking / DeRose and Durand    45
                                                             45
Overview
 Some hyperlinking history
 XML-Linking goals and status
 XPath and XPointer in general
 The XML Pointer language (XPointer)
 The XML Linking Language (XLink)
       Terminology
       Inline and out-of-line links
       Arcs and behavior
       Linksets and link databases
7/4/2012            XML Linking / DeRose and Durand   46
                                                           46
Remember...
 In style:
       XPath identifies set of nodes
       XSLT itself does transforms on them


 Similarly in linking:
       XPointer identifies sets of locations
       XLink connects and describes them


 These are very separate ideas
7/4/2012             XML Linking / DeRose and Durand   47
                                                            47
XLink is a language that...
 Lets you invent your own linking elements and
   their meanings
       In keeping with XML approach overall
 Lets you create link databases
       Links become first-class objects in the model
 Provides some basic traversal behavior
       E.g., “Open the target in a new window”
       The rest is left to a style mechanism such as XSL


7/4/2012             XML Linking / DeRose and Durand        48
                                                                 48
XLink terminology
 Linking element
       Identifies, connects, and describes anchors
 Locator
       Locates some link end (anchor)’s data
 Link end or anchor
       A data portion reachable as part of a link
 Arc
       Explicit connection between two link ends
 Resource
       Anything you can point at on the Web
 Using an arc is called Traversal
7/4/2012             XML Linking / DeRose and Durand   49
                                                            49
What links do with link-ends
 A link identifies where its ends are
       Using some kind of locators
       URI#XPointer will be the locator for XML
       URI#scheme()scheme() in general
 A link attaches metadata to each end
       Its formal role in relation to the other ends
       A title by which to refer to it (say, in menus)
       Some traversal behaviors
       Arcs to say which traversals happen
 Link itself can also have type, other info
7/4/2012              XML Linking / DeRose and Durand     50
                                                               50
Inline links
 Linking element itself (better, the origin() end) is
   one of the link’s ends
                        Make a mixture of
                      minced capers (about
                         1 tsp), chopped
                       olives (a couple per           caper: any of the
                           person), and              Capparis genus of
                      optionally one piece          low prickly shrubs of
                        of finely chopped            the Mediterranean
                      sun-dried tomatoes.           region, or one of the
                       Add it to the nearly         greenish flower buds
                       cooked vegetables.            or young berries of
                                                   the caper pickled and
                                                    used as a seasoning
                                                         or garnish.


7/4/2012         XML Linking / DeRose and Durand                      51
                                                                            51
     Out-of-line links
     Linking element itself isn't automatically made into
        one of its own resources
                          (Link the mention and
                                      the definition
                                        together)
Requires
                                                           caper: any of the
that there be       Make a mixture of
                  minced capers (about                    Capparis genus of
a way to             1 tsp), chopped                     low prickly shrubs of
                                                          the Mediterranean
find link          olives (a couple per
                       person), and                      region, or one of the
databases in      optionally one piece                   greenish flower buds
                                                          or young berries of
the first           of finely chopped
                  sun-dried tomatoes.                   the caper pickled and
place              Add it to the nearly                  used as a seasoning
                   cooked vegetables.                         or garnish.


     7/4/2012             XML Linking / DeRose and Durand                        52
                                                                                      52
                Link need not be
                 “at” a link-end
      Anatomy of an XML link<html>Knuth’s
                            right.</html>

  <link type="annotated-reference">
   <loc role="ref" href="xptr.xml#child(2,div)">
   <loc role="src" href="knut73.tex#s4.2.2">
   <loc role="com" href="http://x.com/note.html">
  <link>
                       Each link-end
                      can be described              Link may have any
                                                     number of ends
<!DOCTYPE spec...
<spec><div>…</div>          Link-ends need
<div>                                                        \{… 4.2.2: A tree is a set of
<head>...</head>...          not be XML                      nodes where each node has
                                                             one parent, except for a root
                            Link-ends need                   node, which has none….}
     7/4/2012              XML Linking / DeRose and Durand                         53
                           not be marked up                                             53
XLink and namespaces
 Xlink should be usable with any schema
       And have any old name
 Xlink elements are in a namespace
    http://www.w3.org/1999/Xlink
     Apply this in usual namespace way
           <xlink:locator xmlns:xlink
             ="http://www.w3.org/1999/Xlink">
 Namespaces can't rename, so true name goes on
   xlink:type attribute
       This is much like architectural forms

7/4/2012               XML Linking / DeRose and Durand   54
                                                              54
Simple and extended links
 A simple link is a…
       “Starter kit” of basic linking functionality
       Only two resources are ever involved
       It is always inline
 An extended link is a…
       Generalized, all-purpose linking construct
       Any number of resources can be involved
       It might be inline or out of line
       It enables link databases

7/4/2012              XML Linking / DeRose and Durand   55
                                                             55
The one-ended link                                      This is really
                                                         important
 A link can identify and describe
 Can say the end "is a typo"                                 Hilite
  or "important" or "highlighted in red"                      ='red'

 A one-ended link still describes an end
        Can attach tags or attributes to R/O data:
        <claim href="hamlet#id(soliloquy)" isa=”crux”/>
 The description isn’t properly an “end”
       If it were, you’d expect to navigate there
       If it were, it would need a role and title
 Critical for adding "standoff" markup
7/4/2012              XML Linking / DeRose and Durand         56
                                                                   56
Arcs
 Arcs specify traversal rules
 Multi-ended links may restrict travel among their
  endpoints
 Restrictions generic or app-specific
       Arcs enable the description of both
 An arc is a pair of roles, plus metadata
       Enables traversal between ends with the given roles
       May be multiple locators per role (useful for document
        assembly, multiple-choice travel)

7/4/2012             XML Linking / DeRose and Durand     57
                                                              57
Example: vehicle
annotations
Warning:                    Warning:
explosive                    toxic                   gasoline


                           warning               fuel-type
       warning

                                                                    ARCS:

                              Link body 1                    vehicle  fuel-type
                                                             fuel-type  warning
  vehicle
                 vehicle                          vehicle


7/4/2012               XML Linking / DeRose and Durand                      58
                                                                                   58
How to detect links
 Could have any name and content at all
       <footnote>, <criticism>, …
 xlink:type attribute marks linking elements for
   applications to find:
   <!ELEMENT footnote EMPTY>
   <!ATTLIST footnote
     xlink:type       CDATA #FIXED "simple"
     xlink:href       CDATA #REQUIRED>
 For example: ...has studied the issue.<footnote       Default
   href="http://www.doctools.com" />                   value for
                                                       attribute

7/4/2012             XML Linking / DeRose and Durand       59
                                                                   59
Types of links
 simple: easy, basic linking element
       Creates link solely by means of attributes
       So allows only one non-local end (cf <A>)
 extended
       Creates link using attributes / subelements
       Each sub-element represents an end
         • This allows structured or multi-lingual titles
 Both can have
       Machine-readable role attribute
       Human-readable title attribute

7/4/2012              XML Linking / DeRose and Durand       60
                                                                 60
Simple links
 Like HTML's <a>
 Has two participating resources
       Linking element itself (if in-line)
       Resource pointed to by the href locator attribute
 Uni-directional
       From simple
       To remote resource




7/4/2012             XML Linking / DeRose and Durand        61
                                                                 61
Simple link declaration
<!ELEMENT simple ANY>                               Content may
                                                     be an end

<!ATTLIST simple
                                                     Identifies
  xlink:type CDATA        #FIXED "simple"
                                                    this as a link

                                                       Locates
   xlink:href   CDATA     #REQUIRED                   resource



   xlink:role CDATA             #IMPLIED             Describe
   xlink:title CDATA            #IMPLIED>            other end

7/4/2012          XML Linking / DeRose and Durand          62
                                                                 62
Extended links
 Can be in- (like <a>) or out-of-line
 Have any number of resources
       Each resource gets its own child locator element(s)
         • Link ends are distinguished by roles
       Each locator has an href attribute
 Multi-directional
       Can start traversal from any resource
       Can control allowed traversals via arcs
       Application must be informed about the link
         • E.g., user subscribes to link database XYZ

7/4/2012             XML Linking / DeRose and Durand     63
                                                              63
The extended link container
<!ELEMENT extended (locator|arc|title*)>                 Allows for
<!ATTLIST extended                                     the link’s ends
   xlink:type CDATA         #FIXED "extended"


   xlink:role    CDATA        #IMPLIED                    Identifies
   xlink:title   CDATA #IMPLIED>                           as a link



                                                          Can supply
 Other content/attributes                                 defaults
   may be included if needed                               for ends


7/4/2012             XML Linking / DeRose and Durand           64
                                                                    64
An extended link’s ends
                                                       Identifies this
<!ELEMENT locator EMPTY>                                 as a locator
<!ATTLIST locator
   xlink:type  CDATA #FIXED "locator"


   xlink:href    CDATA #REQUIRED
                                                          Locates
                                                         resource
   xlink:role    CDATA #IMPLIED
   xlink:title   CDATA #IMPLIED>
                                                         Describe
 Link end locators may also have content and/or         the end

   application-specific attributes

7/4/2012             XML Linking / DeRose and Durand           65
                                                                    65
Declaring Arcs                                            Identifies this
                                                             as an arc
<!ELEMENT       go                   ANY>
<!ATTLIST       go
   xlink:type   (arc)                #FIXED "arc"

   xlink:from   NMTOKEN              #IMPLIED             Which roles
   xlink:to     NMTOKEN              #IMPLIED             to connect

   xlink:show      (new|replace|embed|unknown) #IMPLIED
                                                            Traversal
   xlink:actuate (onLoad|onRequest|unknown) #IMPLIED
                                                            semantics
   xlink:arcrole NMTOKEN    #IMPLIED
   xlink:title        CDATA #IMPLIED>
                                                            Describe
                                                             the arc
7/4/2012                XML Linking / DeRose and Durand          66
                                                                       66
Arcs and Traversals
 Traversal is split into:
       Behavior
         • Author's intention for behavior of a link.
         • Input to style mechanism
         • Not a presentation command
       Actuation
         • Defines the event that triggers a link
         • Events are very generic, intentionally



7/4/2012             XML Linking / DeRose and Durand    67
                                                             67
Two kinds of behavior
policies
 show attribute
       new to traverse and provide new “context”
       replace to display in existing “context”
       embed to display in the body of the initiating resource
           • Some semantic details are left unspecified:
             combining multiple ends, style inheritance, etc.
 actuate attribute
       onRequest to require external request
       onLoad to traverse when link processed
7/4/2012               XML Linking / DeRose and Durand          68
                                                                     68
Replacement behavior
 replace plus onRequest
       Like clicking on the HTML <A> element
 replace plus onLoad
       Like a redirect; when the link is processed, the other
        resource replaces the original one in which the link was
        found




7/4/2012             XML Linking / DeRose and Durand      69
                                                               69
New behavior
 new plus onRequest
       Like clicking on the HTML <A> element, except that it
        opens up a new window
 new plus onLoad
       Useful for revealing commentary; when the link is
        processed, a new window opens up in addition to the
        original one




7/4/2012            XML Linking / DeRose and Durand      70
                                                                70
Embedding behavior
 embed plus onRequest
       Useful for expanding a thumbnail or when auto-loading
        of images is off; when the user clicks, the content
        appears in place
 embed plus onLoad
       Like the HTML <IMG> element or an external entity
        reference; the content automatically appears in place
        when the link is processed
       This is “transclusion”
         • True transclusion requires that the transcluded data
           also provide access to original context

7/4/2012             XML Linking / DeRose and Durand      71
                                                               71
Simple link syntax
   <!ELEMENT defref (#PCDATA)>
   <!ATTLIST defref
       xlink:type            CDATA            "simple"
       xlink:href            CDATA            #REQUIRED
       xlink:role            CDATA         "myns:cooking">

   <p>…use any number of
    <defref xlink:href="#filterdef">
    filters
    </defref> (about 1 tsp)…</p>

                                     Note: can add "#FIXED"
                                     before default value so it will
                                     be the only value allowed.
7/4/2012           XML Linking / DeRose and Durand                72
                                                                       72
Extended links
<!ELEMENT term-def (locator+)>
<!ATTLIST term-def
       xlink:type       CDATA "extended">
<!ELEMENT locator EMPTY>
<!ATTLIST locator
 xlink:type     CDATA "locator"
 xlink:href     CDATA #REQUIRED
 xlink:role (myns:mention|myns:def) #REQUIRED>

<term-def>
   <locator href="#myterm1" role="mention"/>
   <locator href="#myterm2" role="mention"/>
   <locator href="#definition” role="def"/>
</term-def>
7/4/2012           XML Linking / DeRose and Durand   73
                                                          73
Link databases let you…
 Attach descriptive information from afar
 Annotate other people's stuff
 Maintain links more easily
       When a destination changes, you don’t have to touch
        documents with links to it
 Engage in online commerce in links
       Express, package, and sell point-of-view
 Collect out of line links as databases

7/4/2012            XML Linking / DeRose and Durand    74
                                                              74
External Linksets
 Users will have persistent linkdbs
       Subscriptions, interest groups, private,...
 Document can specify relevant link dbs
       Linked by special type of extended link
       Included within regular documents too
 LinkDBs enable link management
 Needed to author using external links

 Example: Public annotations on….
7/4/2012             XML Linking / DeRose and Durand   75
                                                            75
Declaring an External
Linkset

<!ELEMENT xls (linkbase+)>
<!ATTLIST xls
 xmlns:xlink CDATA    #FIXED
   "http://www.w3.org/1999/xlink"
 xlink:type (extended) "extended"
 xlink:role NMTOKEN "xlink:extended-linkset"
 xlink:title CDATA      #IMPLIED>



<!ATTLIST linkbase
 xlink:type (locator) "locator">

7/4/2012           XML Linking / DeRose and Durand   76
                                                          76
An external Linkset Instance
<xls>
   <linkbase xlink:href="linkset1.xml" />
   <linkbase xlink:href="linkset2.xml" />
   <linkbase xlink:href="linkset3.xml" />
</xls>




7/4/2012           XML Linking / DeRose and Durand   77
                                                          77
Notes on implementation
 Best thing for any standard:
       Lots of implementations
       Attention to conformance/interoperability
 IE does not yet have these
 Encourage implementors:
       XPointer easy on top of XPath + DOM
       XLink easy for inline, trickier for good LDBs
         • Proxy server can merge document + links
         • Client app can do likewise
 Encourage distributed linkbase dev
7/4/2012             XML Linking / DeRose and Durand    78
                                                             78
Some Resources
 On the Web Consortium site
       W3C XML site www.w3.org/XML/
       Other specs       www.w3.org/TR/
 Elsewhere on the Web
       XML FAQ               www.ucc.ie/xml/
       XML Developers’ list
         www.lists.ic.ac.uk/hypermail/xml-dev/
       TEI                   etext.virginia.edu/
       Robin Cover’s definitive site:
         www.oasis-open.org/cover/
7/4/2012             XML Linking / DeRose and Durand   79
                                                            79

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:6
posted:7/5/2012
language:
pages:79