SPARQL Versus Versa

A new working draft of SPARQL has been released.

While there is no doubt that the language is getting better and more polished with each new release of this specification, I am surprised to see that the limitations I had found in rdfDB back in early 2001 when I have tried to use it for XMLfr are still there.

This is an old story that I have presented in Austin at KT 2001 and published as an XML.com article: it can be very interesting to compute the distance between resources and to do so, you need the equivalent of a SQL « group by » clause and the related aggregate functions.

In the case of XMLfr, I rely on this feature to compute the distance between two topics by counting the number of articles in which they appear together. To do so, I use the SQL group by clause with the « count » aggregate function.

The fact that these features were missing in rdfDB has been the reason why I have had to drop rdfDB and RDF altogether and store my triples in a relational database that I query with SQL.

As far as I know, there is only one RDF query language that support these features: 4Suite’s Versa query language.

Versa is so different from SPARQL that these two languages are as difficult to compare as, let’s say the W3C XML Schema’s XML syntax and the RELAX NG’s compact syntax.

Instead of trying to bend the well known SQL syntax to make it work on triples, Versa has defined a totally new language for the purpose of traversing triples data stores.

The result is surprising. You won’t find anything that will remind you of SQL and, to take an example from « Versa by example« , to get a list of people’s first names sorted by their age, you’d write: « sortq(all(), « .-o:age->* », vsort:number) – o:fname -> * »

If you insist and don’t let the first surprise stop you, the second surprise is that this language is working incredibly well. During the (unfortunately too few) opportunities I have had to work with Versa, I have never been blocked by a limit of the language like I had been with rdfDB or would be with SPARQL.

The bad news is that there is only one implementation of Versa (4Suite). This means that you won’t be able to use Versa over Redland or Jena and I wish people implementing RDF databases could consider more closely implementing Versa over their databases!

I also wish the W3C could have taken Versa as the main input for their RDF query language, but this wish doesn’t seem too likely to happen :-( …

Un garage a niveaux

Dialogue entendu en amenant ma voiture à la révision au troisième étage d’un grand concessionnaire parisien :

Technicien : C’est une voiture de société? Je me demande pourquoi on vous a envoyé ici, les voitures de société c’est au deuxième étage!

Client : ???

Technicien : C’est pas grave, je vais voir ce que je peux faire, mais la prochaine fois il faudra que vous preniez rendez-vous avec le deuxième étage.

Technicien (après quelques minutes de pianotage infructueux sur un clavier graisseux) : L’informatique est en panne. Je vais vous enregistrer manuellement mais ça va être plus long.

Technicien : Vous avez quelque chose d’autre à signaler sur votre véhicule?

Client : oui, il y a un petit problème de carrosserie qu’il faudrait régler.

Technicien : Oh là là, il faudrait prendre rendez-vous avec le quatrième, mais je vous prévient, ils sont complètement débordés : ça fait deux jours qu’ils doivent venir voir une <nom-de-monospace/> pour faire un devis et ils n’ont pas encore eu le temps de passer!

Client : Vous allez la garder combien de temps, ma voiture?

Technicien : Je ne sais pas encore. S’il y a un problème à la direction, cela peut prendre quelques jours.

Client : Dans ce cas il me faudrait un véhicule de remplacement.

Technicien : Il faut voir avec le premier.

Client : Non mais ça va pas? Vous croyez que j’ai l’intention de faire le tour des étages? Vous allez prendre votre téléphone et me régler tout cela!

Technicien (après avoir téléphoné au premier étage) : Au premier, ils n’ont plus de véhicules de location.

Client : Je crois que vous n’avez pas bien compris, ce n’est pas un véhicule de location que je veux, mais un véhicule de remplacement! Quand j’ai acheté mon véhicule (au rez-de-chaussée), on m’a promis un véhicule de remplacement en cas d’immobilisation de mon véhicule.

Technicien : Qui est-ce qui vous a promis ça?

Client : Le vendeur.

Technicien : Les vendeurs de voitures, ils promettent toujours n’importe quoi!

Client : Je veux voir le patron!