virtuoso-opensource
virtuoso-opensource copied to clipboard
datatype of a literal with a language tag
Hi,
the function datatype should return rdf:langString, if the literal has a language tag. However, the following query does not return the expected result:
select ?literal datatype(?literal) as ?type where
{
values ?literal { "simple" "typed"^^xsd:string "lang"@en }
}
+1 @HughWilliams Is this planned to be fixed?
What is the expectation, that datatype of the "lang" literal of the query below, is returned as http://www.w3.org/1999/02/22-rdf-syntax-ns#langString i.e. rdf:langString rather than "NULL" ?
SQL> sparql select ?literal datatype(?literal) as ?type where { values ?literal { "simple" "typed"^^xsd:string "lang"@en } };
literal type
LONG VARCHAR LONG VARCHAR
_______________________________________________________________________________
simple http://www.w3.org/2001/XMLSchema#string
typed http://www.w3.org/2001/XMLSchema#string
lang NULL
3 Rows. -- 5 msec.
SQL>
Yes, exactly.
ok, I have logged this for development to look into and fix ...
@HughWilliams any info on this? The same issue is with literals with no datatype and language tag. Those should be xsd:string according to RDF 1.1 (https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal)
This is still be be looked into by development, I have added the additional information to the internal bug report on this ...
Still an issue, but the behavior also depends on the language tag:
SELECT * WHERE {
VALUES ?v {"" "a" "b" ""@en "a"@en "b"@en ""@de "a"@de "b"@de ""@es "a"@es "b"@es ""@nl "a"@nl "b"@nl }
BIND(lang(?v) AS ?ln)
BIND(datatype(?v) AS ?dt)
BIND(BOUND(LANG(?v)) AS ?lnBound)
BIND(BOUND(datatype(?v)) AS ?dtBound)
}
| v | ln | dt | lnBound | dtBound |
|---|---|---|---|---|
| "" | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "a" | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "b" | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| ""@en | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "a"@en | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "b"@en | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| ""@de | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "a"@de | de | 1 | 0 | |
| "b"@de | de | 1 | 0 | |
| ""@es | es | 1 | 0 | |
| "a"@es | es | 1 | 0 | |
| "b"@es | es | 1 | 0 | |
| ""@nl | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "a"@nl | http://www.w3.org/2001/XMLSchema#string | 1 | 1 | |
| "b"@nl | http://www.w3.org/2001/XMLSchema#string | 1 | 1 |
What is wrong:
- different behavior for different language tags (e.g.
"a"@envs."a"@de) - different behavior for different lexicals (e.g.
""@devs."a"@de) lnBound= 1 butlnis empty, even if no lang tag was defined- no/wrong datatype (expected
rdf:langString) for literals with lang tag
I think, #946 is related to this.
Thanks for the extra detail, @jmkeil. I've connected this with our internal tracker for this issue, bug#17168.
Experiencing the same issue regarding literals with language tag, datatype(?literal) is NULL instead of rdf:langString. Please, note that this issue is not among the test cases listed in #946 by @jakubklimek