W3C home > Mailing lists > Public > public-rif-wg@w3.org > February 2008

ACTION-432: ugly ill-formed literals use case...

From: Axel Polleres <axel.polleres@deri.org>
Date: Thu, 21 Feb 2008 19:04:52 +0100
Message-ID: <47BDBD44.5000008@deri.org>
To: "Public-Rif-Wg (E-mail)" <public-rif-wg@w3.org>

Ok, here another use case where one might get ill-formed literals.

I have some RDF data.

:a :age "old".
:b :age "33".
:c :age "young".
:d :age "88".

and want to write a rule which converts the untyped
literals to xsd:integer typed ones where possible.

Ideally, I would like to have the option to write something in
RIF like:

   ?X[:age->&ex:createTypedLiteral(?Y,"xsd:integer"^^xsd:anyURI)] :-
       ?X[:age->?Y] and &isInteger(?Y).

where ex:createTypedLiteral is a built-in function creating
a typed literal from a string and a datatype IRI and
isInteger is a type checking builtin.

Now if I drop the last condition

   ?X[:age->&ex:createTypedLiteral(?Y,"xsd:integer"^^xsd:anyURI)] :-
       ?X[:age->?Y].

I will get ill-formed literals. :-(

  you might argue, that functions to "construct"
new literals are not so nice, but I think in practical
RDF transformation use cases they are important.
  Well, one could argue also of course that the definition of
ex:createTypedLiteral should be in a way that returns an error
on an ill-formed result... but I don't know whether we can prevent that, 
if we allow built-ins to be extensible.


Axel

-- 
Dr. Axel Polleres
email: axel@polleres.net  url: http://www.polleres.net/

rdfs:Resource owl:differentFrom xsd:anyURI .
Received on Thursday, 21 February 2008 18:05:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 18:33:45 GMT