Author: andy
Date: Sat Mar 12 13:51:02 2016
New Revision: 1734702

URL: http://svn.apache.org/viewvc?rev=1734702&view=rev
Log:
Updates for aggregates, XSD support

Added:
    jena/site/trunk/content/documentation/query/xsd-support.md
Modified:
    jena/site/trunk/content/documentation/query/library-function.mdtext

Modified: jena/site/trunk/content/documentation/query/library-function.mdtext
URL: 
http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/query/library-function.mdtext?rev=1734702&r1=1734701&r2=1734702&view=diff
==============================================================================
--- jena/site/trunk/content/documentation/query/library-function.mdtext 
(original)
+++ jena/site/trunk/content/documentation/query/library-function.mdtext Sat Mar 
12 13:51:02 2016
@@ -20,7 +20,9 @@ ARQ also provides an implementation the
 
 ## Function Library
 
-The prefix `afn` is `<http://jena.hpl.hp.com/ARQ/function#>`.
+The prefix `afn` is `<http://jena.apache.org/ARQ/function#>`.
+(the old prefix of `<http://jena.hpl.hp.com/ARQ/function#>` contineus to
+work. Applications are encouraged to switch.)
 
 Direct loading using a URI prefix of
 `<java:org.apache.jena.sparql.function.library.>` (note the final
@@ -29,93 +31,79 @@ dot) is deprecated.
 The prefix `fn` is `<http://www.w3.org/2005/xpath-functions#>` (the
 XPath and XQuery function namespace).
 
-### XQuery/XPath functions and operators supported
+The prefix `math` is `<http://www.w3.org/2005/xpath-functions/math#>`.
 
-**String Functions**
+### Custom Aggregates
 
-Function name | Description
-------------- | -----------
-`fn:contains(string, substr)` | Test whether *`substr`* occurs in *string.*
-`fn:starts-with(string, match)` | Test whether *`string`* starts with 
*`substr`.*
-`fn:ends-with(string, match)` | Test whether *`string`* ends with *`substr.`*
-`fn:string-length(string)` | Return the length of a *`string`*.
-`fn:lower-case(string)` | Return a string which is the lower case equivalent 
of the argument.
-`fn:upper-case(string)` | Return a string which is the upper case equivalent 
of the argument.
-`fn:matches(string, pattern [, flags])` | Regular expression match.
-`fn:concat(string, ...)` | Return the concatenation of strings.
-`fn:substring(string, begin [,length])` | Returns the substring of a 
*`string`*, given by *`begin`* (integer) and, optionally, length *`length`*. 
-
-Absence of *`length`* means to end of string.  Strings are indexed
-from zero.
--   **Strings start from one**, not zero as they do in Java and C\#.
--   The **third argument is the length**, like C\# but unlike Java, where
-    it is the *endIndex*.
+The prefix `agg:` is `<http://jena.apache.org/ARQ/function/aggregate#>`.
 
-Notes:
+The statistical aggregates are provided are:
 
