You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jo...@apache.org on 2021/10/20 17:56:53 UTC

[incubator-age-website] branch asf-site updated: Updated With Clause documentation

This is an automated email from the ASF dual-hosted git repository.

joshinnis pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-age-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new a7ad475  Updated With Clause documentation
a7ad475 is described below

commit a7ad47577d1636720adee9909163ca0c5c54e701
Author: Josh Innis <Jo...@gmail.com>
AuthorDate: Wed Oct 20 10:56:06 2021 -0700

    Updated With Clause documentation
    
    Added a gitignore file too
---
 .gitignore                        |   3 +-
 docs/.buildinfo                   |   2 +-
 docs/_sources/clauses/with.md.txt | 107 ++++++++++++++++++++++++++++++++++----
 docs/clauses/with.html            |  98 ++++++++++++++++++++++++++++++----
 docs/searchindex.js               |   2 +-
 docs/src/docs/clauses/with.md     | 107 ++++++++++++++++++++++++++++++++++----
 6 files changed, 287 insertions(+), 32 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8b13789..26353c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-
+venv/
+docs/.doctrees/
diff --git a/docs/.buildinfo b/docs/.buildinfo
index e30d1b4..4944745 100755
--- a/docs/.buildinfo
+++ b/docs/.buildinfo
@@ -1,4 +1,4 @@
 # Sphinx build info version 1
 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 8dadeb1941185cea80ec85427572ce42
+config: 17c572500e268dc11e08ded1e382d470
 tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/_sources/clauses/with.md.txt b/docs/_sources/clauses/with.md.txt
index 833fad9..9750f05 100644
--- a/docs/_sources/clauses/with.md.txt
+++ b/docs/_sources/clauses/with.md.txt
@@ -1,6 +1,6 @@
 # WITH
 
-Introduction
+## Introduction
 
 Using WITH, you can manipulate the output before it is passed on to the following query parts. The manipulations can be of the shape and/or number of entries in the result set.
 
@@ -9,20 +9,18 @@ WITH can also, like RETURN, alias expressions that are introduced into the resul
 WITH is also used to separate the reading of the graph from updating of the graph. Every part of a query must be either read-only or write-only. When going from a writing part to a reading part, the switch can be done with an optional WITH clause.
 
 
-## Filter on results
+## Filter on aggregate function results
 
-Results passed through a WITH clause can be filtered on.
+Aggregated results have to pass through a WITH clause to be able to filter on.
 
 Query
-
-
 ```
 SELECT *
 FROM cypher('graph_name', $$
-MATCH (david {name: 'David'})-[:FRIEND]-(otherPerson)
-WITH otherPerson.name as name, otherPerson.age as age, otherPerson.freetonight as free_tonight
-WHERE age > 21 and free_tonight = TRUE
-RETURN name
+	MATCH (david {name: 'David'})-[]-(otherPerson)-[]->()
+	WITH otherPerson, count(*) AS foaf
+	WHERE foaf > 1RETURN otherPerson.name
+	RETURN otherPerson.name
 $$) as (name agtype);
 ```
 
@@ -30,22 +28,111 @@ $$) as (name agtype);
 The name of the person connected to 'David' with the at least more than one outgoing relationship will be returned by the query.
 
 Result
+<table>
+  <thead>
+  <tr>
+   <td>name
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>"Anders"
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>1 row
+   </td>
+  </tr>
+</table>
 
 
+
+## Sort results before using collect on them
+
+You can sort your results before passing them to collect, thus sorting the resulting list.
+
+Query
+```
+SELECT *
+FROM cypher('graph_name', $$
+	MATCH (n)WITH n
+	ORDER BY n.name DESC LIMIT 3
+	RETURN collect(n.name)
+$$) as (names agtype);
+```
+
+
+A list of the names of people in reverse order, limited to 3, is returned in a list.
+
+Result
 <table>
+  <thead>
+  <tr>
+   <td>names
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>["Emil","David","Ceasar"]
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>1 row
+   </td>
+  </tr>
+</table>
+
+## Limit branching of a path search
+
+You can match paths, limit to a certain number, and then match again using those paths as a base,as well as any number of similar limited searches.
+
+Query
+
+```
+SELECT *
+FROM cypher('graph_name', $$
+	MATCH (n {name: 'Anders'})-[]-(m)WITH m
+	ORDER BY m.name DESC LIMIT 1
+	MATCH (m)-[]-(o)
+	RETURN o.name
+$$) as (name agtype);
+```
+
+
+Starting at 'Anders', find all matching nodes, order by name descending and get the top result, thenfind all the nodes connected to that top result, and return their names.
+
+Result
+<table>
+  <thead>
   <tr>
    <td>name
    </td>
   </tr>
+  </thead>
+  <tbody>
   <tr>
    <td>"Anders"
    </td>
   </tr>
   <tr>
-   <td>1 row
+   <td>"Bossman"
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>2 rows
    </td>
   </tr>
 </table>
 
 
 
