Skip to content

Commit 4a50096

Browse files
committed
fixes #391 - Update documentation for procedures that have converted to functions
1 parent 94d5bb1 commit 4a50096

File tree

6 files changed

+50
-93
lines changed

6 files changed

+50
-93
lines changed

docs/datetime.adoc

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ endif::env-guide[]
66

77
== Conversion between formatted dates and timestamps
88

9-
* `apoc.date.parseDefault('2015-03-25 03:15:59','s')` get Unix time equivalent of given date (in seconds)
10-
* `apoc.date.parse('2015/03/25 03-15-59','s','yyyy/MM/dd HH/mm/ss')` same as previous, but accepts custom datetime format
11-
* `apoc.date.formatDefault(12345,'s')` get string representation of date corresponding to given Unix time (in seconds) in UTC time zone
12-
* `apoc.date.format(12345,'s', 'yyyy/MM/dd HH/mm/ss')` the same as previous, but accepts custom datetime format
13-
* `apoc.date.formatTimeZone(12345,'s', 'yyyy/MM/dd HH/mm/ss', 'ABC')` the same as previous, but accepts custom time zone
9+
* `apoc.date.parse('2015/03/25 03-15-59',['s'],['yyyy/MM/dd HH/mm/ss'])` same as previous, but accepts custom datetime format
10+
* `apoc.date.format(12345,['s'], ['yyyy/MM/dd HH/mm/ss'])` the same as previous, but accepts custom datetime format
1411

1512
* possible unit values: `ms,s,m,h,d` and their long forms.
1613
* possible time zone values: Either an abbreviation such as `PST`, a full name such as `America/Los_Angeles`, or a custom ID such as `GMT-8:00`. Full names are recommended.
@@ -33,12 +30,7 @@ Splits date (optionally, using given custom format) into fields returning a map
3330

3431
[source,cypher]
3532
----
36-
CALL apoc.date.fields('2015-03-25 03:15:59')
37-
----
38-
39-
[source,cypher]
40-
----
41-
CALL apoc.date.fieldsFormatted('2015-01-02 03:04:05 EET', 'yyyy-MM-dd HH:mm:ss zzz')
33+
RETURN apoc.date.fields('2015-03-25 03:15:59')
4234
----
4335

4436

@@ -60,48 +52,34 @@ Following fields are supported:
6052

6153
[source,cypher]
6254
----
63-
CALL apoc.date.fieldsDefault('2015-03-25 03:15:59')
64-
----
65-
66-
----
67-
{
68-
'Months': 1,
69-
'Days': 2,
70-
'Hours': 3,
71-
'Minutes': 4,
72-
'Seconds': 5,
73-
'Years': 2015
74-
}
75-
----
76-
77-
[source,cypher]
78-
----
79-
CALL apoc.date.fields('2015-01-02 03:04:05 EET', 'yyyy-MM-dd HH:mm:ss zzz')
55+
RETURN apoc.date.fields('2015-01-02 03:04:05 EET', 'yyyy-MM-dd HH:mm:ss zzz')
8056
----
8157

8258
----
8359
{
84-
'ZoneId': 'Europe/Bucharest',
85-
'Months': 1,
86-
'Days': 2,
87-
'Hours': 3,
88-
'Minutes': 4,
89-
'Seconds': 5,
90-
'Years': 2015
60+
'weekdays': 5,
61+
'years': 2015,
62+
'seconds': 5,
63+
'zoneid': 'EET',
64+
'minutes': 4,
65+
'hours': 3,
66+
'months': 1,
67+
'days': 2
9168
}
9269
----
9370

9471
[source,cypher]
9572
----
96-
CALL apoc.date.fields('2015/01/02_EET', 'yyyy/MM/dd_z')
73+
RETURN apoc.date.fields('2015/01/02_EET', 'yyyy/MM/dd_z')
9774
----
9875

9976
----
10077
{
101-
'Years': 2015,
102-
'ZoneId': 'Europe/Bucharest',
103-
'Months': 1,
104-
'Days': 2
78+
'weekdays': 5,
79+
'years': 2015,
80+
'zoneid': 'EET',
81+
'months': 1,
82+
'days': 2
10583
}
10684
----
10785

docs/extract.adoc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
= Extract Domain
22

3-
The procedure `apoc.data.domain` will take a url or email address and try to determine the domain name.
3+
The User Function `apoc.data.domain` will take a url or email address and try to determine the domain name.
44
This can be useful to make easier correlations and equality tests between differently formatted email addresses, and between urls to the same domains but specifying different locations.
55

66
[source,cypher]
77
----
88
WITH '[email protected]' AS email
9-
CALL apoc.data.domain(email) YIELD domain
10-
RETURN domain // will return 'bar.com'
9+
RETURN apoc.data.domain(email) // will return 'bar.com'
1110
----
1211

