Peter Winstanley created JENA-2189:
--------------------------------------

             Summary: 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 4.2.0, Jena 4.1.0, Jena 4.0.0, Jena 3.17.0, Jena 
3.16.0, Jena 3.15.0, Jena 3.14.0, Jena 3.13.1, Jena 3.13.0, Jena 3.12.0, Jena 
3.11.0, Jena 3.10.0, Jena 3.9.0, Jena 3.8.0
            Reporter: Peter Winstanley


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)

Reply via email to