Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia...

54
Introduction to XLink Transparency No. 1 Introduction to XML Li nking Language (XLink) Cheng-Chia Chen
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    234
  • download

    2

Transcript of Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia...

Page 1: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 1

Introduction to XML Linking Language (XLink)

Cheng-Chia Chen

Page 2: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 2

XLink, XPointer, XPath, Xinclude and XML Base

XLink: 27 June 2001, Recommendation a generalization of the HTML link concept higher abstraction level (intended for general XML - not just hypertext) more expressive power (multiple destinations, special behaviours, out-

of-line links, ...) uses XPointer to locate resources

XPointer : 11 September 2001, Candidate recommendation an extension of XPath suited for linking specifies connection between XPath expressions and URIs

XPath: November 16, 1999 1.0 Specification a declarative language for locating nodes and fragments in XML trees used in both XPointer (for addressing) and XSL (for pattern matching)

XInclude :: 17 September 2002, Candidate recommendation embeds a document identified by a URI inside an XML document.

XMLBase:27, June 2001, Recommendation defines the URI against which relative URIs are resolved

Page 3: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 3

XML Base

A URI identifies a resource: http://somewhere/somefile.xml is an absolute URI somefile.xml is a relative URI

XML Base provides a uniform way of resolving relative URIs. Inspired by the <base href="..."> mechanism in HTML, In the following example:

<... xml:base="http://www.cs.nccu.edu.tw/">  <... href="~chencc/index.html" .../></...>

the value of href attribute can be interpreted as the absolute URI http://www.cs.nccu.edu.tw/~chencc/index.html.

the xml namespace prefix is hardwired by the Namespace specification with uri: http://www.w3.org/XML/1998/namespace

xml:base has lexical scope (as namespace declarations) the URI used to access the document is used as default URI base Future XML parsers will support XML Base.

Page 4: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 4

An XInclude example

A document containing: <foo xmlns:xi="http://www.w3.org/2001/XInclude">

<xi:include href="somewhere.xml“ parse=“xml|text” encoding=“…”>

<xi:fallback><nobar>…</nobar></xi:fallback/></xi:include></foo>

where somewhere.xml contains: <bar>...</bar> is equivalent to: <foo xmlns:xi="http://www.w3.org/2001/XInclude">

  <bar>...</bar></foo>

http://www.w3.org/2001/XInclude is the official XInclude namespace the include element name in that namespace is an inclusion directi

ve right after parsing and before other processing, an XInclude proces

sor performs the inclusion (tree substitution) the original and the resulting document should be considered equi

valent it is an error to have cyclic includes

Page 5: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 5

The HTML link model

The HTML link model:

<A href=“http://xml.cs.nccu.edu.tw/courses#aia2001”>

a hyperlink to the aia2001 anchor of the course URI

</A>

characteristic:binary, unidirectionallink definition = link source.

source destinationlink

Page 6: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 6

Problems of HTML link model

1. Link syntax and semantics is not defined separately from rest of HTML: In HTML, links are recognized by element names (A,

IMG, ..) - we want a generic XML solution. - we want link to be defined at places other than A,IMG. The "semantics" of a link is completely defined in the

higher-level specification - we want control of general semantic features, e.g. of link

actuation.

2. HTML links are too simple: All Links are binary (one source and one destination) - we want links with multiple sources and destinations. The traversal rule is unidirectional. (dead link problem) - we want multi-directional links possible.

Page 7: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 7

Problems with HTML links (cont’d)2.

support outbound link(link definition is also the link source) only

- We need inbound and third-party links("link databases"). Links are anonymous- we want human-readable labels. An anchor must be placed at every link destination (proble

m with read-only documents) : <A name=“aDestination” />

- we want to express relative locations (XPointer!). Only individual nodes can be linked to

- we want links to whole tree fragments.

Page 8: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 8

The XLink linking model

The world wide web is composed of a lot of resources. Each is identified (URN) or addressed (URL) by a string

called its URI (reference). There are a lot of relationships existing among these

resources, which we need to make explicit in order for applications to make use of them. Ex: family, course : Teacher, TAs, students, newsgroup, course web pages, …

resource

resource

resource

resource

