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

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

From: Michael Kifer <kifer@cs.sunysb.edu>
Date: Fri, 22 Feb 2008 03:27:25 -0500
To: axel@polleres.net
Cc: "Public-Rif-Wg (E-mail)" <public-rif-wg@w3.org>
Message-ID: <21605.1203668845@cs.sunysb.edu>


> 
> 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.

A constructor should return valid literals. So, it should give an error here.


	--michael  
Received on Friday, 22 February 2008 10:00:46 GMT

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