XML Design (A Gentle Transition from XML to RDF) - PowerPoint PPT Presentation

1 / 85
About This Presentation
Title:

XML Design (A Gentle Transition from XML to RDF)

Description:

... can use standard XML editors and validators to create, edit, and validate your XML. ... http://www.w3.org/RDF/Validator/ This RDF parser will tell you if your XML ... – PowerPoint PPT presentation

Number of Views:138
Avg rating:3.0/5.0
Slides: 86
Provided by: roger240
Category:

less

Transcript and Presenter's Notes

Title: XML Design (A Gentle Transition from XML to RDF)


1
XML Design(A Gentle Transition from XML to RDF)
  • Roger L. Costello
  • David B. Jacobs
  • The MITRE Corporation
  • (The creation of this tutorial was sponsored by
    DARPA)

2
Acknowledgments
  • We are very grateful to the Defense Agency
    Research Projects Agency (DARPA) for funding the
    creation of this tutorial. We are especially
    grateful to Murray Burke (DARPA) and John Flynn
    (BBN) for making it all happen.
  • Special thanks to Frank Manola for answering our
    many questions.

3
What is the Purpose of RDF?
  • The purpose of RDF (Resource Description
    Framework) is to give a standard way of
    specifying data "about" something.
  • Here's an example of an XML document that
    specifies data about China's Yangtze river

lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"gt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
"Here is data about the Yangtze River. It has a
length of 6300 kilometers. Its startingLocation
is western China's Qinghai-Tibet Plateau. Its
endingLocation is the East China Sea."
4
XML --gt RDF
5
The RDF Format
RDF provides an ID attribute for identifying the
resource being described.
1
The ID attribute is in the RDF namespace.
2
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt lt/Rivergt
Add the "fragment identifier symbol" to the
namespace.
3
6
The RDF Format (cont.)
7
Namespace Convention
8
The RDF Format
lt?xml version"1.0"?gt ltClass rdfID"Resource"
xmlnsrdf"http//www.w3.org/1999/02/22-r
df-syntax-ns" xmlns"uri"gt
ltpropertygtvaluelt/propertygt
ltpropertygtvaluelt/propertygt ... lt/Classgt
9
Advantage of using the RDF Format
  • You may ask "Why should I bother designing my
    XML to be in the RDF format?"
  • Answer there are numerous benefits
  • The RDF format, if widely used, will help to make
    XML more interoperable
  • Tools can instantly characterize the structure,
    "this element is a type (class), and here are its
    properties.
  • RDF promotes the use of standardized vocabularies
    ... standardized types (classes) and standardized
    properties.
  • The RDF format gives you a structured approach to
    designing your XML documents. The RDF format is
    a regular, recurring pattern.
  • It enables you to quickly identify weaknesses and
    inconsistencies of non-RDF-compliant XML designs.
    It helps you to better understand your data!
  • You reap the benefits of both worlds
  • You can use standard XML editors and validators
    to create, edit, and validate your XML.
  • You can use the RDF tools to apply inferencing to
    the data.
  • It positions your data for the Semantic Web!

Interoperability
Network effect
10
Disadvantage of using the RDF Format
  • Constrained the RDF format constrains you on how
    you design your XML (i.e., you can't design your
    XML in any arbitrary fashion).
  • RDF uses namespaces to uniquely identify types
    (classes), properties, and resources. Thus, you
    must have a solid understanding of namespaces.
  • Another XML vocabulary to learn to use the RDF
    format you must learn the RDF vocabulary.

11
Uniquely Identify the Resource
  • Earlier we said that RDF is very concerned about
    uniquely identifying the type (class) and the
    properties. RDF is also very concerned about
    uniquely identifying the resource, e.g.,

This is the resource being described. We want to
uniquely identify this resource.
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt lt/Rivergt
12
rdfID
  • The value of rdfID is a "relative URI".
  • The "complete URI" is obtained by concatenating
    the URL of the XML document with "" and then the
    value of rdfID, e.g.,

lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt lt/Rivergt
Yangtze.rdf
Suppose that this RDF/XML document is located at
this URL http//www.china.org/geography/rivers. T
hus, the complete URI for this resource is
http//www.china.org/geography/riversYangtze
13
xmlbase
  • On the previous slide we showed how the URL of
    the document provided the base URI.
  • Depending on the location of the document is
    brittle it will break if the document is moved,
    or is copied to another location.
  • A more robust solution is to specify the base URI
    in the document, e.g.,

lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlbase"http//www.chi
na.org/geography/rivers"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt lt/Rivergt
Resource URI concatenation(xmlbase, '',
rdfID)
concatenation(http//www.china.org/geography/river
s, '', "Yangtze")
http//www.china.org/geography/riversYangtze
14
rdfabout
  • Instead of identifying a resource with a relative
    URI (which then requires a base URI to be
    prepended), we can give the complete identity of
    a resource. However, we use rdfabout, rather
    than rdfID, e.g.,

