| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" > |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>List Functions — Apache AGE master documentation</title> |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/css/custom.css" type="text/css" /> |
| <link rel="shortcut icon" href="../_static/favicon.ico"/> |
| <!--[if lt IE 9]> |
| <script src="../_static/js/html5shiv.min.js"></script> |
| <![endif]--> |
| |
| <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> |
| <script src="../_static/jquery.js"></script> |
| <script src="../_static/underscore.js"></script> |
| <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script src="../_static/doctools.js"></script> |
| <script src="../_static/sphinx_highlight.js"></script> |
| <script src="../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../genindex.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="Numeric Functions" href="numeric_functions.html" /> |
| <link rel="prev" title="Scalar Functions" href="scalar_functions.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| <a href="../index.html" class="icon icon-home"> Apache AGE |
| <img src="../_static/logo.png" class="logo" alt="Logo"/> |
| </a> |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Introduction</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/overview.html">Overview</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/setup.html">Setup</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/graphs.html">Graphs</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/cypher.html">The AGE Cypher Query Format</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/types.html">Data Types - An Introduction to agtype</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/comparability.html">Comparability, Equality, Orderability and Equivalence</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/operators.html">Operators</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/precedence.html">Operator Precedence</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/aggregation.html">Aggregation</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../intro/agload.html">Importing Graph from Files</a></li> |
| </ul> |
| <p class="caption" role="heading"><span class="caption-text">Clauses</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/match.html">MATCH</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/with.html">WITH</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/return.html">RETURN</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/order_by.html">ORDER BY</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/skip.html">SKIP</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/limit.html">LIMIT</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/create.html">CREATE</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/delete.html">DELETE</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/set.html">SET</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/remove.html">REMOVE</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/merge.html">MERGE</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../clauses/unwind.html">UNWIND</a></li> |
| </ul> |
| <p class="caption" role="heading"><span class="caption-text">Functions</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="predicate_functions.html">Predicate Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="scalar_functions.html">Scalar Functions</a></li> |
| <li class="toctree-l1 current"><a class="current reference internal" href="#">List Functions</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="#data-setup">Data Setup</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#keys">keys</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#range">range</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#labels">labels</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#nodes">nodes</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#relationships">relationships</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="#tobooleanlist">toBooleanList</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="numeric_functions.html">Numeric Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="logarithmic_functions.html">Logarithmic Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="trigonometric_functions.html">Trigonometric Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="string_functions.html">String Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="aggregate_functions.html">Aggregation Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="map_functions.html">Map Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="user_functions.html">User Defined Functions</a></li> |
| </ul> |
| <p class="caption" role="heading"><span class="caption-text">AGE Beyond Cypher</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/advanced_overview.html">Overview</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html">Using Cypher in a CTE Expression</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#using-cypher-in-a-join-expression">Using Cypher in a Join expression</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#cypher-in-sql-expressions">Cypher in SQL expressions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/prepared_statements.html">Prepared Statements</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/plpgsql.html">PL/pgSQL Functions</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../advanced/sql_in_cypher.html">SQL In Cypher</a></li> |
| </ul> |
| <p class="caption" role="heading"><span class="caption-text">Contributing</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../contributing/run_tests.html">Run the test suite</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../index.html">Apache AGE</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../index.html" class="icon icon-home"></a> »</li> |
| <li>List Functions</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="https://github.com/apache/age-website/blob/master/docs/functions/list_functions.md" class="fa fa-github"> Edit on GitHub</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="list-functions"> |
| <h1>List Functions<a class="headerlink" href="#list-functions" title="Permalink to this heading"></a></h1> |
| <section id="data-setup"> |
| <h2>Data Setup<a class="headerlink" href="#data-setup" title="Permalink to this heading"></a></h2> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s">CREATE (A:Person {name: 'Alice', age: 38, eyes: 'brown'}),</span> |
| <span class="s"> (B:Person {name: 'Bob', age: 25, eyes: 'blue'}),</span> |
| <span class="s"> (C:Person {name: 'Charlie', age: 53, eyes: 'green'}),</span> |
| <span class="s"> (D:Person {name: 'Daniel', age: 54, eyes: 'brown'}),</span> |
| <span class="s"> (E:Person {name: 'Eskil', age: 41, eyes: 'blue', array: ['one', 'two', 'three']}),</span> |
| <span class="s"> (A)-[:KNOWS]->(B),</span> |
| <span class="s"> (A)-[:KNOWS]->(C),</span> |
| <span class="s"> (B)-[:KNOWS]->(D),</span> |
| <span class="s"> (C)-[:KNOWS]->(D),</span> |
| <span class="s"> (B)-[:KNOWS]->(E)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">result</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| </section> |
| <section id="keys"> |
| <h2>keys<a class="headerlink" href="#keys" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">keys()</span></code> returns a list containing the string representations for all the property names of a vertex, edge, or map.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">keys(expression)</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">string</span> <span class="n">agtype</span> <span class="n">elements</span> |
| </pre></div> |
| </div> |
| <p>Arguments:</p> |
| <table> |
| <tr> |
| <td>Name |
| </td> |
| <td>Description |
| </td> |
| </tr> |
| <tr> |
| <td>path |
| </td> |
| <td>An expression that returns a vertex, edge, or map. |
| </td> |
| </tr> |
| </table> |
| <p>Considerations:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">keys(null)</span></code> returns null.</p></li> |
| </ul> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> MATCH (a)</span> |
| <span class="s"> WHERE a.name = 'Alice'</span> |
| <span class="s"> RETURN keys(a)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">result</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>A list containing the names of all the properties on the vertex bound to <code class="docutils literal notranslate"><span class="pre">a</span></code> is returned.</p> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>keys |
| </td> |
| </tr> |
| <tr> |
| <td>["age", "eyes", "name"]</td> |
| </tr> |
| <tr> |
| <td colspan="1" >1 rows |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section id="range"> |
| <h2>range<a class="headerlink" href="#range" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">range()</span></code> returns a list comprising all integer values within a range bounded by a start value <strong>start</strong> and end value <strong>end</strong>, where the difference <strong>step</strong> between any two consecutive values is constant; i.e. an arithmetic progression. The range is inclusive, and the arithmetic progression will therefore always contain <strong>start</strong> and—depending on the values of <strong>start</strong>, <strong>step</strong> and <strong>end</strong>—<strong>end</strong>.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">range(start,</span> <span class="pre">end</span> <span class="pre">[,</span> <span class="pre">step])</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">integer</span> <span class="n">elements</span> |
| </pre></div> |
| </div> |
| <p>Arguments:</p> |
| <table> |
| <tr> |
| <td>Name |
| </td> |
| <td>Description |
| </td> |
| </tr> |
| <tr> |
| <td>start |
| </td> |
| <td>An expression that returns an integer value. |
| </td> |
| </tr> |
| <tr> |
| <td>end |
| </td> |
| <td>An expression that returns an integer value. |
| </td> |
| </tr> |
| <tr> |
| <td>step |
| </td> |
| <td>A numeric expression defining the difference between any two consecutive values, with a default of 1. |
| </td> |
| </tr> |
| </table> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> |
| <span class="k">FROM</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> RETURN range(0, 10), range(2, 18, 3)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">no_step</span><span class="w"> </span><span class="n">agtype</span><span class="p">,</span><span class="w"> </span><span class="n">step</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>Two lists of numbers in the given ranges are returned.</p> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>no_step |
| </td> |
| <td>step |
| </td> |
| </tr> |
| <tr> |
| <td>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]</td> |
| <td>[2, 5, 8, 11, 14, 17]</td> |
| </tr> |
| <tr> |
| <td colspan="1" >1 row |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section id="labels"> |
| <h2>labels<a class="headerlink" href="#labels" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">labels</span></code> returns a list containing the string representations for all the labels of a node.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">labels(vertex)</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">string</span> <span class="n">elements</span> |
| </pre></div> |
| </div> |
| <p>Arguments:</p> |
| <table> |
| <tr> |
| <td>Name |
| </td> |
| <td>Description |
| </td> |
| </tr> |
| <tr> |
| <td>vertex |
| </td> |
| <td>An expression that returns a single vertex. |
| </td> |
| </tr> |
| </table> |
| <p>Considerations:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">labels(null)</span></code> returns <code class="docutils literal notranslate"><span class="pre">null</span></code>.</p></li> |
| </ul> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> |
| <span class="k">FROM</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> MATCH (a)</span> |
| <span class="s"> WHERE a.name = 'Alice'</span> |
| <span class="s"> RETURN labels(a)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">edges</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>A list containing all the labels of the node bound to <code class="docutils literal notranslate"><span class="pre">a</span></code> is returned.</p> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>edges |
| </td> |
| </tr> |
| <tr> |
| <td>["Person"] |
| </td> |
| </tr> |
| <tr> |
| <td colspan="3" >1 row |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section id="nodes"> |
| <h2>nodes<a class="headerlink" href="#nodes" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">nodes</span></code> returns a list containing all the vertices in a path.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">nodes(path)</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">vertex</span> <span class="n">entities</span> |
| </pre></div> |
| </div> |
| <p>Arguments:</p> |
| <table> |
| <tr> |
| <td>Name |
| </td> |
| <td>Description |
| </td> |
| </tr> |
| <tr> |
| <td>path |
| </td> |
| <td>An expression that returns an agtype path. |
| </td> |
| </tr> |
| </table> |
| <p>Considerations:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">nodes(null)</span></code> returns <code class="docutils literal notranslate"><span class="pre">null</span></code>.</p></li> |
| </ul> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> |
| <span class="k">FROM</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> MATCH p = (a)-[]->(b)-[]->(c)</span> |
| <span class="s"> WHERE a.name = 'Alice' AND c.name = 'Eskil'</span> |
| <span class="s"> RETURN nodes(a)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">vertices</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>A list containing all the vertices in the path <code class="docutils literal notranslate"><span class="pre">p</span></code> is returned.</p> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>vertices |
| </td> |
| </tr> |
| <tr> |
| <td> [{"id": 844424930131969, "label": "Person", "properties": {"age": 38, "eyes": "brown", "name": "Alice"}}::vertex, {"id": 844424930131970, "label": "Person", "properties": {"age": 25, "eyes": "blue", "name": "Bob"}}::vertex, {"id": 844424930131973, "label": "Person", "properties": {"age": 41, "eyes": "blue", "name": "Eskil", "array": ["one", "two", "three"]}}::vertex] |
| </td> |
| </tr> |
| <tr> |
| <td colspan="3" >1 row |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section id="relationships"> |
| <h2>relationships<a class="headerlink" href="#relationships" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">relationships()</span></code> returns a list containing all the relationships in a path.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">relationships(path)</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">edge</span> <span class="n">entities</span> |
| </pre></div> |
| </div> |
| <p>Arguments:</p> |
| <table> |
| <tr> |
| <td>Name |
| </td> |
| <td>Description |
| </td> |
| </tr> |
| <tr> |
| <td>path |
| </td> |
| <td>An expression that returns an agtype path. |
| </td> |
| </tr> |
| </table> |
| <p>Considerations:</p> |
| <ul class="simple"> |
| <li><p><code class="docutils literal notranslate"><span class="pre">relationships(null)</span></code> returns <code class="docutils literal notranslate"><span class="pre">null</span></code>.</p></li> |
| </ul> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> |
| <span class="k">FROM</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'graph_name'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> MATCH p = (a)-[]->(b)-[]->(c)</span> |
| <span class="s"> WHERE a.name = 'Alice' AND c.name = 'Eskil'</span> |
| <span class="s"> RETURN relationships(p)</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">(</span><span class="n">edges</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>A list containing all the edges in the path <code class="docutils literal notranslate"><span class="pre">p</span></code> is returned.</p> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>edges |
| </td> |
| </tr> |
| <tr> |
| <td>[{"id": 1125899906842640, "label": "KNOWS", "end_id": 844424930131989, "start_id": 844424930131988, "properties": {}}::edge, {"id": 1125899906842644, "label": "KNOWS", "end_id": 844424930131992, "start_id": 844424930131989, "properties": {}}::edge] |
| </td> |
| </tr> |
| <tr> |
| <td colspan="3" >1 row |
| </td> |
| </tr> |
| </table> |
| </section> |
| <section id="tobooleanlist"> |
| <h2>toBooleanList<a class="headerlink" href="#tobooleanlist" title="Permalink to this heading"></a></h2> |
| <p><code class="docutils literal notranslate"><span class="pre">toBooleanList()</span></code> converts a list of values and returns a list of boolean values. If any values are not convertible to boolean they will be null in the list returned.</p> |
| <p>Syntax: <code class="docutils literal notranslate"><span class="pre">toBooleanList(list)</span></code></p> |
| <p>Returns:</p> |
| <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">containing</span> <span class="n">the</span> <span class="n">converted</span> <span class="n">elements</span><span class="p">;</span> <span class="n">depending</span> <span class="n">on</span> <span class="n">the</span> <span class="nb">input</span> <span class="n">value</span> <span class="n">a</span> <span class="n">converted</span> <span class="n">value</span> <span class="ow">is</span> <span class="n">either</span> <span class="n">a</span> <span class="n">boolean</span> <span class="n">value</span> <span class="ow">or</span> <span class="n">null</span><span class="o">.</span> |
| </pre></div> |
| </div> |
| <p>Considerations:</p> |
| <ul class="simple"> |
| <li><p>Any null element in list is preserved.</p></li> |
| <li><p>Any boolean value in list is preserved.</p></li> |
| <li><p>If the list is null, null will be returned.</p></li> |
| <li><p>If the list is not a list, an error will be returned.</p></li> |
| </ul> |
| <p>Query:</p> |
| <div class="highlight-postgresql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">cypher</span><span class="p">(</span><span class="s1">'expr'</span><span class="p">,</span><span class="w"> </span><span class="s">$$</span> |
| <span class="s"> RETURN toBooleanList(["true", "false", "true"])</span> |
| <span class="s">$$</span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="p">(</span><span class="n">toBooleanList</span><span class="w"> </span><span class="n">agtype</span><span class="p">);</span> |
| </pre></div> |
| </div> |
| <p>Result:</p> |
| <table> |
| <tr> |
| <td>tobooleanlist |
| </td> |
| </tr> |
| <tr> |
| <td> [true, false, true] |
| </td> |
| </tr> |
| <tr> |
| <td colspan="3" >1 row |
| </td> |
| </tr> |
| </table> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="scalar_functions.html" class="btn btn-neutral float-left" title="Scalar Functions" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="numeric_functions.html" class="btn btn-neutral float-right" title="Numeric Functions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2021, Apache AGE.</p> |
| </div> |
| |
| Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a |
| <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> |
| provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| |
| <div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> |
| <span class="rst-current-version" data-toggle="rst-current-version"> |
| <span class="fa fa-book"> Other Versions</span> |
| v: master |
| <span class="fa fa-caret-down"></span> |
| </span> |
| <div class="rst-other-versions"> |
| <dl> |
| <dt>Versions</dt> |
| <dd><a href="list_functions.html">master</a></dd> |
| <dd><a href="../../v0.6.0/index.html">v0.6.0</a></dd> |
| </dl> |
| </div> |
| </div><script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |