Re: SPARQL question: get distinct list of datatypes used for literals

----- "Lee Feigenbaum" <lee@thefigtrees.net> wrote:

> From: "Lee Feigenbaum" <lee@thefigtrees.net>
> To: al@jku.at
> Cc: "Semantic Web" <semantic-web@w3.org>, public-rdf-dawg-comments@w3.org
> Sent: Friday, 22 August, 2008 3:25:47 AM GMT +10:00 Brisbane
> Subject: Re: SPARQL question: get distinct list of datatypes used for literals
>
> Andreas Langegger wrote:
> 
> > Hi there,
> > 
> > maybe sb can tell me if this is still possible: I'd like to fetch
> all 
> > datatype URIs used for object literals in a dataset. There is the 
> > dataset predicate which can be used in filter expressions to filter
> 
> > literals to a known datatype like xsd:string: FILTER(datatype(?val)
> = 
> > xsd:string).
> > 
> > But can I bind the value to a variable somehow? With a filter it
> can't 
> > work (consider FILTER(datatype(?val) = ?dt) where ?val is bound to 
> > literal values and ?dt should give me the type). I could use
> property 
> > functions, but I'd like to stay with SPARQL specs. Maybe there is a
> way 
> > to do it I just can't see...
> > 
> > thanks,
> > AndyL
> 
> AndyL,
> 
> There's no way to do this (select functions of values from a 
> graph/dataset) in the SPARQL specification.
> 
> As you said, various implementations provide extensions that will do 
> this. Please see:
> 
> http://esw.w3.org/topic/SPARQL/Extensions/Selecting_Expressions
> 

It seems like something you should be able to do in basic SPARQL, especially if you are only going to bind ?dt into a CONSTRUCT'ed new graph, and not utilise it further in the WHERE portion. Having said that, once you have the ability to reference the datatype (or similarly the language) is it worth making a distinction saying you couldn't use it outside the FILTER but still inside the WHERE portion. If someone has another graph in their RDF database specifically designed to give more information about particular uses of literal datatypes then they should be able to link to it.

Cheers,

Peter

Received on Thursday, 21 August 2008 22:05:40 UTC