Tuesday, May 13, 2008

TreeView for jOWL

There is an update to the jOWL javascript library.
Version 0.2 contains:

  • A TreeView component (see jOWL page for a demo) in jOWL_UI.
  • Numerous code improvements.
Can be downloaded at the google project page for jOWL.

jOWL is a jQuery dependent javascript library that loads and reasons over OWL documents. See also the original Blog post on jOWL.

Tuesday, May 6, 2008

Server-side storage of OWL syntax.

One concern I have with jOWL, a javascript library I am maintaining that parses and reasons with OWL-RDFS documents, is it's scalability.


Scalability is, as we all know, of vital importance in a web setting. A potential drawback of the current jOWL javascript approach is that user is required to download the entire ontology before being able to do anything with it. This might be fine and sensible in the case of small sample ontologies such as the wine ontology (still 79kB) that has been used in previous semantic web demo's at ontology online. Sadly, it doesn't take much imagination to see that it could quickly become gruesome to load when we make things a little more interesting.


So it dawned on me that it would be great to have a more dynamic load mechanism, where you only request or get what you really need. And it just so happens that Ajax (web 2.0 technology), combined with javascript, is perfectly suited for that. So I have been working hard on creating some server side code that is able to respond to Ajax calls and send back pieces of OWL-DL syntax. The image below kind of explains what I wish to achieve.





At the same time I decided to rewrite the database code that allows me to store ontology information, and take a more xml-hybrid like approach. The limitation of the older code I have, is that it attempts to translate every aspect of OWL-RDF into a relational database table format, e.g. concrete row-column values. As I try to put the richer logic of OWL-DL into work, it becomes a real pain & huge overhead in coding to represent all intersections, unions or other advanced constructs in this format. You just can't seem to beat native OWL-XML syntax (Yeay for the OWL people).


The new approach I'm undertaking stores the full OWL syntax directly into the database. The database doesn't store the ontology in one bulky blob, but slices it up into small digestible units, each unit corresponding to one defined ontology object (e.g. an object referenced by a unique rdf:ID).
The only real modification to the native OWL syntax is a slight compression / reduction in verbosity. In addition, to allow (I hope) quick access some indexes are created (terms, etc).


For those interested, the very first results of this labor can be seen at the jOWL server test page I have set up. Be warned, it's primordial, it doesn't come with much explanation. There is also no concrete integration with jOWL just yet, that is for later, I guess I still have a long way to go.