Page 9: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 9

XML linking model

resource

resource

resource

resource

Link

•U (the universe) =def the collection of all resources. •a relation R (not restricted to binary or fixed arity relation) is any subset of Uk>0 Uk .•A link asserts(or declares) the existence of a member tuple (r1,r2,…, rk) of a relation.

Page 10: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 10

XML linking model

Resource which is a link or a child of a link is called the local resource of the link.

other resources are

remote resources. remote

resource

local

resource

remote

resource

remote

resource

Linkarc arc

arc

Page 11: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 11

XML linking model

traversal: Using or following a link for any purpose. always binary, from one starting source to one ending

resource of an arc.An arc identify a possible (or allowable) set of traversals.

remote

resource

local

resource

remote

resource

remote

resource

Linkarc arc

arc

Page 12: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 12

Information associated with a link

structural information: participating local/remote sources.

traversal (behavior) information used arcs

semantic information title : human readable information about the (meaning of

the ) link role : an URI uniquely identifying the relation the link

belongs to. Ex: http://relations.org/family, http://relations.org/employee

Page 13: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 13

information associated with a resource

structural information: location (URI) of the resource (needed for remote source only)

semantic information: title : human readable description about the meaning ? of

the resource. Note: it is unclear from the spec that the title information

should describe either the set the resource is a member of or the property the resource plays in the link.

role: a RUI reference uniquely identifying the property the resource play in the link.

ex: http://relation.org/family/father v.s. http://relation.org/person

Auxiliary information: label: identifying a group the resource belong to.

Page 14: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 14

information associated with an arc

structural information from : a label identifying all staring resources to: a label identifying all ending resources

semantic information: title: human readable information about the meaning of the arc. arcrole: a URI reference identifying a resource which describe th

e intended property (meaning or relation) of the arc. ex: an arc from TA students’ homeworks may have a arcrole v

alue of http://relation.org/courses/grading. behavior information:

show : what the system should behave when the arc is traversed ?

possibe values: new | replace | embed | none | other actuate: when should the arc be traversed ? possible values: onLoad | onRequest | none | other

Page 15: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 15

How Xlink describe links in an XML document

Entities that need to be represented:

link ( simple# / extended#) : title#!, role!, resource ( local# / resource# )

title#!, role!, location!, label!

arc!

title#!, arcrole!, from!, to!, show!, actuate!

Notes: 1. # means represented by element 2. ! means represented by global attributes 3. Any element asserting existence of a link in XLink is called an [XLin

k] linking element. there are 2 linking elements 4. Any elements related to XLink is called a Xlink element. 5. There are 6 Xlink elements, two linking elements, two for resource, o

ne for title and one for arc.

Page 16: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 16

How Xlink describe links in an XML document

1. Adopt the XML namespace approach instead of HTML’s approach. no elements invented simply for the need of Xlink. (cf. A and IMG in HTML)

2. Define a set of 10 global attributes under the Xlink namespace with URI: http://www.w3.org/1999/xlink x:type : simple | extended | locator | resource |title | role each identify a different kind of xlink elements. x:href : a URI reference identifying a resource x:role, x:arcrole : URI reference x:title : strings (CDATA) x:show, x:actuate : x:from, x:to : a label defined in a resource x:label: NCName

Page 17: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 17

How Xlink describe links in an XML document

3. use the value of the global attribute x:type to identifying an xlink (related) element and its kind.

ex: < … xmlns:x = “http://www.w3.org/1999/xlink” … > … <e1 x:type=“extended”…>… </e1>

<e2 x:type=“xxx” … > … </e2>Then :

e1 is an extended-type link, and in general we call e2 an xxx-type element, where xxx is any possibl

e value of x:type : simple | extended | locator | resource | title | role

Note: 1. e1 and e2 can has its own attributes and contents. 2. Xlink behaves more like interface than class in java in t

he sense that it can be embeded on all existing elements.

Page 18: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 18

How Xlink related information is represented

4. entity type representation link simple link simple-type element extended link extended-type element resource local resource resource-type element remote resource locator-type element arc arc-type element title [link, resource, arc] x:title, title-type element role [link and resource] x:role arcrole x:arcrole starting resources x:from ending resources x:to arc target x:label