1312
[source,cypher]
1413
----
1514
WITH 'http://www.example.com/all-the-things' AS url
16-
CALL apoc.data.domain(url) YIELD domain
17-
RETURN domain // will return 'www.example.com'
15+
RETURN apoc.data.domain(url) // will return 'www.example.com'
1816
----

docs/functions.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For example:
1212
----
1313
CREATE (v:Value {id:{id}, data:{data}})
1414
WITH v
15-
CALL apoc.date.formatDefault(timestamp(), "ms") YIELD value as created
15+
CALL apoc.date.format(timestamp(), "ms") YIELD value as created
1616
SET v.created = created
1717
----
1818

docs/number.adoc

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@
22

33
== Conversion between formatted decimals
44

5-
* `apoc.number.format(number) yield value` format a long or double using the default system pattern and language to produce a string
6-
* `apoc.number.format.pattern(number, pattern) yield value` format a long or double using a pattern and the default system language to produce a string
7-
* `apoc.number.format.lang(number, lang) yield value` format a long or double using the default system pattern pattern and a language to produce a string
8-
* `apoc.number.format.pattern.lang(number, pattern, lang) yield value` format a long or double using a pattern and a language to produce a string
5+
* `apoc.number.format(number)` format a long or double using the default system pattern and language to produce a string
6+
* `apoc.number.format(number, pattern)` format a long or double using a pattern and the default system language to produce a string
7+
* `apoc.number.format(number, lang)` format a long or double using the default system pattern pattern and a language to produce a string
8+
* `apoc.number.format(number, pattern, lang)` format a long or double using a pattern and a language to produce a string
99

10-
* `apoc.number.parseInt(text) yield value` parse a text using the default system pattern and language to produce a long
11-
* `apoc.number.parseInt.pattern(text, pattern) yield value` parse a text using a pattern and the default system language to produce a long
12-
* `apoc.number.parseInt.lang(text, lang) yield value` parse a text using the default system pattern and a language to produce a long
13-
* `apoc.number.parseInt.pattern.lang(text, pattern, lang) yield value` parse a text using a pattern and a language to produce a long
10+
* `apoc.number.parseInt(text)` parse a text using the default system pattern and language to produce a long
11+
* `apoc.number.parseInt(text, pattern)` parse a text using a pattern and the default system language to produce a long
12+
* `apoc.number.parseInt(text, '', lang)` parse a text using the default system pattern and a language to produce a long
13+
* `apoc.number.parseInt(text, pattern, lang)` parse a text using a pattern and a language to produce a long
1414

15-
* `apoc.number.parseFloat(text) yield value` parse a text using the default system pattern and language to produce a double
16-
* `apoc.number.parseFloat.pattern(text, pattern) yield value` parse a text using a pattern and the default system language to produce a double
17-
* `apoc.number.parseFloat.lang(text, lang) yield value` parse a text using the default system pattern and a language to produce a double
18-
* `apoc.number.parseFloat.pattern.lang(text, pattern, lang) yield value` parse a text using a pattern and a language to produce a double
15+
* `apoc.number.parseFloat(text)` parse a text using the default system pattern and language to produce a double
16+
* `apoc.number.parseFloat(text, pattern)` parse a text using a pattern and the default system language to produce a double
17+
* `apoc.number.parseFloat(text,'',lang)` parse a text using the default system pattern and a language to produce a double
18+
* `apoc.number.parseFloat(text, pattern, lang)` parse a text using a pattern and a language to produce a double
1919

2020
* The full list of supported values for `pattern` and `lang` params is described in https://docs.oracle.com/javase/9/docs/api/java/text/DecimalFormat.html[DecimalFormat JavaDoc]
2121

2222
== Examples
2323

2424
....
25-
call apoc.number.format(12345.67) yield value
26-
return value
25+
return apoc.number.format(12345.67) as value
2726
2827
╒═════════╕
2928
│value │
@@ -33,8 +32,7 @@
3332
....
3433

3534
....
36-
call apoc.number.format.pattern.lang(12345, '#,##0.00;(#,##0.00)', 'it') yield value
37-
return value
35+
return apoc.number.format(12345, '#,##0.00;(#,##0.00)', 'it') as value
3836
3937
╒═════════╕
4038
│value │
@@ -44,19 +42,17 @@
4442
....
4543

4644
....
47-
call apoc.number.format.pattern.lang(12345.67, '#,##0.00;(#,##0.00)', 'it') yield value
48-
return value
49-
45+
return apoc.number.format(12345.67, '#,##0.00;(#,##0.00)', 'it') as value
46+
5047
╒═════════╕
5148
│value │
5249
╞═════════╡
5350
│12.345,67│
54-
└─────────┘
51+
└─────────┘
5552
....
5653