lt?xml version"1.0"?gt ltRiver rdfabout"http//www
.china.org/geography/riversYangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.geodesy.org/ri
ver"gt ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
15
Triple -gt resource/property/value
16
The RDF Format triples!
  • The fundamental design pattern of RDF is to
    structure your XML data as resource/property/value
    triples!

lt?xml version"1.0"?gt ltResource-Agt
ltproperty-Agt ltResource-Bgt
ltproperty-Bgt ltResource-Cgt
ltproperty-Cgt
Value-C
lt/property-Cgt lt/Resource-Cgt
lt/property-Bgt
lt/Resource-Bgt lt/property-Agt lt/Resource-Agt
Notice that the RDF design pattern is
an alternating sequence of resource-property. Thi
s pattern is known as "striping".
value of property-A
value of property-B
The value of a property can be a literal (e.g.,
length has a value of 6300 kilometers). Also, the
value of a property can be a resource, as shown
above (e.g., property-A has a value of
Resource-B, property-B has a value of
Resource-C). We will see examples of properties
having a resource value in a little bit.
17
Naming Convention
  • The convention is to use a capital letter to
    start a type (class) name, and use a lowercase
    letter to start a property name.
  • This helps the eye quickly discern the striping
    pattern.

lt?xml version"1.0"?gt ltRiver rdfabout"http//www
.china.org/geography/riversYangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.geodesy.org/ri
ver"gt ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
uppercase
lowercase
18
RDF Model (graph)
Legend Ellipse indicates "Resource"
Rectangle indicates "literal string value"
19
rdfDescription rdftype
  • There is still another way of representing the
    XML. This way makes it very clear that you are
    describing something, and it makes it very clear
    what the type (class) is of the thing you are
    describing

lt?xml version"1.0"?gt ltrdfDescription
rdfabout"http//www.china.org/geography/riversY
angtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns"
xmlns"http//www.geodesy.org/river"gt
ltrdftype rdfresource"http//www.geodesy.org/riv
erRiver"/gt ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's
Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
rdfDescriptiongt
This is read as "This is a Description about the
resource http//www.china.org/geography/riversYan
gtze. This resource is an instance of the River
type (class). The http//www.china.org/geography/r
iversYangtze resource has a length of 6300
kilometers, a startingLocation of western China's
Qinghai-Tibet Plateau, and an endingLocation of
the East China Sea."
Note this form of describing a resource is
called the "long form". The form we have seen
previously is an abbreviation of this long form.
An RDF Parser interprets the abbreviated form as
if it were this long form.
20
Alternative
  • Alternatively we can use rdfID rather than
    rdfabout, as shown here

lt?xml version"1.0"?gt ltrdfDescription
rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns"
xmlns"http//www.geodesy.org/river"
xmlbase"http//www.china.org/geo
graphy/rivers"gt ltrdftype rdfresource"http
//www.geodesy.org/riverRiver"/gt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
rdfDescriptiongt
21
Equivalent Representations!
Note In the RDF literature the examples are
typically shown in this form.
22
RDF Namespace
23
Terminology
  • As you read the RDF literature you may see the
    following terminology
  • Subject this term refers to the item that is
    playing the role of the resource.
  • predicate this term refers to the item that is
    playing the role of the property.
  • Object this term refers to the item that is
    playing the role of the value.

24
RDF Parser
  • There is a nice RDF parser at the W3 Web site

http//www.w3.org/RDF/Validator/
This RDF parser will tell you if your XML is in
the proper RDF format.
25
Example 2
Modify the following XML document so that it is
RDF-compliant
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"gt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt
ltDam id"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30 billionlt/costgt
lt/Damgt lt/Rivergt
Yangtze2.xml
26
Note the two types (classes)
Dam
River
Instance Yangtze Properties length startingLoc
ation endingLocation
Instance ThreeGorges Properties name width he
ight cost
27
Dam - out of place
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"gt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt
ltDam id"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30 billionlt/costgt
lt/Damgt lt/Rivergt
Dam
Types (classes) contain properties . Here we see
the River type containing the properties -
length, startingLocation, and endingLocation. It
also shows River containing a type - Dam. Thus,
there is a Resource that contains another
Resource. This is inconsistent with RDF design
pattern. (We are seeing one of the benefits of
using the RDF format - to identify
inconsistencies in an XML design.)
28
Property value must be a Literal or a Resource
ltlengthgt6300 kilometerslt/lengthgt
property
Value is a Literal
ltobstaclegt ltDam id"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30 billionlt/costgt
lt/Damgt lt/obstaclegt
property
Value is a Resource
29
Modified XML (to make it consistent)
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"gt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt
ltobstaclegt ltDam id"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt
ltheightgt610 feetlt/heightgt ltcostgt30
billionlt/costgt lt/Damgt
lt/obstaclegt lt/Rivergt
Yangtze2,v2.xml
"The Yangtze River has an obstacle that is the
ThreeGorges Dam. The Dam has a name - The Three
Gorges Dam. It has a width of 1.5 miles, a
height of 610 feet, and a cost of 30 billion."
30
RDF Format
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlbase"http//www.chi
na.org/geography/rivers"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt ltobstaclegt
ltDam rdfID"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30
billionlt/costgt lt/Damgt
lt/obstaclegt lt/Rivergt
Changed id to rdfID
Added the '' symbol
As always, the other representations using
rdfabout and rdfDescription are available.
31
RDF Model (graph)
32
Alternatively, suppose that someone has already
created a document containing information about
the Three Gorges Dam
lt?xml version"1.0"?gt ltDam rdfID"ThreeGorges"
xmlnsrdf"http//www.w3.org/1999/02/22-
rdf-syntax-ns" xmlns"http//www.geode
sy.org/dam" xmlbase"http//www.china
.org/geography/rivers"gt ltnamegtThe Three
Gorges Damlt/namegt ltwidthgt1.5 mileslt/widthgt
ltheightgt610 feetlt/heightgt ltcostgt30
billionlt/costgt lt/Damgt
Three-Gorges-Dam.rdf
Then we can simply reference the Three Gorges Dam
resource using rdfresource, as shown here
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlbase"http//www.chi
na.org/geography/rivers"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt ltobstacle
rdfresource"http//www.china.org/geography/river
sThreeGorges"/gt lt/Rivergt
Yangtze.rdf
33
Note reference is to a resource, not to a file
34
Anyone, Anywhere, Anytime Can Talk About a
Resource
  • In all of our examples we have provided a unique
    identifier to resources, e.g.,

http//www.china.org/geography/riversYangtze
  • Consequently, if another RDF document identifies
    the same resource then the data that it specifies
    gives additional data about that resource.
  • An aggregator tool will be able to collect all
    data about a resource and present a consolidated
    set of data for the resource. That's powerful!

35
rdfID versus rdfabout
  • When should rdfID be used? When should
    rdfabout be used?
  • When you want to introduce a resource, and
    provide an initial set of information about a
    resource use rdfID
  • When you want to extend the information about a
    resource use rdfabout
  • The RDF philosophy is akin to the Web philosophy.
    That is, anyone, anywhere, anytime can provide
    information about a resource.

36
lt?xml version"1.0"?gt ltRiver rdfabout"http//www
.china.org/geography/riversYangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.geodesy.org/ri
ver"gt ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
http//www.china.org/geography/rivers/yangtze.rdf
lt?xml version"1.0"?gt ltRiver rdfabout"http//www
.china.org/geography/riversYangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.geodesy.org/ri
ver"gt ltnamegtDri Chu - Female Yak
Riverlt/namegt ltnamegtTongtian He,
Travelling-Through-the-Heavens Riverlt/namegt
ltnamegtJinsha Jiang, River of Golden Sandlt/namegt
lt/Rivergt
http//www.encyclopedia.org/yangtze-alternate-name
s.rdf
Aggregator tool collects data about the Yangtze
lt?xml version"1.0"?gt ltRiver rdfabout"http//www
.china.org/geography/riversYangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.geodesy.org/ri
ver"gt ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt
ltnamegtDri Chu - Female Yak Riverlt/namegt
ltnamegtTongtian He, Travelling-Through-the-Heavens
Riverlt/namegt ltnamegtJinsha Jiang, River of
Golden Sandlt/namegt lt/Rivergt
A distributed network of data!
Aggregated Data!
37
lt?xml version"1.0"?gt ltDam rdfID"ThreeGorges"
xmlnsrdf"http//www.w3.org/1999/02/22-r
df-syntax-ns" xmlns"http//www.geodes
y.org/dam" xmlbase"http//www.china.
org/geography/rivers"gt ltnamegtThe Three
Gorges Damlt/namegt ltwidthgt1.5 mileslt/widthgt
ltheightgt610 feetlt/heightgt ltcostgt30
billionlt/costgt lt/Damgt
Another Example of Aggregation
http//www.encyclopedia.org/three-gorges-dam.rdf
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlbase"http//www.chi
na.org/geography/rivers"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt ltobstacle
rdfresource"http//www.china.org/geography/river
s ThreeGorges"/gt lt/Rivergt
Aggregate!
http//www.china.org/geography/rivers/yangtze.rdf
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlbase"http//www.chi
na.org/geography/rivers"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt ltobstaclegt
ltDam rdfID"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30
billionlt/costgt lt/Damgt
lt/obstaclegt lt/Rivergt
Note that the reference to the ThreeGorges Dam
resource has been replaced by whatever
information the aggregator could find on this
resource!
38
Example 3
Notice that in this XML document there is no
unique identifier
lt?xml version"1.0"?gt ltRiver xmlns"http//www.geo
desy.org/river"gt ltnamegtYangtzelt/namegt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
XML
Yangtze3.xml
lt?xml version"1.0"?gt ltRiver xmlns"http//www.geo
desy.org/river"gt ltnamegtYangtzelt/namegt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
The RDF is identical to the XML!
RDF
Yangtze3.rdf
39
Interpreting the RDF
lt?xml version"1.0"?gt ltRiver xmlns"http//www.geo
desy.org/river"gt ltnamegtYangtzelt/namegt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
Yangtze3.rdf
This is read as "This is an instance of the
River type (class). The River has a name of
Yangtze, a length of 6300 kilometers, a
startingLocation of western China's
Qinghai-Tibet Plateau, and an endingLocation of
the East China Sea."
In this document the resource is anonymous - it
has no identifier.
40
Disadvantage of anonymous resources
lt?xml version"1.0"?gt ltRiver xmlns"http//www.geo
desy.org/river"gt ltnamegtYangtzelt/namegt
ltlengthgt6300 kilometerslt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
http//www.china.org/geography/rivers/yangtze.rdf
lt?xml version"1.0"?gt ltRiver xmlns"http//www.geo
desy.org/river"gt ltnamegtYangtzelt/namegt
ltnamegtDri Chu - Female Yak Riverlt/namegt
ltnamegtTongtian He, Travelling-Through-the-Heavens
Riverlt/namegt ltnamegtJinsha Jiang, River of
Golden Sandlt/namegt lt/Rivergt
http//www.encyclopedia.org/yangtze-alternate-name
s.rdf
Aggregate
An aggregator tool will not be able to determine
if these documents are talking about the same
resource.
41
Example 4
Yangtze4.xml
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsuom"http//www.me
asurements.org/units-of-measure"gt ltlengthgt
ltrdfDescriptiongt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt
lt/rdfDescriptiongt lt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
RDF
Yangtze4.rdf
42
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"
xmlnsuom"http//www.measurements.org/units-of
-measure"gt ltlength uomunits"kilometers"gt63
00lt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocation
gt lt/Rivergt
Yangtze4.xml
RDF does not allow attributes on the properties
(except for special RDF attributes such as
rdfresource). So we need to make the uomunits
attribute a child element. Your first instinct
might be to modify length to have two child
elements
43
rdfvalue
6300
length
kilometers
length has two values - 6300 and kilometers. RDF
provides a special property, rdfvalue, to be
used for specifying the "primary" value. In this
example, 6300 is the primary value,
and kilometers is a value which provides
additional information about the primary value.
44
RDF Format
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsuom"http//www.me
asurements.org/units-of-measure"gt ltlengthgt
ltrdfDescriptiongt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt
lt/rdfDescriptiongt lt/lengthgt
ltstartingLocationgtwestern China's Qinghai-Tibet
Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
An anonymous resource
Yangtze4.rdf
Read this as "The Yangtze River has a length
whose value is a resource which has a value of
6300 and whose units is kilometers.
45
Advantage of anonymous resources
46
RDF Model (graph)
Legend
An anonymous resource (also called a "blank
node"). That is, a resource with no identifier.
(Note RDF Parsers will typically generate a
unique identifier for anonymous resources,
to distinguish one anonymous resource from
another.)
47
rdfparseType"Resource"
If the value of a property is comprised of
several values then one option is to create an
anonymous resource, as we saw. RDF provides a
shorthand, so that you don't need to create an
rdfDescription element, by using
rdfparseType"Resource", as shown here
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsuom"http//www.me
asurements.org/units-of-measure"gt ltlength
rdfparseType"Resource"gt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt lt/lengthgt
ltstartingLocationgtwestern China's
Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt lt/
Rivergt
Yangtze4,v2.rdf
The meaning of this is identical to that shown on
the previous slide.
48
Equivalent!
ltlengthgt ltrdfDescriptiongt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt
lt/rdfDescriptiongt lt/lengthgt
ltlength rdfparseType"Resource"gt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt lt/lengthgt
49
Summary
Modify the following XML document so that it is
also a valid RDF document
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"
xmlnsuom"http//www.measurements.org/units-of
-measure"gt ltlength uomunits"kilometers"gt63
00lt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocation
gt ltDam id"ThreeGorges"
xmlns"http//www.geodesy.org/dam"gt
ltnamegtThe Three Gorges Damlt/namegt
ltwidthgt1.5 mileslt/widthgt ltheightgt610
feetlt/heightgt ltcostgt30 billionlt/costgt
lt/Damgt lt/Rivergt
Yangtze.xml
See next slide --gt
50
RDF Format!
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsuom"http//www.me
asurements.org/units-of-measure"
xmlbase"http//www.china.org/geography/rivers"gt
ltlength rdfparseType"Resource"gt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt lt/lengthgt
ltstartingLocationgtwestern China's
Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China Sealt/endingLocationgt
ltobstaclegt ltDam rdfID"ThreeGorges"
xmlns"http//www.geodesy.org/d
am"gt ltnamegtThe Three Gorges
Damlt/namegt ltwidthgt1.5 mileslt/widthgt
ltheightgt610 feetlt/heightgt
ltcostgt30 billionlt/costgt lt/Damgt
lt/obstaclegt lt/Rivergt
With relatively few changes the XML document is
now usable by both XML tools and RDF tools!
Yangtze.rdf
51
Example 5
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsuom"http//www.me
asurements.org/units-of-measure"gt ltlength
rdfparseType"Resource"gt
ltrdfvaluegt6300lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt lt/lengthgt
ltmaxWidth rdfparseType"Resource"gt
ltrdfvaluegt175lt/rdfvaluegt
ltuomunitsgtmeterslt/uomunitsgtlt/maxWidthgt
ltmaxDepth rdfparseType"Resource"gt
ltrdfvaluegt55lt/rdfvaluegt
ltuomunitsgtkilometerslt/uomunitsgt
lt/maxDepthgt lt/Rivergt
This is one way of doing it. Now we will see a
better way - using "typed literals". (See next
slide)
Yangtze5.rdf
52
Alternate RDF Format
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river"gt ltlength rdfdatatype"http//w
ww.uom.org/distancekilometer"gt6300lt/lengthgt
ltmaxWidth rdfdatatype"http//www.uom.org/distanc
emeter"gt175lt/maxWidthgt ltmaxDepth
rdfdatatype"http//www.uom.org/distancemeter"gt5
5lt/maxDepthgt lt/Rivergt
Yangtze5.rdf
With rdfdatatype you can give a property's value
a datatype label. The rdfdatatype value acts as
a semantic label for the datatype of the
value. This is called a typed literal. For this
example there must be a namespace,
http//www.uom.org/distance, which defines two
datatypes - kilometer and meter. On the next
slide is shown how to do this using XML Schemas.
53
Defining the kilometer and meter datatypes using
XML Schemas
lt?xml version"1.0" encoding"UTF-8"?gt ltschema
xmlnsxsd"http//www.w3.org/2001/XMLSchema"
targetNamespace"http//www.uom.org/dist
ance"gt ltsimpleType name"kilometer"gt
ltrestriction base"integer"gt
lt/restrictiongt lt/simpleTypegt
ltsimpleType name"meter"gt ltrestriction
base"integer"gt lt/restrictiongt
lt/simpleTypegt lt/schemagt
uom.xsd
54
Another example using rdfdatatype
lt?xml version"1.0"?gt ltPerson rdfID"JohnSmith"
xmlnsrdf"http//www.w3.org/1999/02/
22-rdf-syntax-ns"
xmlns"http//www.person.org"gt ltage
rdfdatatype"http//www.w3.org/2001/XMLSchemanon
NegativeInteger"gt30lt/agegt lt/Persongt
In this example we are specifying that the value
(30) of age is a nonNegativeInteger (which is
defined in the XML Schema namespace).
55
Example 6
Modify the following XML document so that it is
also a valid RDF document
lt?xml version"1.0"?gt ltWeatherReading
xmlns"http//www.meteorology.org"gt
ltWeathergt lttemperaturegt-2 degrees
Celsiuslt/temperaturegt ltbarometergt30.4
(rising)lt/barometergt lt/Weathergt
ltLocation xmlns"http//www.geodesy.org"gt
ltcountrygtUSAlt/countrygt
ltstategtMassachusettslt/stategt
ltcitygtBostonlt/citygt lt/Locationgt
ltdatetimegtJanuary 22, 2003, 1115
ESTlt/datetimegt lt/WeatherReadinggt
WMUR_TV_WeatherReading.xml
56
Things to note
1. The XML document is using three types
(classes)
2. The 3 type instances are anonymous.
Consequently, we cannot benefit from others,
and others cannot benefit from us. Where does
it make sense to give an identifier to an
instance? - In general, the root element
should have an identifier. - There is lots of
information about Boston. Let's give the
Location instance an identifier.
57
Modification 1 Identifiers added
lt?xml version"1.0"?gt ltWeatherReading
id"BOS-012203-1115"
xmlns"http//www.meteorology.org"gt
ltWeathergt lttemperaturegt-2 degrees
Celsiuslt/temperaturegt ltbarometergt30.4
(rising)lt/barometergt lt/Weathergt
ltLocation id"BOS"
xmlns"http//www.geodesy.org"gt
ltcountrygtUSAlt/countrygt
ltstategtMassachusettslt/stategt
ltcitygtBostonlt/citygt lt/Locationgt
ltdatetimegtJanuary 22, 2003, 1115
ESTlt/datetimegt lt/WeatherReadinggt
WMUR_TV_WeatherReading,v2.xml
58
Modification 2 Create a property for the
Weather, Location types
Types (classes) contain properties. We need to
wrap the Weather and Location types within a
property
lt?xml version"1.0"?gt ltWeatherReading
id"BOS-012203-1115"
xmlns"http//www.meteorology.org"gt
ltinstrumentReadinggt ltWeathergt
lttemperaturegt-2 degrees Celsiuslt/temperaturegt
ltbarometergt30.4
(rising)lt/barometergt lt/Weathergt
lt/instrumentReadinggt ltinstrumentLocationgt
ltLocation id"BOS"
xmlns"http//www.geodesy.org"gt
ltcountrygtUSAlt/countrygt
ltstategtMassachusettslt/stategt
ltcitygtBostonlt/citygt lt/Locationgt
lt/instrumentLocationgt ltdatetimegtJanuary 22,
2003, 1115 ESTlt/datetimegt lt/WeatherReadinggt
WMUR_TV_WeatherReading,v3.xml
59
RDF Format!
lt?xml version"1.0"?gt ltWeatherReading
rdfID"BOS-012203-1115"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-s
yntax-ns"
xmlns"http//www.meteorology.org"
xmlbase"http//www.wmur-tv.com/w
eather"gt ltinstrumentReadinggt
ltWeathergt lttemperaturegt-2 degrees
Celsiuslt/temperaturegt
ltbarometergt30.4 (rising)lt/barometergt
lt/Weathergt lt/instrumentReadinggt
ltinstrumentLocationgt ltLocation
rdfID"BOS"
xmlns"http//www.geodesy.org"
xmlbase"http//www.airports.org/icao"gt
ltcountrygtUSAlt/countrygt
ltstategtMassachusettslt/stategt
ltcitygtBostonlt/citygt lt/Locationgt
lt/instrumentLocationgt ltdatetimegtJanuary 22,
2003, 1115 ESTlt/datetimegt lt/WeatherReadinggt
WMUR_TV_WeatherReading.rdf
60
The rdfBag type (class)
  • The rdfBag type is used to represent an
    unordered collection.

61
Example 7
Modify the following XML document so that it is
also a valid RDF document
lt?xml version"1.0"?gt ltMeeting id"XML-Design-Patt
erns" xmlns"http//www.business.o
rg"gt ltattendeesgt ltnamegtJohn
Smithlt/namegt ltnamegtSally Joneslt/namegt
lt/attendeesgt lt/Meetinggt
DesignMeeting.xml
lt?xml version"1.0"?gt ltMeeting rdfID"XML-Design-
Pattern" xmlnsrdf"http//www.w3.
org/1999/02/22-rdf-syntax-ns"
xmlns"http//www.business.org"gt
ltattendeesgt ltrdfBaggt
ltnamegtJohn Smithlt/namegt
ltnamegtSally Joneslt/namegt lt/rdfBaggt
lt/attendeesgt lt/Meetinggt
rdfBag makes it clear that this is an
unordered collection of names.
DesignMeeting.rdf
62
The rdfAlt type (class)
  • The rdfAlt type is used to represent a set of
    alternate properties.

63
Example 8
64
The rdfSeq type (class)
  • The rdfSeq type is used to represent a sequence
    of properties.

65
Example 9
66
rdfli Property
  • The property, rdfli ("list item"), is provided
    by RDF for use with either rdfBag, rdfAlt, or
    rdfSeq.
  • The rdfli property is provided for you to
    specify an item in a Bag/Alt/Seq.
  • An RDF Parser will replace each rdfli with
    rdf_1, rdf_2, rdf_3, etc.
  • The following slide recasts the previous examples
    using the rdfli property.

67
lt?xml version"1.0"?gt ltRetailer
rdfID"BarnesAndNoble"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.retailers.
org"gt ltwebLocationgt ltrdfAltgt
ltrdfligthttp//www.bn.comlt/rdfligt
ltrdfligthttp//www.barnesandnoble.comlt/
rdfligt lt/rdfAltgt
lt/webLocationgt lt/Retailergt
lt?xml version"1.0"?gt ltMeeting rdfID"XML-Design-
Pattern" xmlnsrdf"http//www.w3.
org/1999/02/22-rdf-syntax-ns"
xmlns"http//www.business.org"gt
ltattendeesgt ltrdfBaggt
ltrdfligtJohn Smithlt/rdfligt
ltrdfligtSally Joneslt/rdfligt
lt/rdfBaggt lt/attendeesgt lt/Meetinggt
BarnesAndNoble.rdf
DesignMeeting.rdf
lt?xml version"1.0"?gt ltToDoList
rdfID"MondayMeetings"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.reminde
rs.org"gt ltactivitiesgt ltrdfSeqgt
ltrdfligtMeet with CEO at
10amlt/rdfligt ltrdfligtLuncheon at
The Eaterylt/rdfligt ltrdfligtFlight
at 3pmlt/rdfligt lt/rdfSeqgt
lt/activitiesgt lt/ToDoListgt
MyDaysActivities.rdf
68
Example 10
Modify the following XML document so that it is
also a valid RDF document
lt?xml version"1.0"?gt ltCatalogue
xmlns"http//www.publishing.org"
xmlnsdc"http//pur1.org/metadata/dublin-cor
e"gt ltBookgt
ltdcTitlegtLateral Thinkinglt/dcTitlegt
ltdcCreatorgtEdward de Bonolt/dcCreatorgt
ltdcDategt1973lt/dcDategt
ltISBNgt0-06-099325-2lt/ISBNgt
ltdcPublishergtHarper amp Rowlt/dcPublishergt
lt/Bookgt ltBookgt
ltdcTitlegtIllusions The Adventures of a
Reluctant Messiahlt/dcTitlegt
ltdcCreatorgtRichard Bachlt/dcCreatorgt
ltdcDategt1977lt/dcDategt
ltISBNgt0-440-34319-4lt/ISBNgt
ltdcPublishergtDell Publishing Co.lt/dcPublishergt
lt/Bookgt ltBookgt
ltdcTitlegtThe First and Last Freedomlt/dcTitlegt
ltdcCreatorgtJ. Krishnamurtilt/dcCrea
torgt ltdcDategt1954lt/dcDategt
ltISBNgt0-06-064831-7lt/ISBNgt
ltdcPublishergtHarper amp Rowlt/dcPublishergt
lt/Bookgt lt/Cataloguegt
Note regrettably, the Dublin Core does not
conform to the RDF naming conventions.
Hence, you see properties with the first
letter capitalized.
Barnes_and_Noble _BookCatalogue.xml
69
Things to note
1. The XML document uses two types (classes)
2. All type instances are anonymous.
Consequently, we cannot benefit from others,
and others cannot benefit from us. Where does
it make sense to give the instance an
identifier? - In general, the root element
should have an identifier. - There is lots of
information about each book instance.
Let's give each book instance an identifier (the
ISBN).
70
Modification 1 Identifiers added
lt?xml version"1.0"?gt ltCatalogue
id"BookCatalogue"
xmlns"http//www.publishing.org"
xmlnsdc"http//pur1.org/metadata/dublin-cor
e"gt ltBook id"_0-06-099325-2"gt
ltdcTitlegtLateral Thinkinglt/dcTitlegt
ltdcCreatorgtEdward de Bonolt/dcCreatorgt
ltdcDategt1973lt/dcDategt
ltdcPublishergtHarper amp
Rowlt/dcPublishergt lt/Bookgt ltBook
id"_0-440-34319-4"gt
ltdcTitlegtIllusions The Adventures of a
Reluctant Messiahlt/dcTitlegt
ltdcCreatorgtRichard Bachlt/dcCreatorgt
ltdcDategt1977lt/dcDategt
ltdcPublishergtDell Publishing Co.lt/dcPublishergt
lt/Bookgt ltBook id"_0-06-064831-7"gt
ltdcTitlegtThe First and Last
Freedomlt/dcTitlegt ltdcCreatorgtJ.
Krishnamurtilt/dcCreatorgt
ltdcDategt1954lt/dcDategt
ltdcPublishergtHarper amp Rowlt/dcPublishergt
lt/Bookgt lt/Cataloguegt
Why was an underscore placed in front of
the ISBN? Answer The ID datatype does not allow
an identifier to begin with a digit. So, we
(arbitrarily) decided to use an underscore.
Barnes_and_Noble _BookCatalogue,v2.xml
Notice that the ISBN elements were deleted and
their values used as identifiers.
71
Modification 2 Create a property for the Book
type
Barnes_and_Noble _BookCatalogue,v3.xml
72
RDF Format!
lt?xml version"1.0"?gt ltCatalogue
rdfID"BookCatalogue"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.publis
hing.org" xmlnsdc"http//pu
r1.org/metadata/dublin-core"
xmlbase"http//www.bn.com"gt ltitemgt
ltBook rdfID"_0-06-099325-2"
xmlbase"http//www.publishing.org/book"gt
ltdcTitlegtLateral Thinkinglt/dcTitlegt
ltdcCreatorgtEdward de
Bonolt/dcCreatorgt
ltdcDategt1973lt/dcDategt
ltdcPublishergtHarper amp Rowlt/dcPublishergt
lt/Bookgt lt/itemgt ltitemgt
ltBook rdfID"_0-440-34319-4"
xmlbase"http//www.publishing.org/book"gt
ltdcTitlegtIllusions The Adventures of
a Reluctant Messiahlt/dcTitlegt
ltdcCreatorgtRichard Bachlt/dcCreatorgt
ltdcDategt1977lt/dcDategt
ltdcPublishergtDell Publishing Co.lt/dcPublishergt
lt/Bookgt lt/itemgt
... lt/Cataloguegt
Barnes_and_Noble_BookCatalogue.rdf
73
Dublin Core (dc)
  • The Dublin Core is a standard set of properties

