RDF/OWL == XML/XSLT, part 2
Sometimes, when I’m working with XML I need to change vocabularies. That’s why we invented XSLT, so that I can take XML in one flavor, modify it a bit, and get out some other flavor. Probably the most common transformation is {your favourite XML variant} to XHTML.
When we’re doing transforms, what we’re really doing is exploring the relationships between chunks of XML, mostly with XPath. So we discover that “relatives/uncle” in my example is the same as “relation[type=’uncle’]” in your example, and we write some transforms to convert back and forth.
XSLT lets me take the things you write in XML and turn it into XML that I understand. So instead of rewriting my program to recognize “foaf:name”, I can write an XSLT filter that turns it into “person/name”. I can do lots of other things with it, but that’s the core use case.
OWL lets me do the same thing on an RDF level. In other words, take some XML you understand and map it to some XML I understand.
So this is a description block that should be added to the XML that describes the name element in the FOAF schema. And instead of manually mapping it to an element that we understand, we are telling the OWL processor to do the mapping for us. It’s the same thing, but at a higher level.
With XSLT, we stop talking about the data contained in an XML document and start talking about the elements and attributes that make it up. Often we look at the data in an XPath to figure out what to do, but mostly we move it around between elements.
OWL also concentrates on the elements and attributes that make up a document. Instead of using XPaths to pick out nodes, we put nodes into categories.
is conceptually the same as:
It looks a little more complicated in OWL because everything needs an ID, even your elements and attributes. In a lot of cases you’d already have some sort of XML-based schema somewhere defining your terms.
But if we’re composing XML from blocks scattered around in multiple documents, OWL shines, because XSLT is miserable at it.
Imagine the following:
Pointing our transform at either of these documents is not going to produce results, because the color attribute is not actually defined on the wine element. OWL, however, builds on the distributed nature of RDF and can easily output the WhiteWine element.
I know I’ve left a lot out, but hopefully this will help someone else start grokking the Semantic Web.