[ 
https://issues.apache.org/jira/browse/JENA-1232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15474188#comment-15474188
 ] 

Andy Seaborne commented on JENA-1232:
-------------------------------------

Nodes, unlike the API objects like Literal, don't know what graph they are in 
and can be in several or none.

toString() on a Node could use some standard prefix map for convenience but 
that can get confusing if the URI is (wrongly) {{<xsd:int>}}.

See {{FmtUtils}} for some convenience node->string and also {{NodeFormatter}} 
which under pins the writers.

> Node toString() method doesn't take into account the prefix mapping for 
> literals
> --------------------------------------------------------------------------------
>
>                 Key: JENA-1232
>                 URL: https://issues.apache.org/jira/browse/JENA-1232
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Base
>    Affects Versions: Jena 3.1.0
>            Reporter: Lorenz Bühmann
>            Priority: Trivial
>
> Hi,
> not sure whether this is really a (very minor) bug or just a decision by 
> design, but what I discovered during using the graph layer of Jena was the 
> following:
> The class org.apache.jena.graph.Node provides some toString() methods, among 
> others, one which allows to add a PrefixMapping as argument
> This is then taken into account for rendering the object, e.g. to provide a 
> prefixed form of a URI. But I have recognized now that this doesn't work for 
> literals, e.g.
> "1"^^<http://www.w3.org/2001/XMLSchema#int>
> is never shortened to
> "1"^^xsd:int
> When looking into the code, I saw that in the class  
> org.apache.jena.graph.Node_Literal the prefix mapping is just ignored then 
> [1], probably because it's delegated to a method of the class LiteralLabel 
> which doesn't seem to have any method that uses prefix mappings.
> I know that this basically affects the core API, so probably this wasn't 
> designed for 3rd party use and extensions - in that case, simply close this 
> issue and I will continue with my current workaround.
> [1] 
> https://github.com/apache/jena/blob/master/jena-core/src/main/java/org/apache/jena/graph/Node_Literal.java#L67



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to