[ 
https://issues.apache.org/jira/browse/JENA-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne updated JENA-1393:
--------------------------------
    Description: 
*Issue*: {{FmtUtils.stringForURI}} does not compact URI with ":" in localname 
as the compacted 
prefixed form gets rejected by {{FmtUtils.validPNameChar(ch)}} function. 
However, 
according to the SPARQL specification ";" is allowed in prefixed form, see:
https://www.w3.org/TR/sparql11-query/#rPN_LOCAL

*Note* it  ":" was not allowed in localname in older versions of the document 
(before 2013):
https://www.w3.org/TR/2012/WD-sparql11-query-20120105/#rPN_LOCAL

*Proposed Fix*: add the following line to FmtUtils.validPNameChar(ch): 
{noformat}
         if ( ch == ':' )    return true ;
{noformat}

*Proposed Test* add to TestFmtUtils: 
{noformat}
    @Test
    public void stringForURI_colonInLocalname_shouldCompact() {
        String uri = aUri + "local:name";
        final String result = FmtUtils.stringForURI(uri, getPrefixMapping());
        assertEquals("zz:local:name", result);
    }
{noformat}

  was:
*Issue*: FmtUtils.stringForURI does not compact URI with ":" in localname as 
the compacted 
prefixed form gets rejected by FtmUtils.validPNameChar(ch) function. However, 
according to the SPARQL specification ";" is allowed in prefixed form, see:
https://www.w3.org/TR/sparql11-query/#rPN_LOCAL

*Note* it  ":" was not allowed in localname in older versions of the document 
(before 2013):
https://www.w3.org/TR/2012/WD-sparql11-query-20120105/#rPN_LOCAL

*Proposed Fix*: add the following line to FmtUtils.validPNameChar(ch): "if ( ch 
== ':' )    return true ;".

*Proposed Test* add to TestFmtUtils: 
    @Test
    public void stringForURI_colonInLocalname_shouldCompact() {
        String uri = aUri + "local:name";
        final String result = FmtUtils.stringForURI(uri, getPrefixMapping());
        assertEquals("zz:local:name", result);
    }


> FmtUtils.stringForURI does not compact URIs with ":" in localname
> -----------------------------------------------------------------
>
>                 Key: JENA-1393
>                 URL: https://issues.apache.org/jira/browse/JENA-1393
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ, Jena
>    Affects Versions: Jena 3.1.1, Jena 3.2.0, Jena 3.3.0, Jena 3.4.0
>            Reporter: Michał Woźniak
>            Priority: Minor
>         Attachments: fix_stringForURI.patch
>
>
> *Issue*: {{FmtUtils.stringForURI}} does not compact URI with ":" in localname 
> as the compacted 
> prefixed form gets rejected by {{FmtUtils.validPNameChar(ch)}} function. 
> However, 
> according to the SPARQL specification ";" is allowed in prefixed form, see:
> https://www.w3.org/TR/sparql11-query/#rPN_LOCAL
> *Note* it  ":" was not allowed in localname in older versions of the document 
> (before 2013):
> https://www.w3.org/TR/2012/WD-sparql11-query-20120105/#rPN_LOCAL
> *Proposed Fix*: add the following line to FmtUtils.validPNameChar(ch): 
> {noformat}
>          if ( ch == ':' )    return true ;
> {noformat}
> *Proposed Test* add to TestFmtUtils: 
> {noformat}
>     @Test
>     public void stringForURI_colonInLocalname_shouldCompact() {
>         String uri = aUri + "local:name";
>         final String result = FmtUtils.stringForURI(uri, getPrefixMapping());
>         assertEquals("zz:local:name", result);
>     }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to