Thqt sounds like q
On Mon, Dec 17, 2012 at 10:03 PM, Andy Seaborne <[email protected]> wrote:
> On 17/12/12 11:41, Olivier Rossel wrote:
>>
>> Hello.
>>
>> The SPARQL spec says:
>> "Florence" is not the same RDF literal as "Florence"@fr
>
>
> and it's just repeating RDF.
>
> ...
>
>
>> Now I have to federate-query an italian dataset and the french dbPedia.
>>
>> As seen above, my french dbPedia contains this literal: "Florence"@fr
>> My italian dataset contains this literal: "Florence" (with no lang tag).
>>
>> Here is the federated query:
>> SELECT DISTINCT ?LocalityITA ?LocalityFR WHERE {
>> SERVICE <http://91.121.14.47:6665/sparql/> {
>> ?Address <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>> <http://www.w3.org/2006/vcard/ns#Address> .
>> ?Address <http://www.w3.org/2006/vcard/ns#locality> ?LocalityITA .
>> ?LocalityITA <http://www.w3.org/2000/01/rdf-schema#label> ?LabelITA .
>> }
>> BIND (strbefore(?LabelITA, "(") AS ?Label)
>> SERVICE <http://fr.dbpedia.org/sparql>{
>> ?LocalityFR <http://www.w3.org/2000/01/rdf-schema#label> ?Label
>> }
>> }
>
>
> Reformatted:
>
>
> SELECT DISTINCT ?LocalityITA ?LocalityFR
> WHERE
> { SERVICE <http://91.121.14.47:6665/sparql/>
> { ?Address rdf:type vc:Address .
> ?Address vc:locality ?LocalityITA .
> ?LocalityITA rdfs:label ?LabelITA
> }
> BIND(strbefore(?LabelITA, "(") AS ?Label)
> SERVICE <http://fr.dbpedia.org/sparql>
> { ?LocalityFR rdfs:label ?Label }
> }
>
>
> You can use str() to get just the lexical form:
>
>
>>
>> How can I tune the query so the literal matching works across lang tags?
>> Thanks for your help.
>
>
> You could canonicalise to the simple literal in each SERVICE
>
> SERVICE <....> {
> ....
> ?Address vc:locality ?l .
> BIND(str(?l) AS ?locality)
> }
>
>>
>
> Except fr.dbpedia.org/Virtuoso does not support BIND.
>
> You can get the same effect with a subquery:
>
> SERVICE <....> {
> SELECT (str(?l as ?locality)
> { ...
> ?Address vc:locality ?l .
> }
> }
>
> Now you have ?locality without a language tag and can use it as the
> canonical term (if yoru app thinks that's safe enough).
>
> Andy
>
Ok for the first SERVICE<..> block : str(...) binds a "raw string"
into ?locality.
Now the seconde SERVICE<...> block:
Is a strlang(..., "fr") required to match ?locality against the @fr strings ???
Like this:
SERVICE <myItalianData> {
SELECT (str(?l) as ?locality)
{
?Address vc:locality ?l .
}
}
SERVICE <fr.dbpedia.org> {
SELECT (?LocalityFR)
{
?LocalityFR rdfs:label strlang(?locality,"fr") .
}
}
Or is the ?locality variable bound in a way that says "i am a raw
string, compare me without taking lang-tag into account"?
As usual, thanks for your help, Andy.