[
https://issues.apache.org/jira/browse/JENA-1196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15333731#comment-15333731
]
Andy Seaborne edited comment on JENA-1196 at 6/17/16 7:32 AM:
--------------------------------------------------------------
Why is "London" not the right answer? (Knowing what you expect and the use case
for it would be helpful) If you want to split on a fixed string, then that is
possible with Java e.g.
{{String ln = s.startsWith(NS) ? s.substring(NS.length(), s.length()) : s ;}}
A couple of points:
* the local name is rarely a good substitute for {{rdfs:label}} or
{{skos:prefLabel}}/{{skos:altLabel}}
* the contract for {{getLocalName}} is a name usable everywhere - and that
includes XML qnames which are quite restrictive.
See {{SplitIRI}} which has policies for Turtle.
was (Author: andy.seaborne):
Why is "London" not the right answer? (Knowing what you expect and the use case
for it would be helpful) If you want to split on a fixed string, then that is
possible with Java e.g.
{{String ln = s.startsWith(NS) ? s.substring(NS.length(), s.length()) : s ;}}
A couple of points:
* the local name is rarely a good substitute for {{rdfs:label}} or
{{skos:prefLabel}}/{{skos:altLabel}}
* the contract for {{getLocalName}} is a name usable everywhere - and that
includes XML qnames which are quite restrictive.
See {{SplitIRI}} which has polices for Turtle.
> jena.graph.Node.getLocalName() bad output
> -----------------------------------------
>
> Key: JENA-1196
> URL: https://issues.apache.org/jira/browse/JENA-1196
> Project: Apache Jena
> Issue Type: Bug
> Components: Jena
> Affects Versions: Jena 3.0.1
> Environment: Ubuntu 14.04 LTS
> Reporter: Jacques Fize
> Labels: method, patch, triple
> Fix For: Jena 3.1.1
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> Hi,
> I'm currently using Jena to extract data from DBpedia dumps. In my process, i
> need to extract the URI of a DBpedia resource URL. I'm using a
> *Triple*(jena.graph.Triple) to fetch the data. But when i use the
> _Node.getLocalName()_ on an URL like
> http://dbpedia.org/resource/World_War_II/London I get *London* which is false.
> To avoid this issue, I propose to implement a new method :
> *String* _Node.getLocalName_(*String* namespace)
> It allows the user to specify the namespace to have a better extraction of
> the URI. If such a method exists already, I'm interested in knowing its name.
> Hope it helps.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)