Note many people use these properties in their
HTML today. For example ltMETA
NAME"DC.Creator" CONTENT"John Smith"gt
74
rdfparseType"Collection"
  • This may be added as an attribute of a property
    to indicate that the contents of the property is
    a list of resources.
  • The following slide recasts the BookCatalogue
    example to use this list type.

75
lt?xml version"1.0"?gt ltCatalogue
rdfID"BookCatalogue"
xmlnsrdf"http//www.w3.org/1999/02/22-rdf-syntax
-ns" xmlns"http//www.publis
hing.org" xmlnsdc"http//pu
r1.org/metadata/dublin-core"
xmlbase"http//www.bn.com"gt ltbooks
rdfparseType"Collection"gt ltBook
rdfID"_0-06-099325-2"
xmlbase"http//www.publishing.org/book"gt
ltdcTitlegtLateral Thinkinglt/dcTitlegt
ltdcCreatorgtEdward de
Bonolt/dcCreatorgt
ltdcDategt1973lt/dcDategt
ltdcPublishergtHarper amp Rowlt/dcPublishergt
lt/Bookgt ltBook rdfID"_0-440-34319
-4" xmlbase"http//www.pub
lishing.org/book"gt
ltdcTitlegtIllusions The Adventures of a
Reluctant Messiahlt/dcTitlegt
ltdcCreatorgtRichard Bachlt/dcCreatorgt
ltdcDategt1977lt/dcDategt
ltdcPublishergtDell Publishing Co.lt/dcPublishergt
lt/Bookgt ...
lt/booksgt lt/Cataloguegt
Barnes_and_Noble_BookCatalogue.rdf
76
Example 11
77
rdfparseType"Literal"
  • In all of the previous examples the data was
    structured as resource/property/value triples.
  • Sometimes it doesn't make sense to do such
    structuring
  • Example with mixed content
  • In those cases we can simply indicate "hey, the
    content of this property is okay. Treat it as a
    literal XML string."