5754
....
58-
call apoc.number.parseInt.pattern.lang('12.345', '#,##0.00;(#,##0.00)', 'it') yield value
59-
return value
55+
return apoc.number.parseInt('12.345', '#,##0.00;(#,##0.00)', 'it') as value
6056
6157
╒═════╕
6258
│value│
@@ -66,9 +62,8 @@
6662
....
6763

6864
....
69-
call apoc.number.parseFloat.pattern.lang('12.345,67', '#,##0.00;(#,##0.00)', 'it') yield value
70-
return value
71-
65+
return apoc.number.parseFloat('12.345,67', '#,##0.00;(#,##0.00)', 'it') as value
66+
7267
╒════════╕
7368
│value │
7469
╞════════╡
@@ -77,19 +72,13 @@
7772
....
7873

7974
....
80-
call apoc.number.format('aaa') yield value
75+
return apoc.number.format('aaa') as value
8176
82-
Failed to invoke procedure `apoc.number.format`: Caused by: java.lang.IllegalArgumentException: Number parameter must be long or double.
83-
....
84-
85-
....
86-
call apoc.number.format.lang(12345, 'apoc')
87-
88-
Failed to invoke procedure `apoc.number.format.lang`: Caused by: java.lang.IllegalArgumentException: Unrecognized language value: 'apoc' isn't a valid ISO language
77+
null beacuse 'aaa' isn't a number
8978
....
9079

9180
....
92-
call apoc.number.parseInt('aaa')
81+
RETURN apoc.number.parseInt('aaa')
9382
94-
Failed to invoke procedure `apoc.number.parseAsLong`: Caused by: java.text.ParseException: Unparseable number: "aaa"
83+
Return null because 'aaa' is unparsable.
9584
....

docs/overview.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,11 +1100,7 @@ Optionally set `apoc.ttl.schedule=5` as repeat frequency.
11001100
|===
11011101
| apoc.date.parse('2015/03/25 03:15:59',['ms'/'s'], ['yyyy/MM/dd HH:mm:ss']) | same as previous, but accepts custom datetime format
11021102
| apoc.date.format(12345, ['ms'/'s'], ['yyyy/MM/dd HH:mm:ss']) | the same as previous, but accepts custom datetime format
1103-
| apoc.date.formatTimeZone(12345,'s', 'yyyy/MM/dd HH/mm/ss', 'ABC') | the same as previous, but accepts custom time zone
11041103
| apoc.date.systemTimezone() | return the system timezone display format string
1105-
1106-
| apoc.date.parseDefault('2015-03-25 03:15:59','s') | DEPRECATED get Unix time equivalent of given date (in seconds)
1107-
| apoc.date.formatDefault(12345,'s') | DEPRECATED get string representation of date corresponding to given Unix time (in seconds)
11081104
|===
11091105

11101106
* possible unit values: `ms,s,m,h,d` and their long forms `millis,milliseconds,seconds,minutes,hours,days`.
@@ -1127,7 +1123,6 @@ Optionally set `apoc.ttl.schedule=5` as repeat frequency.
11271123
Splits date (optionally, using given custom format) into fields returning a map from field name to its value.
11281124

11291125
* `apoc.date.fields('2015-03-25 03:15:59')`
1130-
* `apoc.date.fieldsFormatted('2015-01-02 03:04:05 EET', 'yyyy-MM-dd HH:mm:ss zzz')`
11311126

11321127
== Bitwise operations
11331128

docs/spatial.adoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,18 @@ LIMIT 100
171171

172172
== Combined Space and Time search
173173

174-
Combining spatial and date-time procedures can allow for more complex queries:
174+
Combining spatial and date-time functions can allow for more complex queries:
175175

176176
[source,cypher]
177177
----
178-
CALL apoc.date.parse('2016-06-01 00:00:00','h') YIELD value AS due_date
179-
WITH due_date,
180-
point({latitude: 48.8582532, longitude: 2.294287}) AS eiffel
178+
WITH point({latitude: 48.8582532, longitude: 2.294287}) AS eiffel
181179
MATCH (e:Event)
182180
WHERE exists(e.address) AND exists(e.datetime)
183181
CALL apoc.spatial.geocodeOnce(e.address) YIELD location
184-
CALL apoc.date.parse(e.datetime,'h') YIELD value AS hours
185182
WITH e, location,
186183
distance(point(location), eiffel) AS distance,
187-
(due_date - hours)/24.0 AS days_before_due
188-
WHERE distance < 5000 AND days_before_due < 14 AND hours < due_date
184+
(apoc.date.parse('2016-06-01 00:00:00','h') - apoc.date.parse(e.datetime,'h'))/24.0 AS days_before_due
185+
WHERE distance < 5000 AND days_before_due < 14 AND apoc.date.parse(e.datetime,'h') < apoc.date.parse('2016-06-01 00:00:00','h')
189186
RETURN e.name AS event, e.datetime AS date,
190187
location.description AS description, distance
191188
ORDER BY distance

0 commit comments

Comments
 (0)