Page 19: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 19

Notes:

1. Each information item associated with an entity (i.e., link or resource or arc) is represented either as one of its attributes or as one of its child elements.

2. Title information can be represented by the attribute x:title and/or by multiple child title-type elements. Ex:

<link1 x:type=“extended” x:title=“aboutLink1” x:role=“aRUI” > <remoteResource1 x:type=“locator” x:href=“…” x:title=“AboutRemoteResource1”/> <localResource1 x:type=“resource” …> … </localResource1> <title1 x:type=“title” xml:lang=“en”> English description about link1 </title1> <title2 x:type=“title” xml:lang=“zh_TW”>Link1 的中文說明 </title2> <title3>This is not a title of link1 since it is not a title-type element<

/title3> <book> <title4 x:type=“simple” x:href=“aURL” x:title=“not a title of l

ink1”/> …</book> … Note:Neither title3 nor x:title of title4 is a title of link1.

Page 20: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 20

Required and optional attributes in an xlink element

simple extended locator resource title arc

type R R R R R R

href O R

role O O O O

arcrole O O

title O O O O O

show O O

actuate O O

label O O

from O

to O

R: required O: optional

Page 21: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 21

possible children and attributes of an Xlink Element

xlink element Allowable xlink

children

allowable xlink attributes

simple -- type, href?, role?, arcrole?,

title?, show?, actuate?

extended locator*, arc*, resource*, title*

type, role?, title?

locator title* type, href, role?, title?, label?

arc title* type, arcrole?, title?, show?,

actuate?, from?,to?

resource -- type, role?, title?, label?

title -- type

Note: * : zero or more; ?: zero or one ; otherwise: exactly once.

Page 22: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 22

Basic XLink terminology

Resource: any addressable unit of information or service [RFC2396]. (i.e., have an URI) Examples: files, images, documents, programs, and

query results. Link: Explicit relationship between two or more resources. Linking element: An XML element that asserts the

existence and describes the characteristics of a link. A local resource comes from the linking element's own

content or is the linking element itself. Locator: An identification of a remote resource that is

participating in the link. - one linking element defines a set of traversable arcs

between some resources. Out-of-line link: link with no local resource. Inline link: link with local resource.

Page 23: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 23

Example

The XLink namespace :

http://www.w3.org/1999/xlink

The use of XLink elements and attributes requires declaration of the XLink namesapce:

<myElement xmlns:x="http://www.w3.org/1999/xlink">

...

</myElement>

Page 24: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 24

Example1: a simple link

<my:crossReference xmlns:my="http://example.com/" xmlns:x="http://www.w3.org/1999/xlink" x:type="simple"

x:href="students.xml" x:role="studentlist"

x:title="Student List" x:show="new“ x:actuate="onRequest"> Current List of Students </my:crossReference>Note: Simple link is Xlink’s analog of the A element of HTM

L. It serves at the same time as a binary link, a remote resource, a local resource (itself) and an outbound arc.

Page 25: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 25

Use Attribute value default to eliminate redundancy

<!ATTLIST my:crossreference xmlns:my CDATA #FIXED “http://example.com/” xmlns:x CDATA #FIXED http://www.w3.org/1999/xlink x:type CDATA #FIXED "simple" x:show CDATA "new“ x:actuate CDATA "onRequest“ >Simplfied instance:<my:crossReference x:href="students.xml" x:role="studentlist" x:title="Student List"> Current List of Students </my:crossReference>

Page 26: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 26

Examle2: an example of crossreference with non XLink attributes

<my:crossReference

xmlns:my="http://example.com/"

my:lastEdited="2000-06-10" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"

xlink:href="students.xml">

Current List of Students </my:crossReference>

Page 27: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 27

Example3: an extended-type element and its subelements

The DTDs1. <!ELEMENT courseload ((tooltip|person|course|gpa|go)*)>2. <!ATTLIST courseload 3. xmlns:xlink CDATA #FIXED http://www.w3.org/1999/xlink4. xlink:type (extended) #FIXED "extended" 5. xlink:role CDATA #IMPLIED 6. xlink:title CDATA #IMPLIED>

