Re: RDF's curious literals

Richard,

I'm still trying to put the larger RDF literal conversation on hold for 
a day or two so I can be productive on other things, but one thing I 
want to clear up, for my benefit as well:

Richard Cyganiak wrote:
>
>
> On 1 Aug 2007, at 18:32, Garret Wilson wrote:
>>   3. Even if we prefer to write 123 and "123", why do we need
>>      rdfs:datatype when we can simply use rdf:type set to xsd:Integer?
>
> Why do you keep railing against rdf:datatype? It is merely an artifact 
> of the RDF/XML syntax. It does not exist in the RDF abstract syntax 
> (which you call the “RDF model”).

What? If that were true, there would be no such things as typed literals 
in the model, because once you suck RDF/XML or N3 into the model and 
then re-serialize it, you'd just have plain literals again. (Sort of 
like "erasure" in Java generics.) And there would be no use for typed 
literals in general, because you couldn't query or otherwise use the 
type information. (You query the model, not the serialization, after all.)

Citing "RDF: Concepts and Abstract Syntax" 
<http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal> , I note 
that, "Typed literals have a lexical form and a datatype URI being an 
RDF URI reference."

So datatypes do make it to the model, although they might not appear as 
normal resource properties (which I don't think I ever claimed, and if I 
did it was without thinking and beside the point). They seem to just be 
values related to the literal, sort of like a resource's URI.

So that means, in an API, if I want to see if an object is a US 
president or an integer, I would have to do the following:

Resource resource=getResourceSomehow();
if(resource instanceof Literal)  //we can't look at the datatype unless 
this is a literal
{
  if(XSD_INTEGER.equals(((Literal)resource).getDataType()))
  {
    //this is an integer
  }
}
else  //if this is not a literal, we can check rdf:type
{
  if(US_PRESIDENT.equals(resource.getProperty(RDF_TYPE)))
  {
    //this is a US president
  }
}

Do you see why I still claim that the RDF abstract syntax is 
inconsistent, which you disputed in a separate email to this thread? Why 
must I use two separate ways to check the types of literal resources and 
non-literal resources?

>
> And we wouldn't want anyone to mix up surface serialization syntax and 
> abstract model in this thread, wouldn't we? ;-)

We wouldn't indeed. ;)

>
> (Just kidding -- I think I understood the point you are trying to make.)

Thanks! It's nice to hear that once in a while. :)

Best,

Garret

P.S. Does this mean I can keep railing against rdf:datatype? ;)

Received on Thursday, 2 August 2007 14:15:03 UTC