You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by claire Qiu <cl...@gmail.com> on 2017/02/16 10:40:14 UTC

LocalName

Hi,

I have a question about striving the local name out of the URI.

SO for example,

the URI I print it out looks like the following:
http://example.com/resource/authors/%28Zhou%29_Bryan_Bai
<http://dblp.l3s.de/d2r/resource/authors/%28Zhou%29_Bryan_Bai>

if I apply:

String localName = resource.getLocalName();

the value of localName is : _Bryan_Bai .
How do I get the value as Zhou_Bryan_Bai

Thanks in Advance!

Re: LocalName

Posted by Andy Seaborne <an...@apache.org>.

On 16/02/17 10:47, Lorenz B. wrote:
> 1. you could use REGEX
> 2. I really suggest to use the rdfs:label (or something similar) if
> exists for the human readable name of a URI

Good suggestions.

>
>> Hi,
>>
>> I have a question about striving the local name out of the URI.
>>
>> SO for example,
>>
>> the URI I print it out looks like the following:
>> http://example.com/resource/authors/%28Zhou%29_Bryan_Bai
>> <http://dblp.l3s.de/d2r/resource/authors/%28Zhou%29_Bryan_Bai>
>>
>> if I apply:
>>
>> String localName = resource.getLocalName();
>>
>> the value of localName is : _Bryan_Bai .
>> How do I get the value as Zhou_Bryan_Bai

A local name follows the rules for XML qnames.

They can not start with a digit.

They can not contain %

so the longest is "_Bryan_Bai"

	Andy

>>
>> Thanks in Advance!
>>

Re: LocalName

Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
1. you could use REGEX
2. I really suggest to use the rdfs:label (or something similar) if
exists for the human readable name of a URI

> Hi,
>
> I have a question about striving the local name out of the URI.
>
> SO for example,
>
> the URI I print it out looks like the following:
> http://example.com/resource/authors/%28Zhou%29_Bryan_Bai
> <http://dblp.l3s.de/d2r/resource/authors/%28Zhou%29_Bryan_Bai>
>
> if I apply:
>
> String localName = resource.getLocalName();
>
> the value of localName is : _Bryan_Bai .
> How do I get the value as Zhou_Bryan_Bai
>
> Thanks in Advance!
>
-- 
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center