7. <!ELEMENT tooltip ANY>8. <!ATTLIST tooltip 9. xlink:type (title) #FIXED "title" 10. xml:lang CDATA #IMPLIED>

Notes: 1. 3 & 4 means courseload is an extended link by default and hence need not specify these attributes explicitly in document instances.

2. Similarly, tooltip is a title-type element.

Page 28: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 28

Example3: (the DTDs continued)

1. <!ELEMENT person EMPTY>

2. <!ATTLIST person <!-- a remote resource -->3. xlink:type (locator) #FIXED "locator"

4. xlink:href CDATA #REQUIRED

5. xlink:role CDATA #IMPLIED

6. xlink:title CDATA #IMPLIED

7. xlink:label NMTOKEN #IMPLIED>

8. <!ELEMENT course EMPTY>

9. <!ATTLIST course <!-- a remote resource -->10. xlink:type (locator) #FIXED "locator"

11. xlink:href CDATA #REQUIRED

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

13. xlink:title CDATA #IMPLIED

14. xlink:label NMTOKEN #IMPLIED>

Note: Both person and course are remote resources.

Page 29: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 29

Example3: (the DTDs continued)

1. <!ELEMENT gpa ANY >2. <!ATTLIST gpa <!-- a local resource of courseload -->3. xlink:type (resource) #FIXED "resource" 4. xlink:role CDATA #FIXED5. "http://www.example.com/linkprops/gpa" 6. xlink:title CDATA #IMPLIED 7. xlink:label NMTOKEN #IMPLIED>

8. <!ELEMENT go EMPTY>9. <!ATTLIST go <!-- an arc of courseload -->10. xlink:type (arc) #FIXED "arc" 11. xlink:arcrole CDATA #IMPLIED 12. xlink:title CDATA #IMPLIED 13. xlink:show (new |replace |embed |other |none) #IMPLIED14. xlink:actuate (onLoad |onRequest |other |none) #IMPLIED15. xlink:from NMTOKEN #IMPLIED 16. xlink:to NMTOKEN #IMPLIED>

Page 30: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 30

Examle3 : an instance courseload element

1. <courseload> <!-- a link -->2. <tooltip>Course Load for Pat Jones</tooltip> <!-- a title -->3. <person xlink:href="students/patjones62.xml“4. xlink:label="student62“<!-- a remote resource -->5. xlink:role=“http://www.example.com/linkprops/student

”6. xlink:title="Pat Jones" />7. <person xlink:href="profs/jaysmith7.xml“8. xlink:label="prof7“<!-- a remote resource -->9. xlink:role=“http://www.example.com/linkprops/profess

or”10. xlink:title="Dr. Jay Smith" /> 11.<!-- more remote resources for professors, teaching assist

ants, etc. --> 12.<course xlink:href="courses/cs101.xml" 13. xlink:label="CS-101" 14. xlink:title="Computer Science 101" />15. <!-- more remote resources for courses,seminars,etc.--> 16. <gpa xlink:label="PatJonesGPA">3.5</gpa> <!--local resource-->

Page 31: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 31

Examle3 : an instance courseload element

1. <go xlink:from="student62" xlink:to="PatJonesGPA"

2. xlink:show="new" xlink:actuate="onRequest"

3. xlink:title="Pat Jones's GPA" />

4. <go xlink:from="CS-101“xlink:to="student62"

5. xlink:arcrole=http://www.example.com/linkprops/auditor

6. xlink:show="replace" xlink:actuate="onRequest"

7. xlink:title="Pat Jones, auditing the course" />

8. <go xlink:from="student62“ xlink:to="prof7"

9. xlink:arcrole=http://www.example.com/linkprops/advisor

10. xlink:show="replace" xlink:actuate="onRequest"

11. xlink:title="Dr. Jay Smith, advisor" />

12.</courseload>

Page 32: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 32

Example4: Sample resource-Type Element Declarations and Instance

DTD

1. <!ELEMENT gpa ANY>

2. <!ATTLIST gpa

3. xlink:type (resource) #FIXED "resource“

4. xlink:role CDATA #FIXED

5. http://www.example.com/linkprops/gpa

