- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
Last week, I talked about the Semantic Web, a version of today's World Wide Web in which data is understandable not just by people, but also by computers. On the Semantic Web, computerised agents -- author David Brin called them "ferrets" -- can go out and find information not just by what's explicit -- the content that's present -- but also the information that's implicit. That implicit data includes not just traditional "metadata", but also information that defines relationships between objects.
That information comes in the form of an "ontology". An ontology defines classes of "things", and their relationships to each other. For example, the XML Reference Guide weblog is a "blog" that has an "author", which has a "name". Next week, we'll look at Web Ontology Language (OWL) -- no, that's not a typo -- but for this week, I wanted to look at actually developing the ontology. Next week we'll take that ontology and encode it in XML using OWL, so we can see an application called a "reasoner" act on it.
Let's start by talking about the overall "domain" of the ontology. That's the general subject matter we're going to define. Last week I talked about movie theaters, and we could certainly go with that, but since I'm not in charge of the web site or any other data for any theater chains, I thought instead I'd talk about creating an ontology the average person could use.
Well, the average blogger, anyway. That's right, this article details the genesis of the Blog Ontology, an ontology that attempts to define the classes and objects involved in a typical blog. Next week we'll encode that ontology using OWL, and finally we'll look at how to use it to mark up the content of a real blog so that a reasoner can understand the content.
Let's start by defining some of the classes we're going to need. As in object oriented programming, an ontology class is a "type" of object, with various properties. Unlike in object oriented programming, however, ontology classes don't define any methods, just properties and relationships with other classes. (Later, when we have all of our classes, we'll create "individuals", which are instances of a class, just as an object is an instance of an object oriented class.)
The simplest look at this ontology shows the Blog
, Entry
,
Author
, Content
, Comment
,
and Trackback
classes, along with their relationships:
The first thing to understand here is that there is really only one "thing" we're
dealing with, and that's the Blog
. (Other ontologies can and do deal with more
than one thing, but we're keeping it simple.) Everything else that you see in this
diagram, from the Author
class to the Trackback
class, is a
property, or a piece of information about something else.
Let's step back and look at that for a moment. The Blog
is written
by a specific person, the Author
. It has a specific set of Entry
s
that define its content. Both of these properties are objects, but there are also
simpler data properties, such as the title or URL for the Blog
. We might
consider looking at the Blog
like this:
The first two properties, isCalled
and hasURI
, are simple string
values, while the third consists of an Author
object, and the fourth
consists of zero or more Entry
objects. These last two, in turn, have
their own properties. In short, the object properties look like this:
The reason for the funny names is that ultimately we're going to use these properties to make assertions about the individual objects we're describing. For example, consider the weblog for this Guide. I could say that:
The XML and Web Services weblog hasAuthor Nicholas Chase.
In some cases, properties are transitive, meaning they can chain. On other words, if A > B and B > C, then A > C. Or in this case:
The XML and Web Services weblog hasContent "Yahoo targets Google Web Services API"
and
"Yahoo targets Google Web Services API" hasContent "Well, it was only matter of time. Yahoo, which lots it's title as the 800 pound gorilla of search to Google some time ago, is trying to get it back..."
So if the hasContent
property is transitive, then we know that:
The XML and Web Services weblog hasContent "Well, it was only matter of time. Yahoo, which lots it's title as the 800 pound gorilla of search to Google some time ago, is trying to get it back..."
Being able to figure out that kind of statement is the point of the exercise.
Now, I mentioned earlier that there are some similarities between modeling an
ontology and modeling an object oriented system, so it should come as no suprise that
ontologies can also have subClasses. For example, while we've been talking about
blogs in general, we might want to define a specific kind of blog, such as a
Journal
, which might be mostly commentary on personal issues, rather
than pointing to other sites. We can then define the Journal
class as
a subClass of Blog
.
Another area in which this might come in handy is in the Entry
class.
Entry
is a pretty generic term. What if I wanted to do a search for
reviews, or technical advice? We can create several different subClasses of Entry
,
including Commentary
, Advice
, and LinkReferral
.
The structure might look something like this:
In this case, Journal
, LinkFest
, and TipSheet
are all subClasses of Blog
, so they have all of the properties of the
parent class. Similarly, News
, Advice
, and LinkReferral
have only the properties defined as part of their parent class, Entry
.
Commentary
, on the other hand, has all of the properties of the Entry
class plus the additional isAbout
property. Review
includes two additional properties.
For now, these are the basic structures we're going to encode in OWL.