Re: Proposal for ISSUE-12, string literals

On 2011-05-13, at 19:20, Alex Hall wrote:
...
> 3. There are probably countless instances of the following logic deployed in existing systems (I cut-and-pasted this directly from my own code):
> 
> public Literal(String lexicalValue, String language, URI datatype) {
>   ...
>   if (language != null && datatype != null) {
>     throw new IllegalArgumentException("An RDF literal may not have both a language and a datatype.");
>   }
>   ...
> }
> 
> I'm willing to change my code, but I can't speak for everybody...

More concerning is code like:

Literal(String lexicalValue, Resource lang_or_dt)
{
	if (typeof(lang_or_dt) == Literal) {
		/* it has a language tag */
	} else if (typeof(lang_or_dt) == URI) {
		/* it has a datatype */ 
	} else {
		/* it has neither */
	}
}

We have a lot of such code.

It /might/ all come out in the wash, but it's going to need some care.

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Friday, 13 May 2011 21:37:34 UTC