6. xlink:title CDATA #IMPLIED

7. xlink:label NMTOKEN #IMPLIED> Instance

1. <gpa xlink:label="PatJonesGPA">3.5</gpa>

Page 33: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 33

Example5: Sample locator-Type Element Declarations and Instance

DTDs1. <!ELEMENT person EMPTY>

2. <!ATTLIST person

3. xlink:type (locator) #FIXED "locator“

4. xlink:href CDATA #REQUIRED

5. xlink:role CDATA #IMPLIED

6. xlink:title CDATA #IMPLIED

7. xlink:label NMTOKEN #IMPLIED>

8. <!ELEMENT course EMPTY>

9. <!ATTLIST course

10. xlink:type (locator) #FIXED "locator“

11. xlink:href CDATA #REQUIRED

12. xlink:role CDATA #FIXED

13. "http://www.example.com/linkprops/course"

14. xlink:title CDATA #IMPLIED

15. xlink:label NMTOKEN #IMPLIED>

Page 34: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 34

Example5: Sample locator-Type Element Declarations and Instance

Instances1. <person 2. xlink:href="students/patjones62.xml“3. xlink:label="student62“4. xlink:role =5. "http://www.example.com/linkprops/student" 6. xlink:title="Pat Jones" />7. <person xlink:href="profs/jaysmith7.xml“8. xlink:label="prof7“9. xlink:role=10. "http://www.example.com/linkprops/professor"

xlink:title="Dr. Jay Smith" />11.<course xlink:href="courses/cs101.xml“12. xlink:label="CS-101" 13. xlink:title="Computer Science 101" />

Page 35: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 35

label , from and to attributes

Page 36: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 36

label, from and to attributes

label attributes declared at locator or resources can be used to identify the starting (from) or ending(to) resource of an arc.

Ex:<go xlink:type="arc"

xlink:from="A" xlink:to="B" />

<go xlink:type="arc"

xlink:from="C" xlink:to="B" />

Note: Both from and to are optional attributes of arc element. If omitted, it means all resources are starting (or ending) resources.

Page 37: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 37

Example6:

<extendedlink xlink:type="extended"> <loc xlink:type="locator" xlink:href="..." xlink:label

="parent" xlink:title="p1" /> <loc xlink:type="locator" xlink:href="..." xlink:label

="parent" xlink:title="p2" /> <loc xlink:type="locator" xlink:href="..." xlink:label

="child" xlink:title="c1" /> <loc xlink:type="locator" xlink:href="..." xlink:label

="child" xlink:title="c2" /> <loc xlink:type="locator" xlink:href="..." xlink:label

="child" xlink:title="c3" /> ... <!-- arc-type elements would go here --></extendedlink> <go xlink:type="arc" xlink:from="parent“ xlink:to="child" /> included traversals: {p1,p2} {c1,c2,c3}, i.e., p1c1, p1c2, p1c3, p2c1, p2c2, and p2c3:

Page 38: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 38

Examle6 (continued)

<go xlink:type="arc" xlink:to="child" />

from omitted => {p1, p2, c1,c2, c3} {c1, c2, c3}

<go xlink:type=“arc” />

from and to omitted => {p1,p2,c1,c2,c3} {p1,p2,c1,c2,c3}

Page 39: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 39

Example 7: Sample arc-Type Element Declarations and Instance

DTDs

1. <!ELEMENT go EMPTY>

2. <!ATTLIST go

3. xlink:type (arc) #FIXED "arc"

4. xlink:arcrole CDATA #IMPLIED

5. xlink:title CDATA #IMPLIED

6. xlink:show

7. (new |replace |embed |other |none) #IMPLIED

8. xlink:actuate

9. (onLoad |onRequest |other |none) #IMPLIED

10. xlink:from NMTOKEN #IMPLIED

11. xlink:to NMTOKEN #IMPLIED>

Page 40: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 40

Example 7: Sample arc-Type Element Declarations and Instance

Instances

1. <go xlink:from="student62“ xlink:to="PatJonesGPA"

2. xlink:show="new“ xlink:actuate="onRequest“

3. xlink:title="Pat Jones's GPA" />

4. <go xlink:from="CS-101“ xlink:to="student62"