+
+
+
+
+
diff --git a/docs/clauses/with.html b/docs/clauses/with.html
index 783c76d..e0f0304 100644
--- a/docs/clauses/with.html
+++ b/docs/clauses/with.html
@@ -108,7 +108,10 @@
 <ul class="current">
 <li class="toctree-l1"><a class="reference internal" href="match.html">MATCH</a></li>
 <li class="toctree-l1 current"><a class="current reference internal" href="#">WITH</a><ul>
-<li class="toctree-l2"><a class="reference internal" href="#filter-on-results">Filter on results</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#introduction">Introduction</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#filter-on-aggregate-function-results">Filter on aggregate function results</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#sort-results-before-using-collect-on-them">Sort results before using collect on them</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#limit-branching-of-a-path-search">Limit branching of a path search</a></li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="return.html">RETURN</a></li>
@@ -209,40 +212,117 @@
             
   <div class="tex2jax_ignore mathjax_ignore section" id="with">
 <h1>WITH<a class="headerlink" href="#with" title="Permalink to this headline">¶</a></h1>
-<p>Introduction</p>
+<div class="section" id="introduction">
+<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
 <p>Using WITH, you can manipulate the output before it is passed on to the following query parts. The manipulations can be of the shape and/or number of entries in the result set.</p>
 <p>WITH can also, like RETURN, alias expressions that are introduced into the results using the aliases as the binding name.</p>
 <p>WITH is also used to separate the reading of the graph from updating of the graph. Every part of a query must be either read-only or write-only. When going from a writing part to a reading part, the switch can be done with an optional WITH clause.</p>
