Re: afn:localname strange result

2014-05-16 Thread Tim Harsch
Hi Andy, Yeah, that's pretty close. I originally posted this thread, cause I found myself looking at http://answers.semanticweb.com/questions/10457/calculating-and-extracting-a-substring-in-sparqlagain. All the answers there were close, but just slightly off. I've posted what I now think is the

Re: afn:localname strange result

2014-05-16 Thread Dave Reynolds
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

Re: afn:localname strange result

2014-05-14 Thread Andy Seaborne
A form of localname can be done in SPARQL without the need for extension functions: REPLACE(str(?uri), '^.*(#|/)', '') which returns the part after the last / or # Andy

Re: afn:localname strange result

2014-05-13 Thread Tim Harsch
makes sense now. Can I suggest making this small change to the docs ( http://jena.apache.org/documentation/query/library-function.html), for future travelers: The local name of ?x if a IRI. Based on splitting the IRI, not on any prefixes in the query or dataset, in order to achieve the longest

Re: afn:localname strange result

2014-05-11 Thread Andy Seaborne
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 | -