- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Sat, 14 May 2011 16:44:29 +0100
- To: public-rdf-wg@w3.org
On 13/05/11 22:37, Steve Harris wrote: > 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. Same - the "either-or" pattern is the normal way to process literals. > It /might/ all come out in the wash, but it's going to need some care. > > - Steve > A possible interaction with RDF/XML: ------------------ @prefix : <http://example/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :x :p "foo"@en . :x :q "foo"^^xsd:string . :x :r 1 . ------------------ can be written in RDF/XML as: ------------------ <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE RDF [ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> ]> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://example/" xmlns:xsd="&xsd;"> <rdf:Description rdf:about="http://example/x" xml:lang="en" > <p>foo</p> <q rdf:datatype="&xsd;string">foo</q> <r rdf:datatype="&xsd;integer">1</r> </rdf:Description> </rdf:RDF> ------------------ that is, with the xml:lang not on the literal but further out in the XML because xml:lang propagates inwards. What happens to the xsd:string? Either existing RDf changes or RDF/XML can't write langs on xsd:string? I don't think we can insist the xml:lang has to be directly on the xsd:string element because that's not how XML works (as I understand it). Andy
Received on Saturday, 14 May 2011 15:45:13 UTC