Category Archives: XSLT

http://www.w3.org/TR/xslt

Label Vocabulary in Spanish

The Label vocabulary now also contains labels in Spanish.

{Leandro Mariano López}, the master behind inkelog and the Speaks, Reads and Writes Schema, stepped up to plate last night and sent me a translation of the terms and comments – thanks!

That of course meant that I had to make it possible to navigate between the different language versions, and tweak the content negotiation a bit.

The owl2html XSLT is now up to version 0.2, and a new small tool has seen the light of day: rdf-path.

It’s a simple Perl script with an XPath interface to an RDF/XML document, with a bunch of prefixes and namespaces predeclared. It’s simple to the point of triviality, but does its job well, in this case extracting a list of available languages for an ontology, to automate the generation of HTML pages:

#!/bin/bash
base=http://purl.org/net/vocab`/bin/pwd|sed -e 's/^.*web//'`/
for lang in `rdf-path "/*/*[rdf:type[@rdf:resource='http://www.w3.org/2002/07/owl#Ontology']]/rdfs:comment/@xml:lang" $1.rdf`; do
  owl2html $1.rdf uri $base$1# lang $lang css "http://www.wasab.dk/morten/2004/06/owl2html.css" > $1.$lang.html 
done

Additional translations are of course more than welcome.

Multi-lingual Literals in RDF

As a non-native english speaker, it’s good to see that both XML and RDF support language “tagging” of literals, to avoid the blind assumption that everything will be in English. Apparantly the concept doesn’t get much use though, I have yet to see any tools that support multiple languages at the application level (with the possible exception of foaf-a-matic, which I translated into Danish, but it doesn’t do it at the vocabulary level).

Since I sometimes do development in Danish, but also want to integrate with the rest of the world, I have begun creating vocabularies with labels in at least Danish and English. I have also set up partial HTML presentation in multiple languages – the syntax parts are completed, and the content negotiation setup should be working: When dereferencing e.g. the namespace URI for the label vocabulary, http://purl.org/net/vocab/2004/03/label, you should get the English HTML version, unless you have your browser set up to accept Danish [da] as I have, in which case you should get the Danish version. If your user agent sends an Accept: header containing application/rdf+xml, you should get the RDF/XML version – even if this method of operation isn’t completely defined, the W3C TAG is working hard on the issue, httpRange-14.

Now, how to decide which literal to use when multiple are present?

Continue reading Multi-lingual Literals in RDF

Transforming RDF/XML with XSLT

A couple of months ago, while working on a project that will hopefully see the light of day soon, I realised I needed terms for singular and plural labels for properties and classes. Even with the help of SchemaWeb I couldn’t find existing terms, so I decided to cook my own, resulting in the label vocabulary with two properties:

plural
A relation between a term and its label in literal plural form.
singular
A relation between a term and its label in literal singular form.

This was not the only vocabulary I was working on at that moment, and I needed to be able to get an overview, a human-readable version. Last year I did the RDFS Explorer for basically the same purpose, but since I was entering OWL territory, it wasn’t really up to the task. Back to square one.

Continue reading Transforming RDF/XML with XSLT