<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: WALEED SHAHID</title>
    <description>The latest articles on DEV Community by WALEED SHAHID (@waleedahmed0001).</description>
    <link>https://dev.to/waleedahmed0001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1033878%2F8defacad-beb9-418d-aa21-436d82858086.jpeg</url>
      <title>DEV Community: WALEED SHAHID</title>
      <link>https://dev.to/waleedahmed0001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waleedahmed0001"/>
    <language>en</language>
    <item>
      <title>Blog Post 3: Exploration of Scalar Functions in Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sun, 11 Jun 2023 19:56:01 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/blog-post-3-exploration-of-scalar-functions-in-apache-age-2b6i</link>
      <guid>https://dev.to/waleedahmed0001/blog-post-3-exploration-of-scalar-functions-in-apache-age-2b6i</guid>
      <description>&lt;p&gt;In the previous blog posts, we discussed several scalar functions in Apache Age and their applications. In this final blog post, let's continue our exploration of scalar functions and conclude our journey through Apache Age.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. last()
&lt;/h2&gt;

&lt;p&gt;The last() function returns the last element in an agtype list. It takes an expression that returns a list as an argument and returns the type of the value returned, which is the type of the last element of the list.&lt;/p&gt;

&lt;p&gt;Syntax: last(list)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
MATCH (a)
WHERE a.name = 'Eskil'
RETURN a.array, last(a.array)
$$) as (lst agtype, lst_tail agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      lst      | lst_tail
----------------+----------
 [1, 2, 3, 4]   | 4
 [5, 6, 7, 8]   | 8
 [9, 10, 11, 12]| 12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves a list from a vertex and returns the list itself and its last element.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. length()
&lt;/h2&gt;

&lt;p&gt;The length() function returns the length of a path. It takes an expression that returns a path as an argument and returns an agtype integer representing the length of the path.&lt;/p&gt;

&lt;p&gt;Syntax: length(path)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
   MATCH p = (a)-[]-&amp;gt;(b)-[]-&amp;gt;(c)
   WHERE a.name = 'Alice'
   RETURN length(p)
$$) as (length_of_path agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;length_of_path
----------------
               2
               3
               4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves all paths of length 2 or more from vertex Alice and returns the length of each path.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. size()
&lt;/h2&gt;

&lt;p&gt;The size() function returns the length of a list. It takes an expression that returns a list as an argument and returns an agtype integer representing the length of the list.&lt;/p&gt;

&lt;p&gt;Syntax: size(list)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN size(['Alice', 'Bob', 'Charlie'])
$$) as (size_of_list agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; size_of_list
-------------
            3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query returns the length of the given list, which is 3 in this case.&lt;/p&gt;

&lt;p&gt;With these additional scalar functions, developers and data scientists can further enhance their graph querying and analysis capabilities in Apache Age.&lt;/p&gt;

&lt;p&gt;We conclude our exploration of scalar functions in Apache Age. We hope you found these blog posts informative and useful for understanding the power and versatility of scalar functions in Apache Age.&lt;/p&gt;

&lt;h2&gt;
  
  
  Previous Blogs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/waleedahmed0001/blog-post-1-scalar-functions-in-apache-age-53kj"&gt;Blog post 1 on Scalar Functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/waleedahmed0001/blog-post-2-more-scalar-functions-in-apache-age-1l9h"&gt;Blog post 2 on Scalar Functions&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>pgsql</category>
      <category>functions</category>
      <category>database</category>
    </item>
    <item>
      <title>Blog Post 2: More Scalar Functions in Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sun, 11 Jun 2023 19:49:27 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/blog-post-2-more-scalar-functions-in-apache-age-1l9h</link>
      <guid>https://dev.to/waleedahmed0001/blog-post-2-more-scalar-functions-in-apache-age-1l9h</guid>
      <description>&lt;p&gt;In the &lt;a href="https://dev.to/waleedahmed0001/blog-post-1-scalar-functions-in-apache-age-53kj"&gt;previous blog post&lt;/a&gt;, we discussed some scalar functions in Apache Age and their usage. In this post, let's continue our exploration of scalar functions and their capabilities in Apache Age.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. type()
&lt;/h2&gt;

&lt;p&gt;The type() function returns the string representation of the edge type. It takes an expression that evaluates to an edge as an argument and returns an agtype string representing the edge type.&lt;/p&gt;

&lt;p&gt;Syntax: type(edge)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH ()-[e]-&amp;gt;()
    RETURN type(e)
$$) as (type agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  type
---------
  knows
  likes
  works
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves the edge types of all edges in the graph and returns the results as agtype strings.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. properties()
&lt;/h2&gt;

&lt;p&gt;The properties() function returns an agtype map containing all the properties of a vertex or edge. It takes an expression that returns a vertex, edge, or agtype map as an argument and returns an agtype map representing the properties.&lt;/p&gt;

&lt;p&gt;Syntax: properties(element)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (a)
    RETURN properties(a)
$$) as (props agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                props
-------------------------------------
 {name: 'Alice', age: 30, city: 'NY'}
 {name: 'Bob', age: 25, city: 'LA'}
 {name: 'Charlie', age: 35, city: 'SF'}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves the properties of all vertices in the graph and returns the results as agtype maps.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. head()
&lt;/h2&gt;

&lt;p&gt;The head() function returns the first element in an agtype list. It takes an expression that returns a list as an argument and returns the type of the value returned, which is the type of the first element of the list.&lt;/p&gt;

&lt;p&gt;Syntax: head(list)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
   MATCH (a)
   WHERE a.name = 'Eskil'
   RETURN a.array, head(a.array)
$$) as (lst agtype, lst_head agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      lst      | lst_head
----------------+----------
 [1, 2, 3, 4]   | 1
 [5, 6, 7, 8]   | 5
 [9, 10, 11, 12]| 9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves a list from a vertex and returns the list itself and its first element.&lt;/p&gt;

&lt;p&gt;These scalar functions provide powerful capabilities for extracting and manipulating data in Apache Age. By leveraging these functions, developers and data scientists can perform advanced graph operations and gain valuable insights from the graph structure.&lt;/p&gt;

&lt;p&gt;Stay tuned for the next blog post, where we will explore more scalar functions in Apache Age!&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>pgsql</category>
      <category>functions</category>
      <category>database</category>
    </item>
    <item>
      <title>Blog Post 1: Scalar Functions in Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sun, 11 Jun 2023 19:41:57 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/blog-post-1-scalar-functions-in-apache-age-53kj</link>
      <guid>https://dev.to/waleedahmed0001/blog-post-1-scalar-functions-in-apache-age-53kj</guid>
      <description>&lt;p&gt;Scalar functions play an essential role in Apache Age, providing various capabilities to manipulate and retrieve data efficiently. In this blog post, we will explore some commonly used scalar functions in Apache Age and understand their syntax, arguments, and usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. id()
&lt;/h2&gt;

&lt;p&gt;The id() function returns the id of a vertex or edge. It takes an expression that returns a vertex or edge as an argument and returns an agtype integer representing the id.&lt;/p&gt;

&lt;p&gt;Syntax: id(expression)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (a)
    RETURN id(a)
$$) as (id agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; id
----
  1
  2
  3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves the id of all vertices in the graph and returns the results as an agtype integer.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. start_id()
&lt;/h2&gt;

&lt;p&gt;The start_id() function returns the id of the vertex that is the starting vertex for the edge. It takes an expression that evaluates to an edge as an argument and returns an agtype integer representing the start id.&lt;/p&gt;

&lt;p&gt;Syntax: start_id(expression)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH ()-[e]-&amp;gt;()
    RETURN start_id(e)
$$) as (start_id agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; start_id
----------
        1
        2
        1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves the start ids of all edges in the graph and returns the results as agtype integers.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. end_id()
&lt;/h2&gt;

&lt;p&gt;The end_id() function returns the id of the vertex that is the ending vertex for the edge. It takes an expression that evaluates to an edge as an argument and returns an agtype integer representing the end id.&lt;/p&gt;

&lt;p&gt;Syntax: end_id(expression)&lt;/p&gt;

&lt;p&gt;Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH ()-[e]-&amp;gt;()
    RETURN end_id(e)
$$) as (end_id agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; end_id
--------
      2
      3
      4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query retrieves the end ids of all edges in the graph and returns the results as agtype integers.&lt;/p&gt;

&lt;p&gt;These scalar functions provide valuable insights into the graph structure by extracting specific information about vertices and edges. They serve as building blocks for more complex graph queries and analytics tasks in Apache Age.&lt;/p&gt;

&lt;p&gt;Stay tuned for the next blog post, where we will explore more scalar functions in Apache Age!&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>pgsql</category>
      <category>scalarfunctio</category>
      <category>database</category>
    </item>
    <item>
      <title>Understanding ORDER BY in Cypher: Sorting Results in Apache ageDB</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Fri, 26 May 2023 22:36:44 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/understanding-order-by-in-cypher-sorting-results-in-apache-agedb-a3m</link>
      <guid>https://dev.to/waleedahmed0001/understanding-order-by-in-cypher-sorting-results-in-apache-agedb-a3m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In Apache ageDB, the ORDER BY clause plays a crucial role in sorting query results based on specified criteria. However, it's important to note that ORDER BY operates exclusively on properties of nodes and relationships rather than the nodes or relationships themselves. This blog post will delve into the intricacies of ORDER BY in Apache ageDB and provide examples of its usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scope of Variables in ORDER BY
&lt;/h2&gt;

&lt;p&gt;The scope of variables in the ORDER BY clause depends on whether the preceding RETURN or WITH clause is aggregating or DISTINCT. In the case of an aggregating or DISTINCT projection, only variables available within the projection can be utilized. However, if the projection does not change the output cardinality, variables from before the projecting clause are also accessible. When shadowing existing variables, only the new variables become available.&lt;/p&gt;

&lt;p&gt;Furthermore, it's important to note that using aggregating expressions in the ORDER BY sub-clause is only allowed if they are also listed in the projecting clause. This restriction ensures that ORDER BY solely alters the order of the results and does not affect the outcome itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ordering Nodes by a Single Property
&lt;/h2&gt;

&lt;p&gt;To sort nodes by a specific property, the ORDER BY clause is employed. Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    WITH n.name AS name, n.age AS age
    ORDER BY n.name
    RETURN name, age
$$) AS (name agtype, age agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, nodes are returned sorted in ascending order based on their "name" property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Result

name    age
"A" 34
"B" 34
"C" 32
(1 row)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ordering Nodes by Multiple Properties
&lt;/h2&gt;

&lt;p&gt;Apache ageDB allows sorting by multiple properties. By listing each variable in the ORDER BY clause, the result set can be sorted based on a priority order. If values in the first property are equal, the sorting continues based on the subsequent properties listed. Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    WITH n.name AS name, n.age AS age
    ORDER BY n.age, n.name
    RETURN name, age
$$) AS (name agtype, age agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query sorts nodes first by their "age" property and then by their "name" property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Result

name    age
"C" 32
"A" 34
"B" 34
(1 row)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ordering Nodes in Descending Order:
&lt;/h2&gt;

&lt;p&gt;To sort nodes in descending order, the DESC or DESCENDING keyword is appended to the ORDER BY clause. Let's consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    WITH n.name AS name, n.age AS age
    ORDER BY n.name DESC
    RETURN name, age
$$) AS (name agtype, age agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, nodes are sorted in reverse order based on their "name" property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Result

name    age
"C" 32
"B" 34
"A" 34
(3 rows)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Handling Null Values in Ordering
&lt;/h2&gt;

&lt;p&gt;When sorting result sets, null values are treated differently depending on the sorting order. For ascending sorting, null values appear at the end of the result set, whereas they appear first in descending sorting. Consider the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    WITH n.name AS name, n.age AS age, n.height
    ORDER BY n.height
    RETURN name, age, height
$$) AS (name agtype, age agtype, height agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, nodes are sorted based on their "height" property, with nodes lacking that property appearing last in the ascending order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Results

name    age height
"A" 34  170
"C" 32  185
"B" 34  &amp;lt;NULL&amp;gt;
(3 rows)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding how to sort query results using the ORDER BY clause is essential in Apache ageDB. By leveraging ORDER BY, you can arrange results based on specific&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>pgsql</category>
      <category>graphql</category>
      <category>orderby</category>
    </item>
    <item>
      <title>Delete and Detach Delete Command in Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Tue, 23 May 2023 07:53:42 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/delete-and-detach-delete-command-in-apache-age-o7i</link>
      <guid>https://dev.to/waleedahmed0001/delete-and-detach-delete-command-in-apache-age-o7i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Data management is a critical aspect of any database system, and Apache Age provides powerful features to handle data manipulation effectively. Two essential operations for data removal in Apache Age are DELETE and DETACH DELETE. In this article, we will explore these operations and demonstrate their usage through queries and their corresponding results.&lt;/p&gt;

&lt;h2&gt;
  
  
  DELETE Operation:
&lt;/h2&gt;

&lt;p&gt;The DELETE operation in Apache Age is used to remove specific records from a graph. It permanently deletes the specified vertices and edges from the graph. Let's consider a simple example of a social network graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (alice:Person {name: 'Alice'})
CREATE (bob:Person {name: 'Bob'})
CREATE (charlie:Person {name: 'Charlie'})

CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(bob)
CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(charlie)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if we want to delete the relationship between Alice and Bob, we can use the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE
MATCH (alice:Person {name: 'Alice'})-[r:FRIENDS_WITH]-&amp;gt;(bob:Person {name: 'Bob'})
DELETE r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above query will delete the friendship relationship between Alice and Bob. The result would be as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (alice:Person {name: 'Alice'})-[r:FRIENDS_WITH]-&amp;gt;(bob:Person {name: 'Bob'})
RETURN alice, bob, r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alice = Person {name: 'Alice'}
bob = Person {name: 'Bob'}
r = NULL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As seen in the result, the relationship r no longer exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  DETACH DELETE Operation:
&lt;/h2&gt;

&lt;p&gt;The DETACH DELETE operation in Apache Age removes specified vertices and edges from the graph, along with any relationships they have. Unlike DELETE, DETACH DELETE also removes the relationships associated with the deleted vertices. Let's consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (alice:Person {name: 'Alice'})
CREATE (bob:Person {name: 'Bob'})
CREATE (charlie:Person {name: 'Charlie'})

CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(bob)
CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(charlie)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To delete the vertex representing Charlie and any relationships associated with it, we can use the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (charlie:Person {name: 'Charlie'})
DETACH DELETE charlie
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above query will delete Charlie's vertex and all relationships associated with it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Error:
&lt;/h2&gt;

&lt;p&gt;Apache Age provides robust error handling mechanisms to ensure data integrity and consistency within graph databases. When attempting to delete a vertex that has existing edges connected to it, the DELETE operation in Apache Age will raise an error. In this article, we will explore this scenario and explain how to handle such errors gracefully.&lt;/p&gt;

&lt;p&gt;Let's consider a social network graph example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (alice:Person {name: 'Alice'})
CREATE (bob:Person {name: 'Bob'})
CREATE (charlie:Person {name: 'Charlie'})

CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(bob)
CREATE (alice)-[:FRIENDS_WITH]-&amp;gt;(charlie)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if we try to delete the vertex representing Alice using the DELETE operation, which has existing edges connected to it, Apache Age will raise an error. The following query illustrates this scenario:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE
MATCH (alice:Person {name: 'Alice'})
DELETE alice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Unable to delete node `alice` because it still has relationships.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As seen in the result, Apache Age raises an error stating that the deletion is not possible due to existing relationships connected to the vertex.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Handling:
&lt;/h2&gt;

&lt;p&gt;To handle this error gracefully, we can use the DETACH DELETE operation instead of DELETE. The DETACH DELETE operation will remove the specified vertex and its associated relationships. Let's modify the query to use DETACH DELETE:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (alice:Person {name: 'Alice'})
DETACH DELETE alice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using DETACH DELETE, Apache Age removes the vertex and its relationships without raising an error, ensuring data consistency within the graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In Apache Age, attempting to delete a vertex with existing edges using the DELETE operation will raise an error. To handle this situation gracefully, it is recommended to use the DETACH DELETE operation, which removes the vertex along with its relationships. By understanding how to handle errors effectively, developers and database administrators can maintain the integrity of their graph databases and handle data removal operations seamlessly.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>apacheage</category>
    </item>
    <item>
      <title>Predicate Functions</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Fri, 28 Apr 2023 18:47:50 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/predicate-functions-4lhm</link>
      <guid>https://dev.to/waleedahmed0001/predicate-functions-4lhm</guid>
      <description>&lt;p&gt;In the world of graph databases, predicates are essential for filtering and refining query results. Predicates are boolean functions that evaluate input data and return true or false, depending on whether the input meets certain criteria. In this blog post, we'll take a closer look at two types of predicates - exists() with a property argument and exists() with a path argument.&lt;/p&gt;

&lt;h2&gt;
  
  
  exists() with a property argument:
&lt;/h2&gt;

&lt;p&gt;The exists() function with a property argument returns true if the specified property exists in the node, relationship, or map. It is different from the EXISTS clause, which is used to check the existence of a subquery result. The exists() function is typically used to filter out subgraphs in the WHERE part of a query.&lt;/p&gt;

&lt;p&gt;The syntax for using exists() with a property argument is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exists(property)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's an example of how to use exists() with a property argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
     MATCH (n)
     WHERE exists(n.surname)
     RETURN n.first_name, n.last_name
$$) as (first_name agtype, last_name agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query returns all nodes that have a surname property, along with their first_name and last_name values.&lt;/p&gt;

&lt;h2&gt;
  
  
  exists() with a path argument:
&lt;/h2&gt;

&lt;p&gt;The exists() function with a path argument returns true if there already exists the given path in the graph. This predicate is useful for filtering nodes that are connected to a specific node through a given path.&lt;/p&gt;

&lt;p&gt;The syntax for using exists() with a path argument is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exists(path)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's an example of how to use exists() with a path argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
     MATCH (n)
     WHERE exists(n)-[]-(name: 'Willem Defoe')
     RETURN n.full_name
$$) as (full_name agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query returns all nodes that have a path to a node with the name property equal to 'Willem Defoe', along with their full_name values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In conclusion, predicates are a powerful tool for filtering and refining query results in graph databases. Whether you're using exists() with a property argument or exists() with a path argument, understanding how these predicates work can help you write more efficient and effective queries.&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>postgres</category>
      <category>apacheage</category>
    </item>
    <item>
      <title>Transforming SQL Data Into Apache Age: Family Example</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Thu, 27 Apr 2023 20:08:36 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/transforming-sql-data-into-apache-age-family-example-3kl8</link>
      <guid>https://dev.to/waleedahmed0001/transforming-sql-data-into-apache-age-family-example-3kl8</guid>
      <description>&lt;p&gt;When it comes to data management, relational databases have been the go-to solution for decades. However, in recent years, there has been a surge in popularity for graph databases, which allow for more complex data relationships to be easily queried and analyzed. One such graph database is Apache Age, which is built on top of PostgreSQL and allows for SQL-like queries to be used alongside graph traversal. In this post, we will explore how to transform data from a relational database into Apache Age format using a simple example of people and their relationships.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL:
&lt;/h2&gt;

&lt;p&gt;In sql we first need to define the table structure using this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE people (
  id SERIAL PRIMARY KEY,
  name VARCHAR(255) NOT NULL,
  gender VARCHAR(10) NOT NULL,
  birth_date DATE NOT NULL
);

CREATE TABLE relative (
  id SERIAL PRIMARY KEY,
  person_id INTEGER REFERENCES people(id),
  relative_id INTEGER REFERENCES people(id),
  relationship VARCHAR(50) NOT NULL
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The people table contains information about each individual, including their name, gender, and birth date. The relative table is used to store relationships between people. Each entry in the relative table includes the IDs of two individuals, their relationship to each other, and a unique ID for the relationship.&lt;/p&gt;

&lt;p&gt;Now, let's say we have the following data to insert into our tables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO people (name, gender, birth_date) VALUES
('Alice', 'F', '1990-01-01'),
('Bob', 'M', '1995-02-01'),
('Charlie', 'M', '1980-05-01'),
('David', 'M', '1970-10-01'),
('Eve', 'F', '1985-12-01');

INSERT INTO relative (person_id, relative_id, relationship) VALUES
(1, 2, 'sibling'),
(1, 5, 'parent'),
(3, 4, 'sibling'),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we have 5 people with various relationships to each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Apache Age:
&lt;/h2&gt;

&lt;p&gt;To transform this data into Apache Age format, we can use the following queries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- Create graph
SELECT create_graph('graph');

-- Insert people as nodes
SELECT * FROM cypher('graph', $$
  CREATE (:person {id: 1, name: 'Alice', gender: 'F', birth_date: '1990-01-01'}),
         (:person {id: 2, name: 'Bob', gender: 'M', birth_date: '1995-02-01'}),
         (:person {id: 3, name: 'Charlie', gender: 'M', birth_date: '1980-05-01'}),
         (:person {id: 4, name: 'David', gender: 'M', birth_date: '1970-10-01'}),
         (:person {id: 5, name: 'Eve', gender: 'F', birth_date: '1985-12-01'})
$$) AS (n agtype);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to enter the relationships:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT * FROM cypher('graph', $$
  MATCH (a:person), (b:person)
  WHERE a.id = 1 AND (b.id = 2 OR b.id = 4)
  CREATE (a)-[e:rel {type: 'sibling'}]-&amp;gt;(b)
  RETURN e
$$) AS (v agtype);

SELECT * FROM cypher('graph', $$
  MATCH (a:person), (b:person)
  WHERE a.id = 1 AND (b.id = 5)
  CREATE (a)-[e:rel {type: 'parent'}]-&amp;gt;(b)
  RETURN e
$$) AS (v agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In conclusion, transforming data from SQL to Apache Age can be done using simple queries and is a powerful way to take advantage of graph databases. By converting relational data into a graph format, we can easily perform complex queries and gain new insights into the relationships between data points. With Apache Age's built-in graph analytics functions, we can go beyond simple data retrieval and perform advanced analysis to unlock the full potential of our data. By leveraging the benefits of graph databases, we can create more intelligent applications and make better, data-driven decisions.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Importing data from CSV to Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Thu, 27 Apr 2023 19:14:31 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/importing-data-from-csv-to-apache-age-39kp</link>
      <guid>https://dev.to/waleedahmed0001/importing-data-from-csv-to-apache-age-39kp</guid>
      <description>&lt;p&gt;Importing data from CSV files is a common task in graph databases, and Apache AGE is no exception. In this article, we will explain how to import data from CSV files in Apache AGE. We will cover the following topics:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Functions to load graphs from files&lt;/li&gt;
&lt;li&gt;CSV file structure for loading vertices and edges&lt;/li&gt;
&lt;li&gt;Example code to load countries and cities from files&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Functions to load graphs from files:
&lt;/h2&gt;

&lt;p&gt;Before we dive into loading data from CSV files, it's important to understand the functions available in Apache AGE to create graphs from files. Here are the two main functions you will use to load data from CSV files:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;load_labels_from_file:&lt;/strong&gt; This function is used to load vertices from CSV files.&lt;br&gt;
&lt;strong&gt;load_edges_from_file:&lt;/strong&gt; This function is used to load edges from CSV files.&lt;br&gt;
To use these functions, you must first create a graph and labels. Once you have your graph and labels set up, you can use these functions to load data from CSV files.&lt;/p&gt;

&lt;p&gt;Here's an example of how to use load_labels_from_file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;load_labels_from_file('&amp;lt;graph name&amp;gt;', '&amp;lt;label name&amp;gt;', '&amp;lt;file path&amp;gt;')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's an example of how to use load_edges_from_file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;load_edges_from_file('&amp;lt;graph name&amp;gt;', '&amp;lt;label name&amp;gt;', '&amp;lt;file path&amp;gt;')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CSV file structure for loading vertices and edges:
&lt;/h2&gt;

&lt;p&gt;Now that you know how to use the functions to load data from CSV files, it's important to understand the structure of the CSV files themselves. Here's an overview of the CSV file structure for loading vertices and edges:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSV file for vertices:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;id:&lt;/strong&gt; This is the first column of the file and all values shall be a positive integer. This is an optional field when id_field_exists is false. However, it should be present when id_field_exists is not set to false.&lt;br&gt;
&lt;strong&gt;Properties:&lt;/strong&gt; All other columns contain the properties for the vertices. The header row shall contain the name of each property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSV file for edges:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;start_id:&lt;/strong&gt; This is the node ID of the node from where the edge starts. This ID shall be present in the nodes.csv file.&lt;br&gt;
&lt;strong&gt;start_vertex_type:&lt;/strong&gt; This is the class of the node from where the edge starts.&lt;br&gt;
&lt;strong&gt;end_id:&lt;/strong&gt; This is the end ID of the node at which the edge terminates.&lt;br&gt;
&lt;strong&gt;end_vertex_type:&lt;/strong&gt; This is the class of the node at which the edge terminates.&lt;br&gt;
&lt;strong&gt;properties:&lt;/strong&gt; These are the properties of the edge. The header shall contain the property name.&lt;br&gt;
Example code to load countries and cities from files&lt;/p&gt;

&lt;p&gt;Now that you understand the functions and CSV file structure, let's take a look at an example of how to load countries and cities from files in Apache AGE.&lt;/p&gt;

&lt;p&gt;First, we'll create a graph and two labels: Country and City:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE GRAPH mygraph;
CREATE LABEL Country;
CREATE LABEL City;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we'll load the vertices from two CSV files: countries.csv and cities.csv:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;load_labels_from_file('mygraph', 'Country', 'countries.csv');
load_labels_from_file('mygraph', 'City', 'cities.csv');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we'll load the edges from a CSV file called city_country.csv:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;load_edges_from_file('mygraph', 'City', 'city_country.csv');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! Now you have a graph with countries, cities, and the relationships between them loaded from CSV files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In conclusion, Apache AGE provides easy and efficient ways to load graph data from CSV files. By following the instructions outlined in this article, users can create graphs, load vertices and edges from CSV files, and specify the file formats for the data. This is a powerful feature for data analysts and developers who need to quickly load and analyze large amounts of graph data. With Apache AGE, users can focus on their data analysis and development tasks without having to worry about the underlying database infrastructure.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
      <category>database</category>
    </item>
    <item>
      <title>Basics for Querying Apache Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sun, 23 Apr 2023 18:37:59 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/basics-for-querying-apache-age-1mh7</link>
      <guid>https://dev.to/waleedahmed0001/basics-for-querying-apache-age-1mh7</guid>
      <description>&lt;p&gt;Apache Age is a graph database that uses Apache Arrow as a storage layer. It provides an easy way to store, manage and query graph data. In this blog, we will be discussing the basics of writing Cypher queries in Apache Age.&lt;/p&gt;

&lt;p&gt;Cypher is a declarative query language used for querying and manipulating graph data. It is used in Apache Age, a graph database built on top of PostgreSQL. Cypher queries are used to interact with graph data, which is represented as nodes and edges.&lt;/p&gt;

&lt;p&gt;To get started with writing Cypher queries in Apache Age, we can create a graph database and add some data to it.&lt;/p&gt;

&lt;p&gt;Before we dive into the queries, let's understand some terminologies that are used in Apache Age.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vertex:&lt;/strong&gt; A vertex represents an entity in a graph. For example, a person, a place, a thing, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edge:&lt;/strong&gt; An edge represents a relationship between two vertices.&lt;br&gt;
Label: A label is a way of grouping vertices based on their characteristics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Property:&lt;/strong&gt; A property is a key-value pair that can be associated with a vertex or an edge.&lt;/p&gt;

&lt;p&gt;Now, let's write some basic Cypher queries in Apache Age.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a Vertex:&lt;/strong&gt;&lt;br&gt;
To create a vertex in Apache Age, we use the CREATE clause. The following query creates a vertex labeled as Person and adds two properties to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (:Person {name: 'John Doe', age: 30})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating Multiple Vertices:&lt;/strong&gt;&lt;br&gt;
We can create multiple vertices using a single query. The following query creates four vertices labeled as Person and adds two properties to each vertex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (:Person {name: 'John Doe', age: 30}),
       (:Person {name: 'Jane Doe', age: 25}),
       (:Person {name: 'Bob Smith', age: 45}),
       (:Person {name: 'Alice Smith', age: 40})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating a Relationship:&lt;/strong&gt;&lt;br&gt;
To create a relationship between two vertices, we use the CREATE clause along with the MATCH clause. The MATCH clause is used to match the vertices that we want to create a relationship between. The following query creates a relationship between two vertices labeled as Person.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (p1:Person), (p2:Person)
WHERE p1.name = 'John Doe' AND p2.name = 'Jane Doe'
CREATE (p1)-[:FRIENDS]-&amp;gt;(p2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating a Labeled Vertex:&lt;/strong&gt;&lt;br&gt;
To create a vertex with a label, we use the CREATE clause and specify the label along with the properties. The following query creates a vertex labeled as Country and adds a name property to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE (:Country {name: 'USA'})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating a Relationship with Labeled Vertices:&lt;/strong&gt;&lt;br&gt;
To create a relationship between two labeled vertices, we use the CREATE clause along with the MATCH clause. The MATCH clause is used to match the vertices that we want to create a relationship between. The following query creates a relationship between a Person and a Country vertex.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (p:Person), (c:Country)
WHERE p.name = 'John Doe' AND c.name = 'USA'
CREATE (p)-[:BORN_IN]-&amp;gt;(c)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In this blog, we have discussed the basics of writing Cypher queries in Apache Age. We have learned how to create vertices, relationships, labeled vertices, and relationships between labeled vertices. These are the basic building blocks of any graph database. With these basic queries, you can start building your own graph database and perform more complex operations on it.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
      <category>basics</category>
    </item>
    <item>
      <title>Visualizations in Apache-Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sun, 16 Apr 2023 19:28:47 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/visualizations-in-apache-age-2o6g</link>
      <guid>https://dev.to/waleedahmed0001/visualizations-in-apache-age-2o6g</guid>
      <description>&lt;p&gt;Apache Age is an open-source graph database that supports the Cypher query language. It allows users to store and query graph data using Cypher queries. One of the advantages of Apache Age is its ability to provide visualization of graph data. In this article, we will discuss the visualizations available in Apache Age.&lt;/p&gt;

&lt;p&gt;Apache Age allows users to customize the visualization of their data. The first customization is the form in which the data is presented, either in a table or a graph. Users can pass the data to Apache Age using Cypher queries, and then use the graph or table visualization to view the data.&lt;/p&gt;

&lt;p&gt;For example, let's say we have the following data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;` #These queries to make a label of Person and then adding properties to it.
CREATE (n:Person {name : "imran", bornIn : "Pakistan"})
CREATE (n:Person {name : "ali", bornIn : "Pakistan"})
CREATE (n:Person {name : "usama", bornIn : "Pakistan"})
CREATE (n:Person {name : "akabr", bornIn : "Pakistan"})
CREATE (n:Person {name : "james", bornIn : "US"})
CREATE (n:Person {name : "david", bornIn : "US"})

# These queries to make a label of COuntry and adding name property to it.
CREATE (n:Country{name : "Pakistan"})
CREATE (n:Country{name : "US"})

#Relationship between these two vertexes
MATCH (a:Person), (b:Country) WHERE a.bornIn = b.name CREATE (a)-[r:BORNIN]-&amp;gt;(b) RETURN r
`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can then visualize this data in a graph form as shown below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apache Age Graph Visualization:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mIPATo5l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dei78tqkgcjztm9ta3fo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mIPATo5l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dei78tqkgcjztm9ta3fo.png" alt="Apache Age Graph Form" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also visualize the same data in a table form as shown below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apache Age Table Visualization:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NrxrXQhG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rp7k6k1j3wpv37ddw3qp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NrxrXQhG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rp7k6k1j3wpv37ddw3qp.png" alt="Apache Age Table Form" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Color Customization:&lt;/strong&gt;&lt;br&gt;
Apache Age also allows users to customize the colors of nodes and edges by clicking on them. Users can also change the size and type of caption written on the nodes or edges.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F7Fb4P_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvedmezp32vpheh44cis.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F7Fb4P_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvedmezp32vpheh44cis.png" alt="Color visualizations" width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can add extra information by changing the query. For example, in the graph visualization shown above, we changed the edge connection label to gid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U59z5Aeo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4c2zoygt6as3inxftq4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U59z5Aeo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4c2zoygt6as3inxftq4x.png" alt="Graph Connection" width="507" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layout:&lt;/strong&gt;&lt;br&gt;
Additionally, Apache Age provides layout options such as Klay, Euler and Cose Bikent etc that allow users to change the graph view.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---zVwtccJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw16sbrk6csla1cdxjzo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---zVwtccJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw16sbrk6csla1cdxjzo.png" alt="Layout Option" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In conclusion, Apache Age provides users with customizable visualization options for their graph data. Users can choose to view their data in either a graph or table form and can customize the colors, size, and type of caption written on the nodes and edges. Apache Age's layout options provide users with additional options to view their data in various ways.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>visualizations</category>
      <category>design</category>
    </item>
    <item>
      <title>Hooks</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Sat, 25 Mar 2023 19:03:20 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/hooks-3041</link>
      <guid>https://dev.to/waleedahmed0001/hooks-3041</guid>
      <description>&lt;p&gt;MariaDB is a popular open-source relational database management system that is used by many organizations and individuals around the world. One of the key features of MariaDB is its support for hooks, which allow developers to extend the functionality of the database and customize its behavior to suit their specific needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are Hooks?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hooks are essentially pieces of code that are included in an application to allow external extensions or add-ons to modify the behavior of the application. Hooks are designed to be triggered at specific points in the application's code execution, allowing extensions to inject their own code or modify the existing code to achieve the desired behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hooks in MariaDB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MariaDB includes several hooks that allow developers to extend the functionality of the database and customize its behavior. These hooks are organized into several categories, each of which corresponds to a specific point in the database's operation.&lt;/p&gt;

&lt;p&gt;The following are some of the most important hooks in MariaDB:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Initialization Hooks&lt;/strong&gt;&lt;br&gt;
Initialization hooks are used to perform actions when the database is initialized or shutdown. For example, an initialization hook could be used to set up a connection to an external service when the database starts up, or to perform some cleanup tasks when the database shuts down.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Storage Engine Hooks&lt;/strong&gt;&lt;br&gt;
Storage engine hooks are used to customize the behavior of storage engines in MariaDB. Storage engines are responsible for managing the storage and retrieval of data in the database, and hooks can be used to modify or extend the functionality of these engines. For example, a storage engine hook could be used to add support for a new type of data storage, or to modify the behavior of an existing storage engine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Query Execution Hooks&lt;/strong&gt;&lt;br&gt;
Query execution hooks are used to modify the behavior of queries in MariaDB. These hooks are triggered when a query is executed, and can be used to modify the query, add additional processing steps, or perform other operations. For example, a query execution hook could be used to add additional security checks to a query, or to modify the query to improve performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authentication Hooks&lt;/strong&gt;&lt;br&gt;
Authentication hooks are used to modify the authentication process used by MariaDB. These hooks are triggered when a user attempts to log in to the database, and can be used to modify the authentication process, perform additional security checks, or integrate with external authentication systems. For example, an authentication hook could be used to integrate MariaDB with an external LDAP server for user authentication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Replication Hooks&lt;/strong&gt;&lt;br&gt;
Replication hooks are used to customize the behavior of replication in MariaDB. Replication is the process of copying data from one database to another, and hooks can be used to modify or extend this process. For example, a replication hook could be used to modify the data being replicated, or to add additional processing steps to the replication process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Hooks in MariaDB&lt;/strong&gt;&lt;br&gt;
Hooks in MariaDB offer several benefits for developers and users of the database:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Customization: Hooks allow developers to customize the behavior of MariaDB to suit their specific needs, without having to modify the core source code of the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extension: Hooks allow developers to extend the functionality of MariaDB by adding new features or integrating with external systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration: Hooks allow MariaDB to integrate with external systems and services, making it more flexible and useful in a wide range of applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maintenance: Hooks make it easier to maintain and upgrade MariaDB, as customizations and extensions can be implemented as separate modules that can be updated independently of the core database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Hooks are a powerful tool for extending the functionality of MariaDB and customizing its behavior to suit specific needs. With its extensive support for hooks, MariaDB offers developers and users a flexible and powerful database management system that can be customized to meet the needs of virtually any application&lt;/p&gt;

</description>
      <category>hooks</category>
      <category>apacheage</category>
      <category>mariadb</category>
    </item>
    <item>
      <title>Features of Apache-Age</title>
      <dc:creator>WALEED SHAHID</dc:creator>
      <pubDate>Thu, 23 Mar 2023 14:12:24 +0000</pubDate>
      <link>https://dev.to/waleedahmed0001/features-of-apache-age-2gpp</link>
      <guid>https://dev.to/waleedahmed0001/features-of-apache-age-2gpp</guid>
      <description>&lt;p&gt;Apache Age is an open-source extension of PostgreSQL that provides a graph database functionality. Some of the key features of Apache Age include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Graph database functionality:&lt;/strong&gt;&lt;br&gt;
Apache Age allows users to store and manipulate graph data, which is useful for a wide range of applications, including social networks, recommendation engines, and knowledge graphs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Compatibility with PostgreSQL:&lt;/strong&gt;&lt;br&gt;
Apache Age is built on top of PostgreSQL, which is a well-established and widely used relational database management system. This means that users can leverage the scalability, reliability, and security features of PostgreSQL while also taking advantage of Apache Age's graph database functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Support for property graphs:&lt;/strong&gt;&lt;br&gt;
Apache Age supports property graphs, which are a common graph data model that allows users to associate arbitrary key-value pairs with nodes and edges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Cypher query language:&lt;/strong&gt; &lt;br&gt;
Apache Age supports the Cypher query language, which is a powerful and intuitive language for querying graph data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Integration with other tools:&lt;/strong&gt; &lt;br&gt;
Apache Age can be integrated with a wide range of other tools and technologies, including Apache Spark, Apache Kafka, and Apache Hadoop, which makes it a versatile and flexible option for a wide range of applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Open source and community-driven:&lt;/strong&gt; &lt;br&gt;
Apache Age is an open-source project, which means that anyone can contribute to its development and improvement. This also means that users can benefit from a vibrant and active community of developers and users who can provide support and guidance.&lt;/p&gt;

&lt;p&gt;For more learning, view these links&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://age.apache.org/"&gt;Apache Age (Website)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://age.apache.org/age-manual/master/intro/overview.html"&gt;Apache Age (Documentation)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;Apache Age (Source Code)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>apacheage</category>
      <category>opensource</category>
      <category>postgresq</category>
      <category>database</category>
    </item>
  </channel>
</rss>