78
Dangers of rdfparseType"Literal"
  • The advantage of structuring your XML as
    resource/property/value triples is enhanced
    interoperability.
  • When you use rdfparseType"Literal" you lose the
    ability for a tool to instantly take advantage of
    the resource/property/value structure (since you
    are, by definition, saying that the data doesn't
    have this structure).
  • Lesson Learned use rdfparseType"Literal"
    sparingly!

79
Example 12
Modify the following XML document so that it is
also a valid RDF document
lt?xml version"1.0"?gt ltRiver id"Yangtze"
xmlns"http//www.geodesy.org/river"
length"6300 kilometers"
startingLocation"western China's Qinghai-Tibet
Plateau" endingLocation"East China
Sea"/gt
Note that attributes are being used, not
child elements!
XML
Yangtze.xml
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsr"http//www.geod
esy.org/river" rlength"6300
kilometers" rstartingLocation"wester
n China's Qinghai-Tibet Plateau"
rendingLocation"East China Sea"/gt
The RDF format allows you to use attributes
as well!
RDF
Yangtze.rdf
80
Attributes
  • Recall that at the very beginning of this
    tutorial we said that a resource has properties
    (attributes). Thus, a property can be
    represented either as a child element, or as an
    attribute. (Of course, a property can only be
    represented as an attribute if it has a literal
    value, not a structured value.)

