Referring to Resources by Reference

There's another way to refer to a resource that describes a property: You can give the resource's URI using the rdf:resource attribute. You use this attribute in the property element. Here's an example; in this case, I'm referring to the resource NickC.html to describe the creator of various documents:

Listing ch18_08.rdf
 <?xml version="1.0" ?> <rdf:RDF     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"     xmlns:dc="http://www.purl.org/DC/">     <rdf:Description about="http://www.starpowder.com/mercury.html">         <dc:Title>Mercury</dc:Title>  <dc:Creator rdf:resource="http://www.starpowder.com/NickC.html"/>  </rdf:Description>     <rdf:Description about="http://www.starpowder.com/venus.html">         <dc:Title>Venus</dc:Title>  <dc:Creator rdf:resource="http://www.starpowder.com/NickC.html"/>  </rdf:Description>     <rdf:Description about="http://www.starpowder.com/earth.html">         <dc:Title>Earth</dc:Title>  <dc:Creator rdf:resource="http://www.starpowder.com/NickC.html"/>  </rdf:Description> </rdf:RDF> 

As you can see, using the rdf:resource attribute makes it easy to connect the same property to a number of resources; in this case, I'm giving mercury.html, venus.html, and earth.html the same Creator properties.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net