W3C home > Mailing lists > Public > public-rdf-wg@w3.org > May 2011

Re: Proposal for ISSUE-12, string literals

From: Steve Harris <steve.harris@garlik.com>
Date: Fri, 13 May 2011 22:37:04 +0100
Cc: RDF Working Group WG <public-rdf-wg@w3.org>
Message-Id: <5BD910CF-6ED2-41BB-9D3E-C007F0C8E98B@garlik.com>
To: Alex Hall <alexhall@revelytix.com>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:42 GMT