W3C home > Mailing lists > Public > www-rdf-logic@w3.org > November 2001

literals and typing

From: Geoff Chappell <geoff@sover.net>
Date: Tue, 6 Nov 2001 12:15:33 -0500
Message-ID: <009101c166e6$a81cde60$0400a8c0@GSC866>
To: <www-rdf-logic@w3.org>
I've been taking a look at the current MT draft and the proposed changes for datatyping. I've been trying to understand what it might be like to work with from an implementation standpoint. Any MT gurus out there want to take a look at the following dump of my thinking and shoot it full of holes where appropriate?

First, I don't think it presents any great mental hurdle for anyone (including programmers) to understand that the interpretation of a particular literal is dependant upon its context. We all speak languages after all where this is true (the same word often denotes different things with the sense only discernable from context). It's only in the land of the uri that this is in theory not true (by definition). That said, I initially thought it would be painful for a reasoning system used in real world applications not to have local datatyping. After some playing around, I realized that it might very well be painful for a _reasoning system_ but not so much of a problem if _rdf_ didn't.

I'm going to use rdfql below (the sql-like query language used in RDF Gateway). A quick primer: {} surround triples, [] surround uris, single quotes('') surround literals, triple order is PSO.

Today if we:
    insert {[age] [fido] '9'} into xxx
followed by
    select ?a using xxx where {[age] [fido] ?a}
will return a value for ?a of 9, type literal

I would expect that regardless of further datatype information this would always be the response.

But given:
    {[rdfs:range] [age] [xsd:integer]}
    infer {[typedValue] ?l ?v} from {[rdf:type] ?l [xsd:integer]} and ?v=int(?l)

where the function int() would be provided by the reasoning system to convert decimally encoded literals to integers.

I would expect that I could
    select ?v using xxx where {[age] [fido] ?a} and {[typedValue] ?a ?v}
would return a value of ?v of 9, type integer

Probably would be clearer if rdfql had a function definition syntax so we could say
    ?v=typedValue(?l) where {[rdf:type] ?l [xsd:integer]} and ?v=int(?l) 
and so
    select ?v using xxx where {[age] [fido] ?a} and ?v=typedValue(?a)
just to take the conversion from literals to typed values firmly out of the rdf triple space

It seems that it is the job of the reasoning system to actually extract the literal value from the literal (though RDF describes the rules - expressed in type and range relationships - by which this can be done). And it doesn't appear that it would be difficult to implement in practice.

One difficulty might be if you wanted to express in RDF equivalence conditions based upon literals (i.e. two names denote the same person if they are associated with the same email address through property foaf:mbox). But I guess that's just the situation - either RDF has knowledge of builit-in intrinsic datatypes or it doesn't. (and RDF doesn't do equivalence so...)


Geoff Chappell
Received on Tuesday, 6 November 2001 12:19:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 2 March 2016 11:10:37 UTC