You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/11/05 14:28:00 UTC

[jira] [Commented] (JENA-2189) some XPath registry and function names are wrong

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

ASF subversion and git services commented on JENA-2189:
-------------------------------------------------------

Commit 6c08c64c55b2dbe01a0c3db665a136700e4b5973 in jena's branch refs/heads/main from Andy Seaborne
[ https://gitbox.apache.org/repos/asf?p=jena.git;h=6c08c64 ]

Merge pull request #1102 from afs/xfunc-naming

JENA-2189: Correct naming of F&O (Year|Month|Day)-from-(Date|DateTime)

> some XPath registry and function names are wrong
> ------------------------------------------------
>
>                 Key: JENA-2189
>                 URL: https://issues.apache.org/jira/browse/JENA-2189
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 3.8.0, Jena 3.9.0, Jena 3.10.0, Jena 3.11.0, Jena 3.12.0, Jena 3.13.0, Jena 3.13.1, Jena 3.14.0, Jena 3.15.0, Jena 3.16.0, Jena 3.17.0, Jena 4.0.0, Jena 4.1.0, Jena 4.2.0
>            Reporter: Peter Winstanley
>            Priority: Major
>
> I came across this when trying out some code on jena 4.2 on the tarql project 
>  
> [main] WARN org.apache.jena.arq.exec - URI <[http://www.w3.org/2005/xpath-functions#day-from-dateTime]> has no registered function factory
>  
> I looked at [https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/function/StandardFunctions.java] and realised that a few functions aren't what they are described as in [https://www.w3.org/TR/xpath-functions-3/] .  They appear to have a signature that uses the plural, whereas the XPath functions are singular:
>  
>         add(registry, xfn+"years-from-date",        FN_YearsFromDate.class) ;                                                            [https://www.w3.org/TR/xpath-functions-3/#func-year-from-date]
>         add(registry, xfn+"months-from-date",       FN_MonthsFromDate.class) ;                                                       [https://www.w3.org/TR/xpath-functions-3/#func-month-from-date]
>         add(registry, xfn+"days-from-date",         FN_DaysFromDate.class) ;                                                             [https://www.w3.org/TR/xpath-functions-3/#func-day-from-date]
>  
>  
>         add(registry, xfn+"years-from-dateTime",    FN_YearsFromDateTime.class) ;                                                [https://www.w3.org/TR/xpath-functions-31/#func-year-from-dateTime]
>         add(registry, xfn+"months-from-dateTime",   FN_MonthsFromDateTime.class) ;                                           [https://www.w3.org/TR/xpath-functions-3/#func-month-from-dateTime]
>         add(registry, xfn+"days-from-dateTime",     FN_DaysFromDateTime.class) ;                                                 [https://www.w3.org/TR/xpath-functions-3/#func-day-from-dateTime]
>  
>  
>  
>  
> When I used the incorrect XPath function signature "days-from-dateTime()" the result was calculated as expected and there was no warning error message as above.
>  
> When using the distribution of Tarql 1.2 (which, afaik, used Jena 3.11) I only got the following error:
> WARN  URI <[http://www.w3.org/2005/xpath-functions#days-from-dateTime]> has no registered function factory
> and using "day-from-dateTime()" worked correctly.  I looked into this by opening the jar and found that the function was correct there:
>  
> ;org/apache/jena/sparql/function/library/FN_YearFromDateTime month-from-dateTime <org/apache/jena/sparql/function/library/FN_MonthFromDateTime day-from-dateTime :org/apache/jena/sparql/function/library/FN_DayFromDateTime
>  
>  
> So, it looks like a long-standing error that has been corrected at some point in the generation of the jars for the distro of Tarql 1.2
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)