-<div class="section" id="filter-on-results">
-<h2>Filter on results<a class="headerlink" href="#filter-on-results" title="Permalink to this headline">¶</a></h2>
-<p>Results passed through a WITH clause can be filtered on.</p>
+</div>
+<div class="section" id="filter-on-aggregate-function-results">
+<h2>Filter on aggregate function results<a class="headerlink" href="#filter-on-aggregate-function-results" title="Permalink to this headline">¶</a></h2>
+<p>Aggregated results have to pass through a WITH clause to be able to filter on.</p>
 <p>Query</p>
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
 FROM cypher(&#39;graph_name&#39;, $$
-MATCH (david {name: &#39;David&#39;})-[:FRIEND]-(otherPerson)
-WITH otherPerson.name as name, otherPerson.age as age, otherPerson.freetonight as free_tonight
-WHERE age &gt; 21 and free_tonight = TRUE
-RETURN name
+	MATCH (david {name: &#39;David&#39;})-[]-(otherPerson)-[]-&gt;()
+	WITH otherPerson, count(*) AS foaf
+	WHERE foaf &gt; 1RETURN otherPerson.name
+	RETURN otherPerson.name
 $$) as (name agtype);
 </pre></div>
 </div>
 <p>The name of the person connected to ‘David’ with the at least more than one outgoing relationship will be returned by the query.</p>
 <p>Result</p>
 <table>
+  <thead>
   <tr>
    <td>name
    </td>
   </tr>
+  </thead>
+  <tbody>
   <tr>
    <td>"Anders"
    </td>
   </tr>
+  </tbody>
+  <tr>
+   <td>1 row
+   </td>
+  </tr>
+</table>
+</div>
+<div class="section" id="sort-results-before-using-collect-on-them">
+<h2>Sort results before using collect on them<a class="headerlink" href="#sort-results-before-using-collect-on-them" title="Permalink to this headline">¶</a></h2>
+<p>You can sort your results before passing them to collect, thus sorting the resulting list.</p>
+<p>Query</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
+FROM cypher(&#39;graph_name&#39;, $$
+	MATCH (n)WITH n
+	ORDER BY n.name DESC LIMIT 3
+	RETURN collect(n.name)
+$$) as (names agtype);
+</pre></div>
+</div>
+<p>A list of the names of people in reverse order, limited to 3, is returned in a list.</p>
+<p>Result</p>
+<table>
+  <thead>
+  <tr>
+   <td>names
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>["Emil","David","Ceasar"]
+   </td>
+  </tr>
+  </tbody>
   <tr>
    <td>1 row
    </td>
   </tr>
 </table>
 </div>
+<div class="section" id="limit-branching-of-a-path-search">
+<h2>Limit branching of a path search<a class="headerlink" href="#limit-branching-of-a-path-search" title="Permalink to this headline">¶</a></h2>
+<p>You can match paths, limit to a certain number, and then match again using those paths as a base,as well as any number of similar limited searches.</p>
+<p>Query</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
+FROM cypher(&#39;graph_name&#39;, $$
+	MATCH (n {name: &#39;Anders&#39;})-[]-(m)WITH m
+	ORDER BY m.name DESC LIMIT 1
+	MATCH (m)-[]-(o)
+	RETURN o.name
+$$) as (name agtype);
+</pre></div>
+</div>
+<p>Starting at ‘Anders’, find all matching nodes, order by name descending and get the top result, thenfind all the nodes connected to that top result, and return their names.</p>
+<p>Result</p>
+<table>
+  <thead>
+  <tr>
+   <td>name
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>"Anders"
+   </td>
+  </tr>
+  <tr>
+   <td>"Bossman"
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>2 rows
+   </td>
+  </tr>
+</table>
+</div>
 </div>
 
 
diff --git a/docs/searchindex.js b/docs/searchindex.js
index 626c746..ea96e88 100644
--- a/docs/searchindex.js
+++ b/docs/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["advanced/advanced","advanced/advanced_overview","advanced/plpgsql","advanced/prepared_statements","clauses/create","clauses/delete","clauses/match","clauses/order_by","clauses/remove","clauses/return","clauses/set","clauses/with","functions/aggregate_functions","functions/list_functions","functions/logarithmic_functions","functions/numeric_functions","functions/predicate_functions","functions/scalar_functions","functions/string_functions","functions/trigonomet [...]
\ No newline at end of file
+Search.setIndex({docnames:["advanced/advanced","advanced/advanced_overview","advanced/plpgsql","advanced/prepared_statements","clauses/create","clauses/delete","clauses/match","clauses/order_by","clauses/remove","clauses/return","clauses/set","clauses/with","functions/aggregate_functions","functions/list_functions","functions/logarithmic_functions","functions/numeric_functions","functions/predicate_functions","functions/scalar_functions","functions/string_functions","functions/trigonomet [...]
\ No newline at end of file
diff --git a/docs/src/docs/clauses/with.md b/docs/src/docs/clauses/with.md
index 833fad9..9750f05 100644
--- a/docs/src/docs/clauses/with.md
+++ b/docs/src/docs/clauses/with.md
@@ -1,6 +1,6 @@
 # WITH
 
-Introduction
+## Introduction
 
 Using WITH, you can manipulate the output before it is passed on to the following query parts. The manipulations can be of the shape and/or number of entries in the result set.
 
@@ -9,20 +9,18 @@ WITH can also, like RETURN, alias expressions that are introduced into the resul
 WITH is also used to separate the reading of the graph from updating of the graph. Every part of a query must be either read-only or write-only. When going from a writing part to a reading part, the switch can be done with an optional WITH clause.
 
 
-## Filter on results
+## Filter on aggregate function results
 
-Results passed through a WITH clause can be filtered on.
+Aggregated results have to pass through a WITH clause to be able to filter on.
 
 Query
-
-
 ```
 SELECT *
 FROM cypher('graph_name', $$
-MATCH (david {name: 'David'})-[:FRIEND]-(otherPerson)
-WITH otherPerson.name as name, otherPerson.age as age, otherPerson.freetonight as free_tonight
-WHERE age > 21 and free_tonight = TRUE
-RETURN name
+	MATCH (david {name: 'David'})-[]-(otherPerson)-[]->()
+	WITH otherPerson, count(*) AS foaf
+	WHERE foaf > 1RETURN otherPerson.name
+	RETURN otherPerson.name
 $$) as (name agtype);
 ```
 
@@ -30,22 +28,111 @@ $$) as (name agtype);
 The name of the person connected to 'David' with the at least more than one outgoing relationship will be returned by the query.
 
 Result
+<table>
+  <thead>
+  <tr>
+   <td>name
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>"Anders"
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>1 row
+   </td>
+  </tr>
+</table>
 
 
+
+## Sort results before using collect on them
+
+You can sort your results before passing them to collect, thus sorting the resulting list.
+
+Query
+```
+SELECT *
+FROM cypher('graph_name', $$
+	MATCH (n)WITH n
+	ORDER BY n.name DESC LIMIT 3
+	RETURN collect(n.name)
+$$) as (names agtype);
+```
+
+
+A list of the names of people in reverse order, limited to 3, is returned in a list.
+
+Result
 <table>
+  <thead>
+  <tr>
+   <td>names
+   </td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+   <td>["Emil","David","Ceasar"]
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>1 row
+   </td>
+  </tr>
+</table>
+
+## Limit branching of a path search
+
+You can match paths, limit to a certain number, and then match again using those paths as a base,as well as any number of similar limited searches.
+
+Query
+
+```
+SELECT *
+FROM cypher('graph_name', $$
+	MATCH (n {name: 'Anders'})-[]-(m)WITH m
+	ORDER BY m.name DESC LIMIT 1
+	MATCH (m)-[]-(o)
+	RETURN o.name
+$$) as (name agtype);
+```
+
+
+Starting at 'Anders', find all matching nodes, order by name descending and get the top result, thenfind all the nodes connected to that top result, and return their names.
+
+Result
+<table>
+  <thead>
   <tr>
    <td>name
    </td>
   </tr>
+  </thead>
+  <tbody>
   <tr>
    <td>"Anders"
    </td>
   </tr>
   <tr>
-   <td>1 row
+   <td>"Bossman"
+   </td>
+  </tr>
+  </tbody>
+  <tr>
+   <td>2 rows
    </td>
   </tr>
 </table>
 
 
 
+
+
+
+
+