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

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 UTC