Hi,
I had a long and complicated question, but in the process of writing it up 
I have found the answer completely on my own.
Rather than throwing the text away, I thought why not share it. It is about 
the behaviour of complex datatypes in SPARQL.
Sorry for the spam...

For a project, we intend to use a small subset of information contained in 
the so-called Authority Tables of the Publication Office of the EU.
In this context, we want to copy into a local graph some triples concerning 
certain instances of skos:Concept.
For example, the triple that describes the concept that stands for French 
and one of its notations, as in [1].
In the process, we want to get rid of the datatype URI, with the result in 
[2].

The argumentation supporting this move is that we do not need the 
information about the particular coding scheme. And if we need it in the 
future, we are better of using the more verbose but less obscure form in 
[3], from the same original source (AT).

To further strengthen the argumentation, one can say that querying for 
concepts based on a string matching a notation is made impossibly 
complicated using custom datatypes as in [1]. A "simple literal" (i.e. a 
plain literal without language tag) does not match the typed datatype 
string in [1]. Only one with the same datatype URI does. Moreover, you 
can't cast a simple literal to a complex one, at least not without 
extending the SPARQL-engine (see paragraph 17.1 in the SPARQL 1.1 reference)
.

To back this up, I ran the three variants of the query in [4] against the 
data in [1] (or rather the original AT-graph describing 7K+ of languages).

The variant with binding #1 results in exactly one match, as expected.
The variant with binding #2 results in zero matches, again as expected.
The variant with binding #3 results in 17K matches, one for each pairing of 
a concept and an associated notation. 

The latter result was mildly surprising, as I would have expected no 
results at all. But then it occurred to me that you could expect an error 
to be thrown.

And indeed, when I looked into the Error Log-tab, I found the warning in 
[5]. The warning apparently leaves the variable ?n unbound, which explains 
the query result.

The only remaining question is why a warning is thrown and not an error, 
but I guess that should be explainable from the spec.
 
Thanks for being there, -j





[1]
language:FRA skos:notation "fre"^^euvoc:ISO_639_2B .

[2]
language:FRA skos:notation "fre" .

[3]
language:FRA euvoc:xlNotation [
      rdf:type euvoc:XlNotation ;
      dct:type 
<http://publications.europa.eu/resource/authority/notation-type/ISO_639_2B> 
;
      rdf:value "fre" ;
    ] .
[4]
SELECT *
WHERE {
#1 BIND ( "fre"^^euvoc:ISO_639_2B AS ?n )
#2 BIND ( "fre" AS ?n )
#3 BIND ( euvoc:ISO_639_2B("fre") AS ?n )
 ?c a skos:Concept .
 ?c skos:notation ?n .
}

[5]
 WARN [Thread-63] (E_Function.java:105) - URI 
<http://publications.europa.eu/ontology/euvoc#ISO_639_2B> has no registered 
function factory

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/cbacd974-020d-4720-9585-806c1e320143%40googlegroups.com.

Reply via email to