5. xlink:show="replace" xlink:actuate="onRequest" xlink:title="Pat Jones, auditing the course" />

6. xlink:arcrole="http://www.example.com/linkprops/auditor"

7. <go xlink:from="student62“ xlink:to="prof7"

8. xlink:show="replace" xlink:actuate="onRequest"

9. xlink:arcrole="http://www.example.com/linkprops/advisor"

10.xlink:title="Dr. Jay Smith, advisor" />

Page 41: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 41

Example 8: Sample title-Type Element Declarations and Instance

the DTDs<!ELEMENT advisorname (name)> <!ATTLIST advisorname xlink:type (title) #FIXED "title" xml:lang CDATA #IMPLIED><!ELEMENT name (honorific?, given, family)><!-- Further subelement declarations for names -->A instance<advisor xlink:href="profs/jaysmith7.xml"...> <advisorname xml:lang="en"> <name><honorific>Dr.</honorific> <given>Jay</given> <family>Smith</family> </name></advisorname></advisor>

Page 42: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 42

Linkbases

Types of arcs: outbound arcs, inbound arcs, third-party arcs

Examples of outbound arc: HTML A and IMG elements.Typically, a link contains only one kind of arc, and might

be referred to as an inbound, outbound, or third-party link.

Documents containing collections of inbound and third-party links are called link databases, or linkbases.

Note: Linkbase behaves like index in database.

outbound inbound third-party

starting resource local remote remote

ending resource remote local remote

Page 43: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 43

Locating Linkbases (Special Arc Role)

The problem: to traverse an arc, we need to locate the staring resource and the link. Not a problem for outbound arcs since the starting resource is either the

linking element itself or a child of the linking element. But how could the XLink application find both pieces for inb

ound and third-party arcs ?Solution:

Collect related inbound and third-party linking elements into many related linkbases.

A document that need traverse may declare special linkbase arcs (whose arcrole is predefined by Xlink to be http://http://www.w3.org/1999/xlink/properties/linkbase ) linking to potential linkbases of which the document or contents of it is a starting resource of an arc.

When the document is loaded (or on request) the xlink application can traverse linkbase arcs and retrieve all potential links in advance.

Page 44: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 44

Example 9: Annotating a Specification

The DTDs : an extended link that specializes in providing linkbase arcs:

1. <!ELEMENT basesloaded ((startrsrc|linkbase|load)*)>

2. <!ATTLIST basesloaded <!– a link -->

3. xlink:type (extended) #FIXED "extended">

4. <!ELEMENT startrsrc EMPTY>

5. <!ATTLIST startrsrc <!– a resource -->

6. xlink:type (locator) #FIXED "locator“

7. xlink:href CDATA #REQUIRED

8. xlink:label NMTOKEN #IMPLIED>

9. <!ELEMENT linkbase EMPTY>

10.<!ATTLIST linkbase <!– the linkbase resource -->

11. xlink:type (locator) #FIXED "locator"

12. xlink:href CDATA #REQUIRED

13. xlink:label NMTOKEN #IMPLIED>

Page 45: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 45

The DTDs (continued)

1. <!ELEMENT load EMPTY>

2. <!ATTLIST load <!– linkbase arc -->

3. xlink:type (arc) #FIXED "arc"

4. xlink:arcrole CDATA #FIXED

5. "http://www.w3.org/1999/xlink/properties/linkbase"

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

7. xlink:from NMTOKEN #IMPLIED

8. xlink:to NMTOKEN #IMPLIED>

Note: for linkbase arc, the show attribute has no effect since its default behavior is, according to the spec, that the XLink application should extract links from the linkbase.

Page 46: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 46

Example 9: Annotating a Specification

Usage 1:

1. <basesloaded>

2. <startrsrc xlink:label="spec“

3. xlink:href="spec.xml" />

4. <linkbase xlink:label="linkbase“

5. xlink:href="linkbase.xml" />

6. <load xlink:from="spec"

7. xlink:to="linkbase"

8. actuate="onLoad" />

9. </basesloaded>

Note:This link indicate that when spec.xml is loaded, linkbase.xml should automatically be loaded as well, possibly necessitating re-rendering of the entire specification document to reveal any regions within it that serve as starting resources in the links found in the linkbase.

Page 47: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 47

Usage 2:

1. <basesloaded>

2. <startrsrc xlink:label="spec“

3. xlink:href="spec.xml#string-range(//*,

4. 'Click here to reveal annotations.')" />

