Database Reference
In-Depth Information
formats, such as Turtle (Terse RDF Triple Language; see Section 5.5.2), for authoring
and data management instead. This will help you concentrate on the knowledge you
are encoding in the graph structure rather than the details of the XML markup tags.
To explain what the different tags are used for, let us look at an example:
1 <?xml version = “1.0” encoding = “UTF-8”?>
2 <rdf:RDF
3 xmlns:rdf = “ http://www.w3.org/1999/02/22-rdf-syntax-ns#”
4 xmlns:mereaMaps = “ http://mereamaps.gov.me/topo/” >
5 <rdf:Description
6 rdf:about = “ http://mereamaps.gov.me/topo/0012” >
7 <rdf:type rdf:resource = “ http://mereamaps.gov.me/topo/Pub”/ >
8 <mereaMaps:has_name>The Isis Tavern</mereaMaps:has_name>
9 <mereaMaps:has_longitude>-1.241712</mereaMaps:has_longitude>
10 </rdf:Description>
11 </rdf:RDF>
Line 1 is just standard XML, saying that the file is in XML format and specifying
the XML version. The tag at line 2 rdf:RDF (which is closed at line 11 using the
standard XML convention of backslash followed by the same tag </rdf:RDF> ) tells
us that this XML document represents an RDF model. In general, the <rdf:RDF>
tag should always be the first or “root” element of your RDF/XML document. On
lines 3 and 4, we specify prefixes for two namespaces: the rdf: prefix, which is used
to represent the RDF namespace, and our example prefix mereaMaps: for Merea
Maps' Topo namespace. From now on in the document, we know that any term
that starts with rdf: is part of the RDF vocabulary (or tag set), and any term that
starts with mereaMaps: is part of the mereaMaps namespace. Line 5 uses a tag from
the RDF vocabulary: rdf:Description ; everything between this and its closing
tag on line 10 is part of this RDF Description. Line 6 rdf:about tells us which
resource the rdf:Description is talking about, in this case, the URI of the Isis
Taver n: http://mereamaps.gov.me/topo/0012 .
Line 7 shows how RDF enables us to give classes their own URIs so that we
can say that the Isis Tavern is a Pub. (You should read the predicate “is a” as “is an
instance of.”) Further in this chapter we talk about how RDFS allows us to specify a
number of these classes, and build up hierarchies, to say for example, that a Pub is a
kind of Topographic Object (where the predicate “is a kind of” is used to denote “is a
member of the class”). But for now, we can just note that the RDF tag rdf:type lets
us specify that the Isis Tavern is of the type (class) Pub.
Finally, lines 8 and 9 specify properties and property values (i.e., predicates and
objects from the original RDF triples) to state the name and longitude of the Isis
Tavern. The URI of the triple's subject—the Isis Tavern—does not need to be repeated
for each statement since it is all enclosed within the rdf:Description tag.
So, this small amount of code is our first RDF/XML document. We now build up a
more complete picture of the RDF/XML syntax by adding in some extra statements.
First, let us go back to the following example in which a triple has a resource URI
Search WWH ::




Custom Search