I suspect that the afn:localname is implementing the same algorithm as
Jena's Resource#getLocalname.
That is used to split a URI into a namespace/localname such that the
localname can legally be used in e.g. RDF/XML serialization. That means
it has to be a legal NCNAME which means it can't start with a number. So
the localname is the longest tail of the URI which is a legal NCNAME, in
this case "eja".
Given how little people seem to care about RDF/XML these days and that
the updated Turtle spec allows numbers in localnames then a more
heuristic sort of localname would be to split at the last / or #, which
you can do with a regex.
Dave
On 07/05/14 19:36, Tim Harsch wrote:
Why does this query:
PREFIX afn:<http://jena.hpl.hp.com/ARQ/function#>
SELECT ?s2
WHERE
{
BIND(<http://example.org/book/book2/sadfju/62eja> AS ?uri)
BIND( afn:localname(?uri) AS ?s2 )
}
give this answer:
---------
| s2 |
=========
| "eja" |
---------
shouldn't it be: "62eja" ?
The docs only say this about afn:localname "The local name of ?x if a
IRI. Based on splitting the IRI, not on any prefixes in the query or
dataset."
Thanks,
Tim