5. <linkbase xlink:label="linkbase" xlink:href="linkbase.xml" />

6. <load xlink:from="spec" xlink:to="linkbase"

7. actuate="onRequest" />

8. </basesloaded>

Notes:

1. The remote resource is not spec.xml but a portion of it.

2. linkbase.xml would be loaded only on request (possibly a click on the remote resource: 'Click here to reveal annotations.'.

Page 48: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 48

spec.xml:

<words>

this is a …

<word>word1</word1> ..

normal text …

<word>word2</word>

</words>

linkbase.xml:

<annotations>

<annotation x:type=“extended”>

<source x:href=http:///spec.xml#xpointer(//word[1]”

x:label=“word”/>

<meaning x:type=“resource” x:label=“meaning”>

word1 means … </meaning>

<arc x:from=“word” x:to=“meaning”

x:show=“…” x:actuate=“…” />

</annotation>

</annotations>

basesloaded

Relation among basesloaded, spec.xml and linkebase.xml

load

Page 49: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 49

Simple Links (simple-Type Element)

A simple link is a link that associates exactly two resources, one local and one remote, with an arc going from the local to the remote. simple link is always an outbound link.

Page 50: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 50

Simple Links (simple-Type Element)

A simple link combines all the features above (except for the types and labels) into a single element.

The features missing from simple links: Supplying arbitrary numbers of local and remote resources Specifying an arc from its remote resource to its local reso

urce title of the earc role or title of the local resource role or title of the link

Meaning of attributes in a simple link: x:href : URI ref of remote resource x:role, x:title : role and title of remote resource x:arctitle, x:show, x:actuate: … of the arc

Page 51: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 51

Example 10: simple link

dtds:

1. <!ELEMENT studentlink ANY>

2. <!ATTLIST studentlink

3. xlink:type (simple) #FIXED "simple"

4. xlink:href CDATA #IMPLIED

5. xlink:role NMTOKEN #FIXED

6. “http://www.example.com/linkprops/student”

7. xlink:arcrole CDATA #IMPLIED

8. xlink:title CDATA #IMPLIED

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

10. xlink:actuate(onLoad|onRequest|other|none) #IMPLIED> instance: …<studentlink xlink:href="students/patjones62.xml">Pat

Jones</studentlink> is popular around the student union.

Page 52: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 52

Allowable value of the locator attribute (href)

must be a URI reference as defined in [IETF RFC 2396], or must result in a URI reference after the escaping procedure described below is applied. The procedure is applied when passing the URI reference to a URI resolver.

characters disallowed in URI references, even if they are allowed in XML; (section 2.4 IETF RFC 2396) all non-ASCII characters ( > 7F), control : 00-1F, 7F, space(20), delims = "<" | ">" | "#" | "%" | <"> unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" except for (#) and (%) and the square bracket characters r

e-allowed in [IETF RFC 2732].

Page 53: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 53

escape procedure

Disallowed characters must be escaped as follows:

1. Each disallowed character is converted to UTF-8 [IETF RFC 2279] as one or more bytes.

2. Any bytes corresponding to a disallowed character are escaped with the URI escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the byte value).

3. The original character is replaced by the resulting character sequence.

Page 54: Introduction to XLink Transparency No. 1 Introduction to XML Linking Language (XLink) Cheng-Chia Chen.

Introduction to XLink

Transparency No. 54

UTF-8 Definition

UCS-4 range (hex.) UTF-8 octet sequence (binary)

0000 0000-0000 007F 0xxxxxxx 0000 0080-0000 07FF 110xxxxx 10xxxxxx 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx

0001 0000-001F FFFF 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 0020 0000-03FF FFFF 111110xx 10xxxxxx 10xxxxx 10xxxxxx 10xxxxxx 0400 0000-7FFF FFFF 1111110x 10xxxxxx ... 10xxxxxx