- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Fri, 22 Aug 2008 13:08:35 +0000
- To: "al@jku.at" <al@jku.at>, Lee Feigenbaum <lee@thefigtrees.net>
- CC: Semantic Web <semantic-web@w3.org>, "public-rdf-dawg-comments@w3.org" <public-rdf-dawg-comments@w3.org>
> -----Original Message----- > From: public-rdf-dawg-comments-request@w3.org [mailto:public-rdf-dawg- > comments-request@w3.org] On Behalf Of Andreas Langegger > Sent: 22 August 2008 12:08 > To: Lee Feigenbaum > Cc: Semantic Web; public-rdf-dawg-comments@w3.org > Subject: Re: SPARQL question: get distinct list of datatypes used for > literals > > > hi, > > Peter said: > > 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 > > > Could you give me an example how you would do this? The basis for > constructed graphs is still the result of an ordinary select, where do > I get the datatype from? I could fetch it afterwards when getting the > results, but what I want is a distinct list of data types used, not > all the values (because of performance, transferring as few results as > possible). > > Lee said: > > Offhand, I don't know of any SPARQL implementations that do this: at > > the same time, I don't know of any that don't, other than my own :-D > > SELECT ?dt { > > :s :p ?val . > > ?dt a rdfs:Datatype . > > FILTER (datatype(?val) = ?dt) . > > } > > > Andy, would this work with ARQ, if the model in the dataset uses a D- > entailment capable reasoner? That depends on the reasoned - if it creates the triple ?dt a rdfs:Datatype then yes. But that is not directly in the D-entailment rules set as far as I can see. Pragmatically, this would also work: SELECT ?dt { :s :p ?val . GRAPH <mydatatypes.rdf> { ?dt a rdfs:Datatype . } FILTER (datatype(?val) = ?dt) . } But it means you have to have a graph of potential datatypes (and in the federated case, may end up testing each). That graph could be local. AndyS > At least it would require me to have > control over the endpoint, which I don't have in general. > > Because in my scenario most of the end-points use D2R-server, which > uses ARQ, I'll try with ARQ select expressions (thanks Lee for the > link!) and fallback to ordinary (and more expensive) fetching-all- > values-queries if an Exception occured. It's better than nothing. > > > Thanks, > Andy > > On Aug 21, 2008, at 7:25 PM, Lee Feigenbaum wrote: > > > 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 > > > > Lee > > > >> Web of Data Practitioners Days / Oct 22-23 / Vienna > >> http://www.webofdata.info > >> ---------------------------------------------------------------------- > >> Dipl.-Ing.(FH) Andreas Langegger > >> Institute for Applied Knowledge Processing > >> Johannes Kepler University Linz > >> A-4040 Linz, Altenberger Straße 69 > >> http://www.langegger.at > > > > Web of Data Practitioners Days / Oct 22-23 / Vienna > http://www.webofdata.info > ---------------------------------------------------------------------- > Dipl.-Ing.(FH) Andreas Langegger > Institute for Applied Knowledge Processing > Johannes Kepler University Linz > A-4040 Linz, Altenberger Straße 69 > http://www.langegger.at > > > >
Received on Friday, 22 August 2008 13:10:20 UTC