81
Equivalent!
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river"gt ltlengthgt6300
kilometerslt/lengthgt ltstartingLocationgtwestern
China's Qinghai-Tibet Plateault/startingLocationgt
ltendingLocationgtEast China
Sealt/endingLocationgt lt/Rivergt
lt?xml version"1.0"?gt ltRiver rdfID"Yangtze"
xmlnsrdf"http//www.w3.org/1999/02/22-rd
f-syntax-ns" xmlns"http//www.geodes
y.org/river" xmlnsr"http//www.geod
esy.org/river" rlength"6300
kilometers" rstartingLocation"wester
n China's Qinghai-Tibet Plateau"
rendingLocation"East China Sea"/gt
82
Example 13
83
lt?xml version"1.0"?gt ltResume rdfID"JSmith-2003"
xmlnsrdf"http//www.w3.org/1999
/02/22-rdf-syntax-ns"
xmlns"http//www.resume.org"
xmlbase"http//www.jsmith.com/resume"gt
ltaboutgt ltPerson xmlns"http//www.person.
org"gt ltnamegtJohn Smithlt/namegt
ltphonegt555-1212lt/phonegt
ltemailgtabc_at_def.comlt/emailgt lt/Persongt
lt/aboutgt ltexperience rdfparseType"Collectio
n"gt ltJobgt
ltstartDategt1995-01-01lt/startDategt
ltendDategt1999-01-01lt/endDategt
lttitlegtresearcherlt/titlegt
ltemployergt ltCompany
xmlns"http//www.company.org"gt
ltnamegtSome Corplt/namegt
lthomepagegthttp//www.company.orglt/homepagegt
lt/Companygt
lt/employergt ltdescriptiongtCool
stufflt/descriptiongt lt/Jobgt
lt/experiencegt
ltskills rdfparseType"Collection"gt
ltSkillgt ltnamegtOraclelt/namegt
ltyearsExperiencegt13lt/yearsExperien
cegt lt/Skillgt ltSkillgt
ltnamegtJavalt/namegt
ltyearsExperiencegt3 lt/yearsExperiencegt
lt/Skillgt lt/skillsgt lteducation
rdfparseType"Collection"gt ltDegree
xmlns"http//www.schools.com"gt
lttypegtBSlt/typegt
ltschoolgtRPIlt/schoolgt
ltgraduationYeargt1987lt/graduationYeargt
lt/Degreegt lt/educationgt lt/Resumegt
84
Conclusion
  • In this tutorial we demonstrated that, with
    oftentimes slight modifications, "traditional
    XML" documents can be made RDF-compliant.
  • We recommend using the RDF format for all your
    XML documents.
  • We feel that the advantages accrued by formatting
    your XML far outweigh any possible disadvantages
    (having to structure your XML in a specific
    format and having to learn a new vocabulary)

85
Related Articles
"Make Your XML RDF-Friendly" by Bob DuCharme,
John Cowan
http//www.xml.com/pub/a/2002/10/30/rdf-friendly.h
tml
Write a Comment
User Comments (0)
About PowerShow.com