Skip to content

Commit 1f6ea2a

Browse files
committed
Write documentation for all built in functions
1 parent f214332 commit 1f6ea2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+909
-85
lines changed

language/cypher/src/main/java/com/neueda/jetbrains/plugin/graphdb/language/cypher/completion/metadata/atoms/CypherBuiltInFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public final class CypherBuiltInFunctions {
5353
);
5454
private static final List<CypherBuiltInFunctionElement> FUNCTIONS_LIST = Lists.newArrayList(
5555
element("nodes", "(path)", NODE.array()),
56-
element("relationship", "(path)", RELATIONSHIP.array()),
56+
element("relationships", "(path)", RELATIONSHIP.array()),
5757
element("labels", "(node)", STRING.array()),
5858
element("keys", "(node)", STRING.array()),
5959
element("keys", "(relationship)", STRING.array()),
@@ -86,7 +86,7 @@ public final class CypherBuiltInFunctions {
8686
element("asin", "(expression)", FLOAT.single()),
8787
element("acos", "(expression)", FLOAT.single()),
8888
element("atan", "(expression)", FLOAT.single()),
89-
element("atan", "(expression, expression)", FLOAT.single()),
89+
element("atan2", "(expression, expression)", FLOAT.single()),
9090
element("pi", "()", FLOAT.single()),
9191
element("degrees", "(expression)", FLOAT.single()),
9292
element("radians", "(expression)", FLOAT.single()),

language/cypher/src/main/java/com/neueda/jetbrains/plugin/graphdb/language/cypher/completion/metadata/atoms/CypherBuiltInProcedures.java

Lines changed: 0 additions & 20 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
abs.html
1+
function <b>abs</b>(expression)<br>
2+
<br>
3+
abs() returns the absolute value of a number.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
MATCH (a),(e)
13+
WHERE a.name = 'Alice' AND e.name = 'Eskil'
14+
RETURN a.age, e.age, abs(a.age - e.age)
15+
</pre>
16+
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
acos.html
1+
function <b>acos</b>(expression)<br>
2+
<br>
3+
acos() returns the arccosine of the expression, in radians.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN acos(0.5)
13+
</pre>
14+
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
all.html
1+
function <b>all</b>(variable IN list WHERE predicate)<br>
2+
<br>
3+
Tests whether a predicate holds for all elements of this list.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
list: An expression that returns a list.<br>
8+
variable: This is the variable that can be used from the predicate.<br>
9+
predicate: A predicate that is tested against all items in the list.<br>
10+
</div>
11+
<br>
12+
<b>Example Query:</b>
13+
<pre>
14+
MATCH p=(a)-[*1..3]->(b)
15+
WHERE a.name='Alice' AND b.name='Daniel' AND ALL (x IN nodes(p) WHERE x.age > 30)
16+
RETURN p
17+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
allShortestPaths.html
1+
function <b>allShortestPaths</b>(pattern)<br>
2+
<br>
3+
Finds all the shortest paths between two nodes.<br>
4+
<br>
5+
<b>Example Query:</b>
6+
<pre>
7+
MATCH (martin:Person { name:"Martin Sheen" }),(michael:Person { name:"Michael Douglas" }), p = allShortestPaths((martin)-[*]-(michael))
8+
RETURN p
9+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
any.html
1+
function <b>any</b>(variable IN list WHERE predicate)<br>
2+
<br>
3+
Tests whether a predicate holds for at least one element in the list.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
list: An expression that returns a list.<br>
8+
variable: This is the variable that can be used from the predicate.<br>
9+
predicate: A predicate that is tested against all items in the list.<br>
10+
</div>
11+
<br>
12+
<b>Example Query:</b>
13+
<pre>
14+
MATCH (a)
15+
WHERE a.name='Eskil' AND ANY (x IN a.array WHERE x = "one")
16+
RETURN a
17+
</pre>
18+
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
asin.html
1+
function <b>asin</b>(expression)<br>
2+
<br>
3+
asin() returns the arcsine of the expression, in radians.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN asin(0.5)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
atan.html
1+
function <b>atan</b>(expression)<br>
2+
<br>
3+
atan() returns the arctangent of the expression, in radians.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN atan(0.5)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function <b>atan</b>(expression1, expression2)<br>
2+
<br>
3+
atan2() returns the arctangent2 of a set of coordinates, in radians.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression1: A numeric expression for y that represents the angle in radians.<br>
8+
expression2: A numeric expression for x that represents the angle in radians.<br>
9+
</div>
10+
<br>
11+
<b>Example Query:</b>
12+
<pre>
13+
RETURN atan2(0.5, 0.6)
14+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
ceil.html
1+
function <b>ceil</b>(expression)<br>
2+
<br>
3+
ceil() returns the smallest integer greater than or equal to the argument.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN ceil(0.1)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
coalesce.html
1+
function <b>coalesce</b>(expression [, expression]*)<br>
2+
<br>
3+
Returns the first non-NULL value in the list of expressions passed to it. In case all arguments are NULL, NULL will be returned.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: The expression that might return NULL.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
MATCH (a)
13+
WHERE a.name='Alice'
14+
RETURN coalesce(a.hairColor, a.eyes)
15+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
cos.html
1+
function <b>cos</b>(expression)<br>
2+
<br>
3+
cos() returns the cosine of the expression.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN cos(0.5)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
cot.html
1+
function <b>cot</b>(expression)<br>
2+
<br>
3+
cot() returns the cotangent of the expression.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN cot(0.5)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
degrees.html
1+
function <b>degrees</b>(expression)<br>
2+
<br>
3+
degrees() converts radians to degrees.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
<br>
9+
</div>
10+
<br>
11+
<b>Example Query:</b>
12+
<pre>
13+
RETURN degrees(3.14159)
14+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
e.html
1+
function <b>e</b>()<br>
2+
<br>
3+
e() returns the base of the natural logarithm, e.<br>
4+
<br>
5+
<b>Example Query:</b>
6+
<pre>
7+
RETURN e()
8+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
endNode.html
1+
function <b>endNode</b>(relationship)<br>
2+
<br>
3+
endNode() returns the end node of a relationship<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
relationship: An expression that returns a relationship<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
MATCH (x:foo)-[r]-()
13+
RETURN endNode(r)
14+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
exists.html
1+
function <b>exists</b>(pattern-or-property)<br>
2+
<br>
3+
Returns true if a match for the pattern exists in the graph, or the property exists in the node, relationship or map.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
pattern-or-property: A pattern or a property (in the form 'variable.prop').<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
MATCH (n)
13+
WHERE EXISTS(n.name)
14+
RETURN n.name AS name, EXISTS((n)-[:MARRIED]->()) AS is_married
15+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
exp.html
1+
function <b>exp</b>(expression)<br>
2+
<br>
3+
exp() returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN exp(2)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
extract.html
1+
function <b>extract</b>(variable IN list | expression)<br>
2+
<br>
3+
To return a single property, or the value of a function from a list of nodes or relationships, you can use extract().
4+
It will go through a list, run an expression on every element, and return the results in a list with these values.
5+
It works like the map method in functional languages such as Lisp and Scala.<br>
6+
<br>
7+
<b>Arguments:</b>
8+
<div style="padding-left: 20px">
9+
list: An expression that returns a list<br>
10+
variable: The closure will have a variable introduced in it’s context. Here you decide which variable to use.<br>
11+
expression: This expression will run once per value in the list, and produces the result list.<br>
12+
</div>
13+
<br>
14+
<b>Example Query:</b>
15+
<pre>
16+
MATCH p=(a)-->(b)-->(c)
17+
WHERE a.name='Alice' AND b.name='Bob' AND c.name='Daniel'
18+
RETURN extract(n IN nodes(p)| n.age) AS extracted
19+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
filter.html
1+
function <b>filter</b>(variable IN list WHERE predicate)<br>
2+
<br>
3+
filter() returns all the elements in a list that comply to a predicate.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
list: An expression that returns a list<br>
8+
variable: This is the variable that can be used from the predicate.<br>
9+
predicate: A predicate that is tested against all items in the list.<br>
10+
</div>
11+
<br>
12+
<b>Example Query:</b>
13+
<pre>
14+
MATCH (a)
15+
WHERE a.name='Eskil'
16+
RETURN a.array, filter(x IN a.array WHERE size(x)= 3)
17+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
floor.html
1+
function <b>floor</b>(expression)<br>
2+
<br>
3+
floor() returns the greatest integer less than or equal to the expression.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN floor(0.9)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
haversin.html
1+
function <b>haversin</b>(expression)<br>
2+
<br>
3+
haversin() returns half the versine of the expression.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: A numeric expression that represents the angle in radians.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
RETURN haversin(0.5)
13+
</pre>
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
head.html
1+
function <b>head</b>(expression)<br>
2+
<br>
3+
head() returns the first element in a list.<br>
4+
<br>
5+
<b>Arguments:</b>
6+
<div style="padding-left: 20px">
7+
expression: This expression should return a list of some kind.<br>
8+
</div>
9+
<br>
10+
<b>Example Query:</b>
11+
<pre>
12+
MATCH (a)
13+
WHERE a.name='Eskil'
14+
RETURN a.array, head(a.array)
15+
</pre>

0 commit comments

Comments
 (0)