You will be noticing that I'm also sticking to using the wine ontology as a benchmark. Not that I'm such a complete wine devotee (with all these wine related demo's I can see how people might come to think of it like that). But seeing that this ontology was originally used by the W3C to illustrate the different aspects of OWL (cfr. OWL language guide) and consequently, in testing out the syntax, I figured I might as well continue the tradition. Not sure how this will scale under somewhat heavier load, but those are problems for later :).

Thursday, March 6, 2008

Semantics in the wild: new jOWL wine Demo

I've prepared a more ambitious jOWL demo that shows off some of the reasoning capability. For the unacquainted, jOWL is a 'semantic' javascript library, under development by OntologyOnline.org, with the intention to make OWL-RDFS files (see also the previous article on OWL) a little more accessible, and thereby bring web3.0 technology another step closer to the user.

The thing about the demo that cheers up the geek within is: there is absolute no server-side scripting involved and no database access is required, all the reasoning is taken care of by your own computer.
It's a great example on how added semantics might influence your future browsing experience. The visuals don't change (web2.0 got that packed to go for us), but the user experience could. There is suddenly some 'smartness' in browsing, and it is something one might quickly get accustomed to. Like all great technology, you should hardly notice it until it's gone, most of it happens under the hood.

I'm still polishing some of the details, and will continue to do so for quite some time, adding more features as we go, but the code is crossbrowser compatible (tested on Firefox and Internet explorer) and I wanted to share that with you.
Expect more demo's in the future as well.

Comments are possible at our discussion group.

Thursday, January 24, 2008

jOWL, a javascript library for traversing OWL-RDFS documents

I have started working on jOWL, a jQuery plugin for traversing OWL-RDFS documents. The ambitious intention is to deliver a script that smoothes out cross-browser issues between Firefox and Internet explorer when dealing with OWL syntax and at the same time greatly simplifies traversing OWL-RDFS documents. I'm using a mix of Xpath expressions and jQuery functionality to do so.


My main motivitation for writing this library is to see if I would be able to replicate the behaviour of the freebase-dependent wine widget in a manner that doesn't require database or complex server interactions (Imagine!). Just plain old HTML, some javascript and an OWL ontology file.



While it isn't release ready, the results look very promising and there is already quite some functionality to look at. Have a look at the simple Demo.



All it currently takes to deliver similar functionality is the following lines, it should bear no secrets if you are a little familiar with jQuery:



//load the owl file
jOWL.load('wine.xml', startDemo);

function startDemo(owl){
//Creates a panel to display individuals
var individuals = $('#individuals').owl_individuals(owl);

//Creates a panel to display class, child and parent relations
var navbar = $('#navbar').owl_navbar(owl);

//lets this component talk to the individuals panel
navbar.addListener(individuals);

//Creates an autocomplete field, options to refine are possible
var autocomplete = $('#owlauto').owl_autocomplete(owl);

//lets the autocomplete field talk (provide input) to
the other components.
autocomplete.addListener(navbar).addListener(individuals);
}

The plan is to extend this functionality further, while keeping syntax required to interact with the OWL-RDFS document as simple as possible. I intend to update this demo page with more examples and documentation as I progress further with this library. I'm currently testing it with the prototypical wine ontology, but plan to expand the test to other ontologies when the time is ripe.

Thursday, January 3, 2008

Semantic Annotation with RDFa: a simple experiment

This article will demonstrate an application for semantic annotation with RDFa. This is more or less a follow-up to our previous article 'Embedding OWL-RDFS syntax in XHTML with RDFa' If you need additional information on RDFa and semantic annotation: see that article.


Goal


The idea is to enrich the markup of certain sections of a webpage with an annotation, in such a way that computers can recognize it for what it is (semantic annotation, invisible to the user) and do something with it.
In this case, the goal was to return a set of language terms related to an annotation, either direct synonyms, or language terms from parents, or sources or targets of relations. The resulting procedure generates an ontological table of contents for that page focused around the given annotation and renders it directly within the original web page. In particular it adds a JQuery-enabled AJAX-script to the page that retrieves data from the OntologyOnline server and visualizes the results directly within the page you are browsing. It takes the form of an information box containing a clickable, ontological index of related terms occurring in the page plus a description (if present) for the given concept. This box can be dragged across the screen. The script also highlights the terms it found in a manner similar to google-search highlighting. The results can be discarded if no longer needed.






Figure 1: Information box on a semantic annotation, rendered directly within the annotated page.



It requires at least the following components:

  1. A web page containing a semantic RDFa annotation.

  2. The ability of the browser or a browser extension (Firefox - Operator plugin) to pick up the semantic annotation and, if the user desires to do so, trigger an AJAX call (a request for information).

  3. A service to which the AJAX call is directed (OntologyOnline.org service) and returns back useful (ontological) information about the annotated construct.



1. Semantic Annotation: RDFa markup


The idea is to mark up a section of a web page with a reference to an ontological class that describes what that section is about. We do this by using RDFa.
The RDFa markup makes use of the about attribute and the class attribute. This syntax is not entirely optimal as it does not really extract as correct OWL-DL syntax (and the class and about attributes should probably be switched around as well, but that does not visualize well in the plugin).
A combination with the instanceof attribute might be more appropriate (cfr rdfa primer: @instanceof) to declare what kind of ontology concept the given entry is an instance of, but this RDFa attribute is not yet supported by the current release of the Operator Plugin (see below), so for the time being we will have to stick with 'about'.



<div class="owl:Thing"
about="celltypeontology:immature+neutrophil">text section ...</div>


Figure 2: Embedding instance information by using the class & about attributes..


Also mind that it is always a good idea (but in this case not an absolute necessity) to declare the namespaces you used in the document as well:


<div
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:celltypeontology
= "http://ontologyonline.org/visualisation/c/Directory/">...
</div>


Figure 3: Including namespaces.





2. The Operator action script


The firefox extension Operator by Michael Kaply and Elias Torres recognizes RDFa in XHTML pages, and allows users to define custom actions (an Action User script) for these annotations that can be trigerred specifically by the person browsing the page.
We've created an Action User script for the Operator extension to firefox that makes an AJAX call to an ontologyonline JSONP service (see section below). This script can be downloaded at: OntologyOnline.org/scripts/OntologyOnline_Operator.js.

To set up the script:

  1. Get Firefox if you do not have it already.

  2. Install the Operator plugin.

  3. Download the Operator user script to your computer (Right-Click OntologyOnline_Operator.js, select save as).

  4. Browse to the Options section of the operator plugin, select user scripts tab, hit new, and select the script you downloaded above. Close options.

  5. Re-open options, select the actions tab, hit new, and select 'create a topic map - ontology online'. Close options.

  6. Restart the Browser.

  7. Browse to a semantically annotated page, the 'Resources' button should be highlighting, select the resource, and select the 'topic map' action that should be visible.
    Demo Pages:








Figure 4: The topic map action.



3. The Ontology Online service


We've set up a AJAX - JSONP service that returns term information on a semantic annotation, if the concept is known to the Ontology Online semantic database. If you wonder what JSONP is, JSONP is a technique that enables you to perform some AJAX calls (requests for data) cross domain, (e.g. hypothetically any web page can access the data), see Remote JSON for more information.


Some last remarks


In my opinion, this experiment also shows one of the advantages of using RDFa as opposed to using regular microformats. By using RDFa we do not impose content limits or restraints on an annotation, it is possible to use any semantic construct, as long as it is known to a ontology service like the Ontology Online Topicmap service.
The set-up has been kept simple deliberately, improvements can (and may in the future) be made on several accounts, but nevertheless I wanted to share this with you anyway.
Be aware that for large web documents the script may have some more computation work to do. I'm also hoping to come up with some more elaborate use-cases in the distant future.




Comment on this article: Discussion group.













Tuesday, November 27, 2007

Embedding OWL-RDFS syntax in XHTML with RDFa

Short introduction to RDFa, OWL and Microformats


The OWL-language (web ontology language) is a recommendation by the W3C. is a language that allows proper definition and representation of . It is supposed to form the foundation of the next generation of the internet: the semantic web (a.k.a. web3.0). Unfortunately, even though it has been a recommendation since 2004, it has gained very little traction in the online community.
There are several reasons for this, and some of them are discussed in this article.

Microformats are small structural mark-ups of HTML, with a very consistent format. They are somewhat of a web 2 and a half approach, allowing machine readability through consistent structure, but lacking the flexibility to capture more than what is defined in the limited Microformat standard. Microformats have more or less emerged spontaneously. Through their ease of use, Microformats have gained a lot of momentum, but as mentioned, they lack the expressivity required to really push the boundaries of the current internet experience.

This article is about coming up with a solution that reconciles the ease of use of Microformats with the expressivity of a language like OWL.
Some problems hindering OWL adoptation will be highlighted, and a first experiment with the use of RDFa mark-up to embed OWL data directly into an XHTML page will be demonstrated, a solution that can be considered as a step higher than Microformats on the evolutionary ladder of the web.


Terminology frequently used in this article:
Instance

A real world occurrence of a class (a bordeaux wine you just bought in the store).

Class

A unit of meaning (wine as a 'category').

Parent

With meaning a little broader than the given Class (less specific), for example 'Potable (drinkable) Liquid' in the case of wine.

Semantic items

Human and machine understandable content.



OWL-RDFS


There are three sublanguages of OWL, named OWL-Full, OWL-DL and OWL-Lite. Funnily enough, and contrary to what you might think, OWL-Lite is the most strict of the three and hardest to achieve. OWL-Full is the least interesting of the three dialects; it is often gibberish to reasoners (programs that interpret your semantic constructs) because you can intermingle anything with everything. Usually, the goal is to produce OWL-DL syntax at the least.
All OWL syntax examples in this document validate as OWL-Lite, copy-paste the syntax into the OWL Validator to check. For a more complete introduction on OWL, see the W3C OWL language guide.


Why OWL-RDFS has such poor web presence.


There are several reasons why OWL syntax is nowhere to be seen on the web, and some of these problems are as follows:

1. OWL is Verbose

It really is, but, in my opinion, this does not constitute that much of a problem. Verbosity can be good if it improves readability.
See next point for some considerations however.
On verbosity; below is an example of the minimal OWL-DL compatible syntax required to declare one class, with one parent specified, and one outgoing relation, no comments or labels included, and no advanced relating. As you can see in the figure below, that is already quite a mouth full.


<rdf:RDF
xmlns ='http://this.page'
xml:base ='http://this.page'
xmlns:owl ='http://www.w3.org/2002/07/owl#'
xmlns:rdf ='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:rdfs ='http://www.w3.org/2000/01/rdf-schema#'
xmlns:xsd ='http://www.w3.org/2001/XMLSchema#'>
<owl:Ontology rdf:about='http://example.com/dummy_ontology'/>
<owl:Class rdf:ID='id_for_this_class'>
<rdfs:subClassOf>
<owl:Class rdf:about='http://example.com/dummy_parent' />
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty
rdf:about='http://example.com/dummy_property'/>
</owl:onProperty>
<owl:someValuesFrom>
<owl:Class
rdf:about='http://example.com/dummy_target' />
</owl:someValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>


Figure 1: OWL Verbosity: Expressing one class, including one parent and one outgoing relation.


2. OWL is Incomprehensible

Well, not really, there is a lot of logic in OWL. At least computers should have no problem understanding. Honestly!?
But to the average human, it is a bit like learning to read bits and bytes. Part of the reason why Microformats are successfull is that every web designer understands css and html. Before you delve into OWL, you should have a good understanding of RDF, xml Namespaces, URI's, ... and even though all OWL documents are RDF documents, the language is in many ways nothing like RDF. Finally, you also need to become familiar with ontological jargon (classes, instances, subsumption, disjoints, ...) and methodology and how it impacts your ontology. This, in many ways, resembles learning algebra. The methodology is not something people are acustomed to, there is a general 'why bother attitude', but once learned it paves the road to new insights. So there is a bit of a learning curve.


Perhaps the most significant problem however, is that there are multiple ways of expressing one and the same thing. Consider the examples below. For both, ONLY the syntax varies from what is expressed in Figure 1, the content remains the same (mind that this is still about the very simple set-up: one class, one parent and one relation). They both validate as OWL-Lite as well. The bottom example is the one that resembles the most an original RDF graph, but it is also the hardest one to read. It is an important example however, seeing that this is more or less what RDF, extracted from an RDFa-XHTML page looks like (more on that later).



<rdf:RDF
xmlns ='http://this.page'
xml:base ='http://this.page'
xmlns:owl ='http://www.w3.org/2002/07/owl#'
xmlns:rdf ='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:rdfs ='http://www.w3.org/2000/01/rdf-schema#'
xmlns:xsd ='http://www.w3.org/2001/XMLSchema#'>
<owl:Ontology rdf:about='http://example.com/dummy_ontology'/>
<owl:Class rdf:ID='id_for_this_class'>
<rdfs:subClassOf rdf:resource='dummy_parent' />
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource='dummy_property' />
<owl:someValuesFrom rdf:resource='dummy_target' />
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="dummy_parent"/>
<owl:ObjectProperty rdf:about="dummy_property"/>
<owl:Class rdf:about="dummy_target"/>
</rdf:RDF>

<!--
reference to parent & to target: must be declared
in this document as being of the owl:Class type to be
owl-DL compatible.
reference to property: must be declared as being of type
owl:ObjectProperty in this document to be owl-DL compatible.
-->


<rdf:RDF
xmlns ='http://this.page'
xml:base ='http://this.page'
xmlns:owl ='http://www.w3.org/2002/07/owl#'
xmlns:rdf ='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:rdfs ='http://www.w3.org/2000/01/rdf-schema#'
xmlns:xsd ='http://www.w3.org/2001/XMLSchema#'>
<rdf:Description rdf:about="http://example.com/dummy_ontology">
<rdf:type
rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
</rdf:Description>
<rdf:Description rdf:ID="id_for_this_class">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
<rdfs:subClassOf rdf:resource="#dummy_parent" />
<rdfs:subClassOf rdf:resource="#restriction1" />
</rdf:Description>
<rdf:Description rdf:ID="restriction1">
<rdf:type
rdf:resource="http://www.w3.org/2002/07/owl#Restriction"/>
<owl:onProperty rdf:resource='#dummy_property' />
<owl:someValuesFrom rdf:resource='#dummy_target' />
</rdf:Description>
<rdf:Description rdf:ID="dummy_parent">
<rdf:type
rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:ID="dummy_target">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</rdf:Description>
<rdf:Description rdf:ID="dummy_property">
<rdf:type
rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
</rdf:Description>
</rdf:RDF>


Figure 2: OWL variancy: The two examples above only differ syntactically from the OWL expression found in figure 1, the content is the same, and both validate as OWL-Lite as well. Cfr. OWL Validator.


3. No explored approaches to align / integrate OWL with current web content.

In my opinion, this is the biggest roadblock that stands in the way of public OWL-adoptation.
For ontological data to truly be useful, you need to somehow tie current web content with semantic classes and instances. OWL has failed miserably in this respect so far. It is much like a far away island of Eden, and a man without a canoe. All the important data could be there but no-one knows how to reach it. Granted, OWL does define a standard format for data interchange between applications, but this limited scope cannot be what the semantic vision is about.

What we need is semantic annotation. You need to be able to tag sections of your content with explicit ontology classes and even relations, without it hindering the display of your content. If you wrote a piece on a certain bordeaux for example, you could mark up the section as being about an instance of wine, perhaps even with some properties defined (or even more amazing, just by knowing it is about wine properties can be extracted automatically, a mention of red is bound to be about the wine color).

Take a look at our freebase widget for the desired search engine functionality. You should be able to look for wine (example), by specifying color, origin, vintageyear and more. The funtionality present on that page is thanks to the Freebase service.
Freebase (big thumbs up) really understands the need to couple instance data (they call it 'Topics') and content (images, text) to semantic classes ('Type' in freebase lingo).

The amazing observation here is that you would not need a service like freebase to pull out this kind of data if:

  • It where possible to directly associate your content with certain units of meaning (semantic classes), something which is referred to as 'semantic annotation'.

  • Search engines would index these annotations.


To achieve this goal we need several things to happen:

  • The ability to easily reference ontological classes; at the least there should be some highly accessible repository(/-ies) of ontological data to which one can refer. This is part of the rationale behind ontologyonline.org and why it offers one page per semantic class, it can be seen as an ontological tag index.

  • The ability to embed semantic content directly and invisibly within (X)HTML.


This brings us back to the topic of this section: the current divide between semantic data and web content. There is hope on the horizon however, there seem to be possibilities, and I'd like to demonstrate one of them in this article: the use of RDFa.
Roughly said, RDFa is a next-generation Microformat. It is a structured mark-up that allows direct inclusion of RDF into XHTML, and seeing that OWL is more or less an extension to RDF an interesting thought would be to try and use RDFa to embed OWL in a web page.

Integration into XHTML markup: the promise of RDFa


This article does not attempt to provide a full introduction to RDFa, for that: see W3C's RDFa Primer. As mentioned above, the use case for the majority of people would be to mark up content with reference to semantic classes (e.g. tag your content as being an instance of semantic class Y). In this experiment however, we focus on embedding OWL class information and ontology information directly within XHTML. Embedding Instance information (as required for the above) should be easier and may be discussed in a later Online Ontology Visualisation blog entry.


As said before, part of ontology online's design is the offer one page per semantic class. This makes referencing a lot easier, instead of having to usi URI's (like an URL, but may also point to sections of a certain page or a given part of a document), you can just use a page URL to retrieve a reference to an ontological class. As will be demonstrated, it also makes the RDFa approach a lot cleaner. Of note, the mark-up has been simplified a little (information not required for this demonstration has been stripped) for easier reading. The figure below demonstrates how the content that has RDFa embedded looks like visually (the RDFa is completely invisible to the user).



Figure: Visual output of the RDFa-embedded XHTML.



Step 0. Being Standards-compliant


This is the only pain-point of embedding RDFa. If you wish to get your page to validate against the W3C-Validator service then you must set up your page properly. This means that, besides the fact that you better have valid XHTML if you wish to extract the RDFa out of the page, you also need to change the DOCTYPE declaration of the page, and the content-type you serve, plus include any namespaces you are using in your document. Beware that changing the DOCTYPE may influence the display of your page a little (css is more strict) and changing the content type may affect javascript functionality. This may not even be a possibility to you. Fortunately, this is only a long-term goal to strive to, the RDFa will still be extractable even with less properly defined doctype & content-type (hence step 0).



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs ='http://www.w3.org/2000/01/rdf-schema#'
xmlns:dc="http://purl.org/dc/elements/1.1/">
<head>
<meta http-equiv="Content-Type"
content="application/xhtml+xml; charset=UTF-8"/>
...


Figure: Declarations you need if you wish to be Standards-compliant.


You might notice that when you try to run Ontology Online concept pages through the W3C validator still one error persists: 'Conflict between Mime Type and Document Type'. This is because the server does not yet serve the correct content type (it seems to affect javascript functionality and that is something we do not wish to deal with at this point).

Step 1. Declaring the ontology


On any page describing a semantic class (concept page) the ontology is reference by a 'rev' attribute on an anchor element. 'rev' expresses an inverse relationship in RDFa. In this case we say that the ontology (defined at the target of the 'href' attribute) has an owl:Class (designates a class of the ontology) which is described on this page. The mechanism to declare the ontology itself is not discussed in this article, but can be easily seen by examining the source of any of the ontology html pages at ontologyonline.org.


<a rev="owl:Class"
href="http://ontologyonline.org/visualisation/c/CellTypeOntology/">
Cell Type Ontology</a>


Figure: Declaring the ontology on a concept page.


Step 2. Declaring the Class


In RDFa an 'about' attribute is used when talking about something that does not refer to the entire page. Seeing that the resource here is indeed the entire page (the entire page equals the semantic class) we do not use an about 'attribute'. The class is defined simply by adding a class attribute with value owl:Class in the markup. Notice how the markup does not affect the content itself, nor it's display (hint: for those who did not know, it is possible to use multiple classes in html markup, by providing a space-separated list: example class='owl:Class concept blue', css will take into account all of them). The property attribute with value rdfs:label provides a nicer representation name than just 'this page url'. Ideally an xml:lang attribute would be specified as well, denoting that the label is in English for example (xml:lang="en", work in progress).


<h1 class="owl:Class" property="rdfs:label">mature B cell</h1>

Figure: Declaring the semantic class.


The parents are declared on another page, hence a link (anchor element) is used to reference them. By wrapping the anchor element in an additional html element we can specify two relations, firstly that the class expressed on this page has a subclass relationship to something (as expressed by the 'rel' attribute with value 'SubClassOf'). And secondly, that this 'something' is an actual owl:Class, which is very important if we wish to achieve OWL-DL syntax and state that this concerns a parent. We do this by setting the 'rel' attribute on the anchor element to 'owl:Class'. In the figure below two parents are declared:


<div>
<span rel='rdfs:SubclassOf'>
<a rel='owl:Class' href='c/CellTypeOntology/B_cell'>B cell</a>
</span>
<span rel='rdfs:SubclassOf'>
<a rel='owl:Class'
href='c/CellTypeOntology/professional_antigen_presenting_cell'>
professional antigen presenting cell</a>
</span>
</div>

Figure: Declaring Parent(s).


Outgoing relations are specified by taking a similar, yet slightly more complex, approach. The outgoing relation requires a property declaration (type of relation) and a target declaration, another class of the ontology to which the class on this page relates. At this time properties at ontology online do not have their own page just yet, so they are referenced only in text. For the target of a relation a link (anchor element) is used as reference. The top html element with attribute 'rel' and value 'rdfs:SubclassOf' again denotes that the class expressed on this page has another subclass relationship to something. The element underneath it tell us that this subclass relationship is a kind of outgoing relationship (instead of a parent relationship) by having an attribute 'rel' with value 'owl:Restriction'. This element wraps around two elements, one which designates the property (recognized by having the attribute 'property' with value 'owl:onProperty' The second is an anchor element for which the href attribute specifies the target, while the 'rel' attribute 'someValuesFrom' adds some additional logic the relationship (see W3C's OWL language guide for details on someValuesFrom).

Of note, it should be expressed that the property is of the type owl:ObjectProperty and the target is of the type 'owl:Class' to be OWL-DL compliant, again work in progress (still deciding on the most optimal way to convey this...).


<div rel='rdfs:SubclassOf'>
<div rel='owl:Restriction'>
<span property='owl:onProperty'>develops_from</span>
<a rel='owl:someValuesFrom'
href='c/CellTypeOntology/immature_B_cell'>immature B cell</a>
</div>
</div>

Figure: Declaring Outgoing Relations.


Last thing to do is to add a description and perhaps some additional language terms that define the class described on the page. This is done though 'rdfs:comment' and 'rdfs:label' properties (when the target is text on the same page then the attribute 'property' is used in RDfa). Again, it would be better to also append an xml:lang attribute as well specifying the language of the comment or language term.


<div property='rdfs:comment'>"A mature form of a B cell, a type of
lymphocyte whose defining characteristic is the expression of an
immunoglobulin complex." [GOC:add, ISBN:0781735149]</div>
<span property='rdfs:label'>mature B lymphocyte</span>
<span property='rdfs:label'>mature B-cell</span>
<span property='rdfs:label'>mature B-lymphocyte</span>

Figure: Declaring description and additional language terms.



Testing out: Operator Plugin



It is possible to see how the RDFa extract from any of the concept pages looks like by using a browser plugin: The latest version of Mike Kaply's Operator Plugin recognizes RDFa data embedded within XHTML pages.


Browsing any of the Concept pages on OntologyOnline.org should highlight the 'Resources' button, which should show both the ontology to which the concept belongs (if on a concept page) and OWL-syntax like information about the concept itself:

Browsing an Ontology information page (e.g. Cell Type Ontology) should reveal one resource recognized, the ontology itself.



@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://ontologyonline.org/visualisation/c/CellTypeOntology/>
owl:Class
<http://ontologyonline.org/visualisation/c/CellTypeOntology/neutrophilic_promyelocyte>
.

<http://ontologyonline.org/visualisation/c/CellTypeOntology/neutrophilic_promyelocyte>
rdf:type owl:Class ;
rdfs:label "neutrophilic promyelocyte" ;
rdfs:label "neutrophilic premyelocyte" ;
rdfs:label "neutrophilic progranulocyte" ;
rdfs:comment ""A neutrophil precursor in the granulocytic series, being a cell
intermediate in development between a myeloblast and myelocyte, and containing
a few, as yet undifferentiated, cytoplasmic granules."
[GOC:add, ISBN:0721601464]" ;
rdfs:SubclassOf [
owl:Restriction [
owl:onProperty "develops_from" ;
owl:someValuesFrom <c/CellTypeOntology/neutrophilic_myeloblast>
]
] ;
rdfs:SubclassOf [
owl:Class <c/CellTypeOntology/promyelocyte>
] .


Figure: OWL-DL based Syntax extracted from an Ontology Online concept page by the firefox Operator plugin.



Conclusion


To my knowledge, this is a first attempt to finally reconcile OWL-RDFS with standard XHTML web pages.
The extracted RDF (as tested with RDFa Distiller) does not validate as OWL-DL just yet. But this initial venture into OWL-enabled XHTML shows promise. There is room for improvement, so RDF-Guru or not: feedback and suggestions are greatly appreciated.







If you found the content of this article interesting, consider digging it.


Saturday, October 20, 2007

Style and Ajax functionality update.


  • The search and browse sections of the site have been restyled, be sure to check it out (example links: , ATP catabolic process).
  • A new Logo has been put into place.
  • Javascript/ functionality has been upgraded.
  • xHTML markup has been improved, the site is not completely yet (which is hard to achieve for any site using AJAX), but steps have been made in the right direction.


The new style has actually already been in place for more than a week, the reason why this announcement comes with delay is that I experienced some unexpected problems with the Ajax functionality update. The script ran smoothly in Mozilla Firefox, but getting the script to run in Internet Explorer proved to be a debugging nightmare. At first I resorted to write plumbing code to meet crossbrowser inconsistencies, but soon enough I learned a valuable lesson that each Ajax programmer sooner or later learns:


"Rely on a javascript-library / framework instead of writing pathwork code, good frameworks take care of browser incompatibilities in a much more elegant way than one person could possibly implement."

For me, the holy grail has been JQuery. Not only does it smooth out the issues with Internet Explorer, you really can do more yet write less code. The methods I had been trying to implement that met crossbrowser differences or just were generally useful (importnode, clone, remove nodes, get elements by class name, ..) apparently also exist in JQuery, and on top of that their implementation is more elegant and functional than what I ever achieved. So JQuery, I'm officially a fan.



Also discovered another quite funny example of how semantics are missing from search engines (see also the earlier post 'why we need the semantic web'). The sequence Ontology has an entry called ''. One of our ontology widgets pulls images from google to match the concept, but in this case the results are not exactly as expected. Querying a search engine and finding results specifically on 'A Band' as in the 'dark-staining region of a sarcomere' instead of some music-playing people might not be that easy.