Wednesday, April 4, 2007

Expressing triples in RDF

In yesterday's post, we discussed assertions composed of "triples". The "triples" that form the basis of RDF statements are: Specified subject then metadata then data.

Example: “Jules Berman” “blood glucose level” “85”

Jules Berman (subject)
blood glucose level (metadata or data describing the data that follows)
85 (the data)

There is a specific syntax for expressing triples in RDF. Let us create an RDF triple whose subject is the jpeg image file specified as:

http://www.gwmoore.org/ldip/ldip2103.jpg (subject)

dc:title (metadata)

and

"Normal Lung" (data)

In RDF syntax:

< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:title > Normal Lung< /dc:title >
< /rdf:Description >

An example of three triples is proper RDF syntax is:

< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:title > Normal Lung< /dc:title >
< /rdf:Description >
< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:creator > Bill Moore< /dc:creator >
< /rdf:Description >
< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:date > 2006-06-28< /dc:date >
< /rdf:Description >

RDF permits you to collapse multiple triples that apply to a single subject. The following RDF:Description statement is equivalent to the three prior triples:

< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:title > Normal Lung< /dc:title >
< dc:creator > Bill Moore< /dc:creator >
< dc:date > 2006-06-28< /dc:date >
< /rdf:Description >

An example of a short but well-formed RDF image specification document is:

< ?xml version="1.0"? >
< rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/" >
< rdf:Description
rdf:about="http://www.gwmoore.org/ldip/ldip2103.jpg" >
< dc:title > Normal Lung< /dc:title >
< dc:creator > Bill Moore< /dc:creator >
< dc:date > 2006-06-28< /dc:date >
< /rdf:Description >
< /rdf:RDF >

The first line tells you that the document is XML. The second line tells you that the XML document is an RDF resource. The third and fourth lines are the namespace documents that are referenced within the document (more about this later). Following that is the RDF statement that we have already seen.

Believe it or not, this is 95% of what you need to know to specify your data with RDF. We will provide use-case examples in future blog posts.

-Jules Berman
Science is not a collection of facts. Science is what facts teach us; what we can learn about our universe, and ourselves, by deductive thinking. From observations of the night sky, made without the aid of telescopes, we can deduce that the universe is expanding, that the universe is not infinitely old, and why black holes exist. Without resorting to experimentation or mathematical analysis, we can deduce that gravity is a curvature in space-time, that the particles that compose light have no mass, that there is a theoretical limit to the number of different elements in the universe, and that the earth is billions of years old. Likewise, simple observations on animals tell us much about the migration of continents, the evolutionary relationships among classes of animals, why the nuclei of cells contain our genetic material, why certain animals are long-lived, why the gestation period of humans is 9 months, and why some diseases are rare and other diseases are common. In “Armchair Science”, the reader is confronted with 129 scientific mysteries, in cosmology, particle physics, chemistry, biology, and medicine. Beginning with simple observations, step-by-step analyses guide the reader toward solutions that are sometimes startling, and always entertaining. “Armchair Science” is written for general readers who are curious about science, and who want to sharpen their deductive skills.