-1.  Strings in
-    "[XQuery 1.0 and XPath 2.0 Functions and 
Operators](http://www.w3.org/TR/xpath-functions/)"
-    start from character position one, unlike Java and C\# where
-    strings start from zero.
-2.  The `fn:substring` operation takes an optional length, like C\#
-    but different from Java, where it is the *endIndex* of the first
-    character after the substring.
+`agg:stdev`, `agg:stdevp`, `agg:var`, `agg:stvarp`
 
-The operation `afn:substring` provides Java semantics.
+These are modelled after SQL aggregate functions `STDDEV`, `STDDEVP`,
+`VAR`, `VARP`.
 
-**Mathematical Functions**
+### XQuery/XPath Functions and Operators supported
+
+ARQ supports the scalar functions and operators from 
+"[XQuery 1.0 and XPath 2.0 Functions and Operators 
v3.1](https://www.w3.org/TR/xpath-functions-3/)". 
+
+Functions in involving sequences are not supported.
 
-Function name | Description
-------------- | -----------
-`afn:min(num1, num2)` | Return the minimum of two expressions evaluating to 
numbers.
-`afn:max(num1, num2)` | Return the maximum of two expressions evaluating to 
numbers.
-`fn:round(v)`  | Return the nearest integer value to the argument.
-`fn:abs(v)`  | Return the absolute value.
-`fn:floor(v)` | Return the greatest integer value less than the argument (as a 
double).
-`fn:ceiling(v)` | Return the smallest integer value than the argument (as a 
double).
-
-Note: See also `afn:min` and `afn:max` for binary min and max
-functions.
-
-**Boolean Functions**
-
-Function name | Description
-------------- | -----------
-`fn:boolean(value)` | Boolean effective value of *`value`*.
-`fn:not(value)`  | Logical negation of the boolean effective value of 
*`value`*.
+See [XSD Support](xsd-support.html) for details of datatypes and functions
+currenty supported.  To check the exact current registrations, see
+<tt>[function/StandardFunctions.java](https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/function/StandardFunctions.java)</tt>.
 
-#### Functions provided by ARQ
+#### Addtional Functions Provided by ARQ
+
+Most of these have equivalents, or near equivalents, in SPARQL or as an
+XQuery function and are to be preferred. These ARQ-specific versions remain
+for compatibility.
 
 **RDF Graph Functions**
 
-Function name | Description
-------------- | -----------
-`afn:bnode(?x)`  | Return the blank node label if ?x is a blank node.
-`afn:localname(?x)` | The local name of ?x if a IRI. Based on splitting the 
IRI, not on any prefixes in the query or dataset.
-`afn:namespace(?x)` | The namespace of ?x if a IRI. Based on splitting the 
IRI, not on any prefixes in the query or dataset.
+Function name | Description | Alternative
+------------- | ----------- | -----------
+`afn:bnode(?x)`  | Return the blank node label if ?x is a blank node. | 
`STR(?x)`
+`afn:localname(?x)` | The local name of ?x | `REPLACE(STR(?x), 
"^(.*)(/|#)([^#/]*)$", "$3")
+`afn:namespace(?x)` | The namespace of ?x  | `REPLACE(STR(?x), 
"^(.*)(/|#)([^#/]*)$", "$1")
+
+The prefix and local name of a IRI is based on splitting the IRI, not on any 
prefixes in the query or dataset.
 
 **String Functions**
 
-Function name | Description
-------------- | -----------
+Function name | Description | Alternative
+------------- | ----------- | -----------
 `afn:substr(string, startIndex [,endIndex])` | Substring, Java style using 
*`startIndex`* and *`endIndex`*.
 `afn:substring` | Synonym for afn:substr
 `afn:strjoin(sep, string ...)` | Concatenate string together, with a separator.
-`afn:sha1sum(resource)` | Calculate the SHA1 checksum of a literal or URI.
+`afn:sha1sum(resource)` | Calculate the SHA1 checksum of a literal or URI | 
`SHA1(STR(resource))`
+
+Notes:
+
+1.  Strings in
+    "[XQuery 1.0 and XPath 2.0 Functions and 
Operators](http://www.w3.org/TR/xpath-functions-3/)"
+    start from character position one, unlike Java and C\# where
+    strings start from zero.
+2.  The `fn:substring` operation takes an optional length, like C\#
+    but different from Java, where it is the *endIndex* of the first
+    character after the substring.
+3.  `afn:substr` uses Java-style  *`startIndex`* and *`endIndex`*.
 
 **Mathematical Functions**
 
-Function name | Description
-------------- | -----------
-`afn:min(num1, num2)` | Return the minimum of two expressions evaluating to 
numbers.
-`afn:max(num1, num2)` | Return the maximum of two expressions evaluating to 
numbers.
-`afn:pi()` | The value of pi, as an XSD double.
-`afn:e()` | The value of e, as an XSD double.
-`afn:sqrt(num)` | The square root of num.
+Function name | Description | Alternative
+------------- | ----------- | -----------
+`afn:min(num1, num2)` | Return the minimum of two numbers | `fn:min`
+`afn:max(num1, num2)` | Return the maximum of two numbers | `fn:max`
+`afn:pi()` | The value of pi, as an XSD double | `math:pi()`
+`afn:e()` | The value of e, as an XSD double | `math:exp(1)`
+`afn:sqrt(num)` | The square root of num | `math:sqrt`
 
 **Miscellaneous Functions**
 
-Function name | Description
-------------- | -----------
-`afn:now()` | Current time.  Actually, the time the query started. Constant 
throughout a query execution.
-`afn:sha1sum(resource)` | Calculate the SHA1 checksum of a literal or URI.
+Function name | Description | Alternative
+------------- | ----------- | -----------
+`afn:now()` | Current time. Actually, the time the query started. | `NOW()`
+`afn:sha1sum(resource)` | Calculate the SHA1 checksum | `SHASUM`

Added: jena/site/trunk/content/documentation/query/xsd-support.md
URL: 
http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/query/xsd-support.md?rev=1734702&view=auto
==============================================================================
--- jena/site/trunk/content/documentation/query/xsd-support.md (added)
+++ jena/site/trunk/content/documentation/query/xsd-support.md Sat Mar 12 
13:51:02 2016
@@ -0,0 +1,69 @@
+Title: Support for XSD Datatype and XQuery/Xpath Functions and Operations.
+
+ARQ supports the functions and operators from "[XQuery 1.0 and XPath 2.0 
Functions and Operators v3.1](https://www.w3.org/TR/xpath-functions-3/)".
+
+ARQ supports all the XSD atomic datatypes.
+
+The prefix `fn` is `<http://www.w3.org/2005/xpath-functions#>` (the
+XPath and XQuery function namespace).
+
+The prefix `math` is `<http://www.w3.org/2005/xpath-functions/math#>`
+
+To check the exact registrations for a specific version, see
+<tt>[function/StandardFunctions.java](https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/function/StandardFunctions.java)</tt>
+in the source code for that version.
+
+The supported datatypes (including those required by SPARQL 1.1), including
+full operator support, are the XSD atomic datatypes excpt for XML-related
+ones.  Sequnces are not supported.
+
+`xsd:string`, `xsd:boolean`, 
+`xsd:decimal`, `xsd:integer`, `xsd:double`, `xsd:float`, `xsd:double`
+
+`xsd:long`, `xsd:int`, `xsd:short`, `xsd:byte`,
+`xsd:nonPositiveInteger`, `xsd:negativeInteger`,
+`xsd:nonNegativeInteger`, `xsd:positiveInteger`, 
+`xsd:unsignedLong`, `xsd:unsignedInt`, `xsd:unsignedShort`
+
+`xsd:duration`, `xsd:dayTimeDuration`, `xsd:yearMonthDuration`
+
+`xsd:anyURI`
+        
+`xsd:dateTime`, `xsd:dateTimeStamp`, `xsd:date`, `xsd:time`
+`xsd:gYear`, `xsd:gYearMonth`, `xsd:gMonth`, `xsd:gMonthDay`, `xsd:gDay`
+
+Functions on atomic types not currently supported are list below (but check
+for later additions).
+
+Supported functions:
+
+`fn:concat`, `fn:substring`, `fn:string-length`, 
+`fn:upper-case`, `fn:lower-case`, `fn:contains`, `fn:starts-with`, 
`fn:ends-with`,
+`fn:substring-before`, `fn:substring-after`, `fn:matches`,
+`fn:abs`, `fn:ceiling`, `fn:floor`, `fn:round`,
+`fn:encode-for-uri`,
+
+`fn:year-from-dateTime`, `fn:month-from-dateTime`, `fn:day-from-dateTime`,
+`fn:hours-from-dateTime`, `fn:minutes-from-dateTime`, 
`fn:seconds-from-dateTime`,
+`fn:timezone-from-dateTime`,
+`fn:years-from-duration`, `fn:months-from-duration`,
+`fn:days-from-duration`, `fn:hours-from-duration`,
+`fn:minutes-from-duration`, `fn:seconds-from-duration`,
+
+`fn:boolean`, `fn:not`
+
+`math:pi`,  `math:exp`, `math:exp10`, `math:log`, `math:log10`, `math:pow`, 
`math:sqrt`,
+`math:sin`, `math:cos`, `math:tan`, `math:asin`, `math:acos`, `math:atan`, 
`math:atan2`
+
+#### F&O Functions not currently supported:
+
+`fn:normalize-space`, `fn:normalize-unicode`,
+`fn:replace`,
+`fn:format-number`,
+`fn:round-half-to-even`,
+`fn:adjust-dateTime-to-timezone`,
+`fn:adjust-date-to-timezone`,
+`fn:adjust-time-to-timezone`,
+`fn:format-dateTime`,
+`fn:format-date`,
+`fn:format-time`.
\ No newline at end of file


Reply via email to