XML RDF
RDF RDF (Resource Description Framework) -. XML , (specifies data) (China's Yangtze river):
XML RDF
RDF
RDF (2)
RDF
value value ...
RDF : , XML RDF ?": : RDF , XML (): , (), .RDF () ... () .RDF XML . RDF (regular), (recurring) . XML , RDF (non-RDF-compliant XML designs). ! : XML , XML . RDF (inferencing) .
RDF Semantic Web!
RDF : RDF , XML (, XML ).RDF (), . (namespaces). XML : RDF RDF.
, RDF () . RDF , ,
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
. .
rdf:ID rdf:ID URI". URI" URL XML "#, rdf:ID, ,
xml:base , URL URI . : URL . URI , :
rdf:about URI ( URI), . , rdf:ID, rdf:about:
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
= (--)
RDF = ! RDF XML (resource/property/value)! (, length 6300 .). , , (, -A Resource-B, -B Resource-C). , .
Value-C
-A -BNotice that the RDF design pattern is analternating sequence of resource-property.
This pattern is known as "striping".
(class) (property). (striping pattern).
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
RDF ():
rdf:Description + rdf:type XML. , - , , (class) :
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
: (Description) http://www.china.org/geography/rivers#Yangtze. ()River. http://www.china.org/geography/rivers#Yangtze (length) 6300 kilometers, startingLocation - western China's Qinghai-Tibet Plateau, endingLocation - East China Sea.": . , . RDF , .
rdf:ID, rdf:about, :
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
!
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
: RDF .
RDF
RDF : (Subject) , . (Predicate) , (). (Object) , ().
RDF (Parser) RDF web- W3C:http://www.w3.org/RDF/Validator/This RDF parser will tell you if your XMLis in the proper RDF format.
#2
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea The Three Gorges Dam 1.5 miles 610 feet $30 billion
Yangtze2.xml XML , , RDF:
()RiverDam: Yangtze:lengthstartingLocationendingLocation: ThreeGorges:namewidthheightcost
Dam
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea The Three Gorges Dam 1.5 miles 610 feet $30 billion
Dam () . River, - length, startingLocation endingLocation. , River - Dam. . RDF . ( , RDF XML .)
6300 kilometersValue is a Literal The Three Gorges Dam 1.5 miles 610 feet $30 billion
XML ( RDF)
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea The Three Gorges Dam 1.5 miles 610 feet $30 billion
Yangtze2,v2.xml (river) Yangtze (obstacle), (Dam) ThreeGorges. (Dam) (name) - The Three Gorges Dam. 1.5 miles, 610 feet $30 billion."
RDF
RDF ()
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
Three-Gorges-Dam.rdf , - , Three Gorges Dam:Yangtze.rdf Three Gorges Dam rdf:resource, :
: ,
, , - , ,http://www.china.org/geography/rivers#Yangtze, RDF , . (aggregator tool) . !
rdf:ID rdf:about ? rdf:ID? rdf:about?When you want to introduce a resource, and provide an initial set of information about a resource use rdf:IDWhen you want to extend the information about a resource use rdf:aboutThe RDF philosophy is akin to the Web philosophy. That is, anyone, anywhere, anytime can provide information about a resource.
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
http://www.china.org/geography/rivers/yangtze.rdf
Dri Chu - Female Yak River Tongtian He, Travelling-Through-the-Heavens River Jinsha Jiang, River of Golden Sand
http://www.encyclopedia.org/yangtze-alternate-names.rdf
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea Dri Chu - Female Yak River Tongtian He, Travelling-Through-the-Heavens River Jinsha Jiang, River of Golden Sand
Aggregated Data! (aggregator tool) YangtzeA distributed network of data!
The Three Gorges Dam 1.5 miles 610 feet $30 billion
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
http://www.china.org/geography/rivers/yangtze.rdfhttp://www.encyclopedia.org/three-gorges-dam.rdf
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea The Three Gorges Dam 1.5 miles 610 feet $30 billion
Aggregate!, ThreeGorges Dam , !
#3
Yangtze 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
, XML :Yangtze3.xmlXML
Yangtze 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
Yangtze3.rdfRDF RDF XML !
RDF
Yangtze 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
Yangtze3.rdfThis is read as: "This is an instance of the River type (class). The River has aname of Yangtze, a length of 6300 kilometers, a startingLocation of western China's Qinghai-Tibet Plateau, and an endingLocation of the East China Sea." .
Yangtze 6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
http://www.china.org/geography/rivers/yangtze.rdf
Yangtze Dri Chu - Female Yak River Tongtian He, Travelling-Through-the-Heavens River Jinsha Jiang, River of Golden Sand
http://www.encyclopedia.org/yangtze-alternate-names.rdfAn aggregator tool will not be able to determine if these documents are talking about the same resource.Aggregate
#4Yangtze4.xmlYangtze4.rdf
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
RDF
6300 western China's Qinghai-Tibet Plateau East China Sea
Yangtze4.xmlRDF does not allow attributes on the properties (except for special RDF attributes such as rdf:resource). So we need to make the uom:units attribute a child element.Your first instinct might be to modify length to have two child elements:
rdf:valuelength6300kilometerslength has two values - 6300 and kilometers.RDF provides a special property, rdf:value, tobe used for specifying the "primary" value.In this example, 6300 is the primary value, andkilometers is a value which provides additionalinformation about the primary value.
RDF
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
Yangtze4.rdfAn anonymousresourceRead this as: "The Yangtze River has a length whose value is a resourcewhich has a value of 6300 and whose units is kilometers.
RDF An anonymous resource (also called a "blank node"). That is, a resource with no identifier. (Note: RDF Parsers will typicallygenerate a unique identifier for anonymous resources, todistinguish one anonymous resource from another.)Legend:
rdf:parseType="Resource"
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
Yangtze4,v2.rdfIf 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 rdf:Description element, by using rdf:parseType="Resource", as shown here:The meaning of this is identical to that shown on the previous slide.
!
6300 kilometers
6300 kilometers
XML , (valid) RDF :
6300 western China's Qinghai-Tibet Plateau East China Sea The Three Gorges Dam 1.5 miles 610 feet $30 billion
Yangtze.xml -->
RDF !
RDF
#5
6300 kilometers 175 meters 55 kilometers
Yangtze5.rdfThis is one way of doing it.Now we will see a betterway - using "typed literals".(See next slide)
RDF
6300 175 55
Yangtze5.rdfWith rdf:datatype you can give a property's value a datatype label. Therdf:datatype 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.
(datatypes) kilometer meter XML Schemas
uom.xsd
rdf:datatype
30
In this example we are specifying that the value (30) of age is a nonNegativeInteger (which is defined in the XML Schema namespace).
#6
-2 degrees Celsius 30.4 (rising) USA Massachusetts Boston January 22, 2003, 11:15 EST
WMUR_TV_WeatherReading.xml XML , , (valid) RDF :
1. XML ():2. 3 . , . ? - , . - Boston. Location.
1:
-2 degrees Celsius 30.4 (rising) USA Massachusetts Boston January 22, 2003, 11:15 EST
WMUR_TV_WeatherReading,v2.xml
2: Weather LocationTypes (classes) contain properties. We need to wrap the Weather and Locationtypes within a property:
-2 degrees Celsius 30.4 (rising) USA Massachusetts Boston January 22, 2003, 11:15 EST
WMUR_TV_WeatherReading,v3.xml
RDF !
-2 degrees Celsius 30.4 (rising) USA Massachusetts Boston January 22, 2003, 11:15 EST
WMUR_TV_WeatherReading.rdf
() rdf:BagThe rdf:Bag type is used to represent an unordered collection.
#7
John Smith Sally Jones
XML , , (valid) RDF :DesignMeeting.xmlrdf:Bag makes it clear that this is an unorderedcollection of names.
John Smith Sally Jones
DesignMeeting.rdf
() rdf:Alt rdf:Alt .
#8
() rdf:SeqThe rdf:Seq type is used to represent a sequence of properties.
#9
rdf:li rdf:li ("list item") RDF rdf:Bag, rdf:Alt rdf:Seq.The rdf:li property is provided for you to specify an item in a Bag/Alt/Seq.An RDF Parser will replace each rdf:li with rdf:_1, rdf:_2, rdf:_3, etc.The following slide recasts the previous examples using the rdf:li property.
Meet with CEO at 10am Luncheon at The Eatery Flight at 3pm
MyDaysActivities.rdf
http://www.bn.com http://www.barnesandnoble.com
BarnesAndNoble.rdf
John Smith Sally Jones
DesignMeeting.rdf
#10 XML , , (valid) RDF :
Lateral Thinking Edward de Bono 1973 0-06-099325-2 Harper & Row Illusions: The Adventures of a Reluctant Messiah Richard Bach 1977 0-440-34319-4 Dell Publishing Co. The First and Last Freedom J. Krishnamurti 1954 0-06-064831-7 Harper & Row
Barnes_and_Noble _BookCatalogue.xmlNote: regrettably,the Dublin Core doesnot conform to theRDF naming conventions. Hence,you see propertieswith the first lettercapitalized.
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).
1:
Lateral Thinking Edward de Bono 1973 Harper & Row Illusions: The Adventures of a Reluctant Messiah Richard Bach 1977 Dell Publishing Co. The First and Last Freedom J. Krishnamurti 1954 Harper & Row
Barnes_and_Noble _BookCatalogue,v2.xmlNotice that the ISBN elements were deleted and their values used as identifiers.Why was an underscoreplaced in front of theISBN?Answer: The ID datatypedoes not allow an identifier to begin witha digit. So, we (arbitrarily) decided touse an underscore.
2: BookBarnes_and_Noble _BookCatalogue,v3.xml
RDF !
Dublin Core (dc:)Dublin Core :Note: many people use these properties in their HTML today. For example:
rdf:parseType="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.
Lateral Thinking Edward de Bono 1973 Harper & Row Illusions: The Adventures of a Reluctant Messiah Richard Bach 1977 Dell Publishing Co. ...
Barnes_and_Noble_BookCatalogue.rdf
#11
rdf:parseType="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 structuringExample: with mixed contentIn those cases we can simply indicate "hey, the content of this property is okay. Treat it as a literal XML string."
Dangers of rdf:parseType="Literal"The advantage of structuring your XML as resource/property/value triples is enhanced interoperability.When you use rdf:parseType="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 rdf:parseType="Literal" sparingly!
#12
XMLRDFYangtze.xmlYangtze.rdf XML , , (valid) RDF :Note that attributes arebeing used, not childelements!The RDF format allowsyou to use attributes aswell!
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.)
Equivalent!
6300 kilometers western China's Qinghai-Tibet Plateau East China Sea
#13
John Smith 555-1212 [email protected] 1995-01-01 1999-01-01 researcher Some Corp http://www.company.org Cool stuff
Oracle 13 Java 3 BS RPI 1987
, , XML" RDF. RDF XML . XML RDF ( XML ).
http://www.xml.com/pub/a/2002/10/30/rdf-friendly.html"Make Your XML RDF-Friendly" by Bob DuCharme, John Cowan
Identifies the type (class) of the resource being described.
resource/property/valueAnyone, Anywhere, Anytime Can Talk About a Resource