<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rahul Tasker on Medium]]></title>
        <description><![CDATA[Stories by Rahul Tasker on Medium]]></description>
        <link>https://medium.com/@rahultasker?source=rss-f1c81a20cb7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gwiJ8he3iHRHjBJTGsThqA.jpeg</url>
            <title>Stories by Rahul Tasker on Medium</title>
            <link>https://medium.com/@rahultasker?source=rss-f1c81a20cb7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:18:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahultasker/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[GraphRAG using Langchain and Oracle Graph on Oracle Database 23ai (Part 1)]]></title>
            <link>https://medium.com/oracledevs/graphrag-using-langchain-and-oracle-graph-on-oracle-database-23ai-part-1-dc76b48a4ca1?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc76b48a4ca1</guid>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[oracle-database-23ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Wed, 20 Nov 2024 18:28:36 GMT</pubDate>
            <atom:updated>2024-11-27T16:01:44.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MxiJPn3OywDF9ESSkfTxeg.png" /></figure><p>In the new world of Generative AI, businesses are starting to recognize its power, and its shortcomings. AI is an incredibly powerful generation engine with a wealth of information, but it is limited to the information it was trained on, and has no insight into private business data. This means the Large Language Model (LLM) does not have any information on recent events, or your business data, which begs the question:</p><p><em>How can we use our data to get relevant responses from the LLM to make informed business decisions?</em></p><p>Some possible solutions are custom Generative Pre-trained Transformers (GPTs), Vector based Retrieval Augmented Generation (RAG), and Graph based Retrieval Augmented Generation (GraphRAG). Creating a custom GPT can be cumbersome, requiring extensive training to be useable, and still prone to errors when new data is constantly coming to the business, and the custom GPT is not re-trained on the new data, making maintenance a concern for many. RAG is a great option in some use cases but it lacks context and connection to what we know to be true. This is where graphs can be especially helpful.</p><p>Graphs can provide context for information retrieval to get more accurate results from the LLM. For more complex use cases, a combination of Vector and Graph based retrieval will be effective for getting high quality results from the LLM (will be shown in Part 2). However, for many use cases, retrieving information using Graphs alone will suffice.</p><p>In this article, we will run through some simple examples of how we can use SQL Property Graphs on Oracle Database 23ai with AI services like ChatGPT to provide more context for the LLM to answer questions. We will wrap this all into a neat package using Python with Langchain.</p><h4>Prerequisites</h4><ul><li>Jupyter notebook environment with Python 3.11 or higher.</li><li>You have the <a href="https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html">python-oracledb</a>, <a href="https://pypi.org/project/langchain/">langchain</a>, <a href="https://pypi.org/project/langchain-openai/">langchain_openai</a>, and <a href="https://pypi.org/project/langchain-core/">langchain_core</a> libraries installed.</li><li>You have access to a 23ai Oracle Database, with a <a href="https://docs.oracle.com/en/database/oracle/property-graph/24.4/spgdg/creating-sql-property-graph.html#GUID-8BF72892-12C6-4508-A5CB-7F22B4DDC2B7">graph enabled user</a>. If you do not, consider signing up for an <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-always-free.html">always free Autonomous Database</a> instance.</li><li>You have an OpenAI API key.</li></ul><h4><strong>Connect to your Database</strong></h4><p>To start, we will connect to our Oracle Database 23ai instance using the python-oracledb library.</p><ol><li>Launch your Jupyter notebook environment and create a new notebook.</li><li>In a new cell, import the python-oracledb library, create a new connection, and create a cursor for that connection. The cursor will be used to execute SQL statements and to show the results of SQL queries.</li></ol><pre>import oracledb<br><br>connection = oracledb.connect(<br>    user=&quot;&lt;your_user&gt;&quot;, <br>    password=&#39;&lt;your_password&gt;&#39;,<br>    dsn=&quot;&lt;your_connection_string&gt;&quot;<br>)<br><br>cursor = connection.cursor()</pre><h4>Create Tables and Load Data</h4><p>Next, we will create some tables and load some data. We will use these tables to create a graph, so we can query the graph for our GraphRAG solution. In this example, we will create three small sample tables, representing customers, movies, and the watching habits of each customer.</p><ol><li>In a new cell, execute the code below to create the following tables: MOVIES, MOVIES_CUSTOMER, and WATCHED_MOVIE.</li></ol><pre>create_movie_table = &quot;&quot;&quot;<br>    CREATE TABLE MOVIES (<br>        MOVIE_ID        NUMBER,<br>        TITLE           VARCHAR2(400),<br>        GENRES          JSON,<br>        SUMMARY         VARCHAR2(16000)<br>    )<br>&quot;&quot;&quot;<br><br>create_customer_table = &quot;&quot;&quot;<br>    CREATE TABLE MOVIES_CUSTOMER (<br>        CUST_ID        NUMBER,<br>        FIRSTNAME      VARCHAR(200),<br>        LASTNAME       VARCHAR(200)<br>    )<br>&quot;&quot;&quot;<br><br>create_watched_table = &quot;&quot;&quot;<br>    CREATE TABLE WATCHED_MOVIE (<br>        DAY_ID            TIMESTAMP(6),      <br>        MOVIE_ID          NUMBER,<br>        PROMO_CUST_ID     NUMBER<br>    )<br>&quot;&quot;&quot;<br><br>cursor.execute(create_movie_table)<br>cursor.execute(create_customer_table)<br>cursor.execute(create_watched_table)</pre><p>2. Execute the code below to insert some rows into the tables we just created.</p><pre>cursor.execute(&quot;&quot;&quot;<br>    INSERT INTO MOVIES (MOVIE_ID, TITLE, GENRES, SUMMARY) VALUES<br>        (1, &#39;Inception&#39;, &#39;{&quot;Action&quot;: &quot;Sci-Fi&quot;}&#39;, &#39;A thief who steals corporate secrets through the use of dream-sharing technology is given the inverse task of planting an idea into the mind of a C.E.O.&#39;),<br>        (2, &#39;The Matrix&#39;, &#39;{&quot;Action&quot;: &quot;Sci-Fi&quot;}&#39;, &#39;A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.&#39;),<br>        (3, &#39;The Godfather&#39;, &#39;{&quot;Drama&quot;: &quot;Crime&quot;}&#39;, &#39;The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.&#39;),<br>        (4, &#39;Titanic&#39;, &#39;{&quot;Romance&quot;: &quot;Drama&quot;}&#39;, &#39;A seventeen-year-old aristocrat falls in love with a kind but poor artist aboard the luxurious, ill-fated R.M.S. Titanic.&#39;),<br>        (5, &#39;Toy Story&#39;, &#39;{&quot;Animation&quot;: &quot;Adventure&quot;}&#39;, &#39;A cowboy doll is profoundly threatened and jealous when a new spaceman figure supplants him as top toy in a boy&#39;&#39;s room.&#39;)<br>&quot;&quot;&quot;)<br><br>cursor.execute(&quot;&quot;&quot;<br>    INSERT INTO MOVIES_CUSTOMER (CUST_ID, FIRSTNAME, LASTNAME) VALUES<br>        (101, &#39;John&#39;, &#39;Doe&#39;),<br>        (102, &#39;Jane&#39;, &#39;Smith&#39;),<br>        (103, &#39;Sam&#39;, &#39;Wilson&#39;),<br>        (104, &#39;Emily&#39;, &#39;Clark&#39;),<br>        (105, &#39;Michael&#39;, &#39;Johnson&#39;)<br>&quot;&quot;&quot;)<br><br>cursor.execute(&quot;&quot;&quot;<br>    INSERT INTO WATCHED_MOVIE (DAY_ID, MOVIE_ID, PROMO_CUST_ID) VALUES<br>        (TO_TIMESTAMP(&#39;2024-10-30 12:34:56.123456&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 1, 101),<br>        (TO_TIMESTAMP(&#39;2024-10-31 12:34:56.123456&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 2, 101),<br>        (TO_TIMESTAMP(&#39;2024-09-30 12:34:56.123456&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 3, 101),<br>        (TO_TIMESTAMP(&#39;2024-10-31 09:15:23.654321&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 2, 102),<br>        (TO_TIMESTAMP(&#39;2024-11-01 16:45:12.987654&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 3, 103),<br>        (TO_TIMESTAMP(&#39;2024-11-02 18:22:43.123456&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 4, 104),<br>        (TO_TIMESTAMP(&#39;2024-11-03 20:01:00.000000&#39;, &#39;YYYY-MM-DD HH24:MI:SS.FF&#39;), 5, 105)<br>&quot;&quot;&quot;)</pre><h4>Create a SQL Property Graph</h4><p>Next, we will create a SQL Property Graph using the tables we created as the vertex and edge tables.</p><p>In a new cell, execute the code below to create a property graph named <strong>CUSTOMER_WATCHED_MOVIES</strong>.</p><pre>cpg = &quot;&quot;&quot;<br>    CREATE PROPERTY GRAPH CUSTOMER_WATCHED_MOVIES<br>        VERTEX TABLES (<br>            MOVIES_CUSTOMER AS CUSTOMER<br>                KEY(CUST_ID),<br>            MOVIES AS MOVIE<br>                KEY(MOVIE_ID)<br>        )<br>        EDGE TABLES(<br>            WATCHED_MOVIE AS WATCHED<br>                KEY(DAY_ID, MOVIE_ID, PROMO_CUST_ID)<br>                SOURCE KEY (PROMO_CUST_ID) REFERENCES CUSTOMER(CUST_ID)<br>                DESTINATION KEY (MOVIE_ID) REFERENCES MOVIE(MOVIE_ID)<br>        )<br>&quot;&quot;&quot;<br>cursor.execute(cpg)</pre><p>In this example, the <em>MOVIES_CUSTOMER</em> and <em>MOVIES</em> tables will become vertices (or nodes). We can use the <em>AS</em> clause to change the label in the graph from <em>MOVIES_CUSTOMER</em> to <em>CUSTOMER</em> and <em>MOVIES</em> to <em>MOVIE. </em>Similarly, the <em>WATCHED_MOVIE</em> table will become the edge, and we can use the <em>AS</em> clause to change the label from <em>WATCHED_MOVIE</em> to <em>WATCHED.</em></p><p>Now, we can easily query the pattern modeled in this graph which is <em>customer watched movie</em>.</p><h4>Run a Sample Graph Query</h4><p>Now, we can run a simple SQL query to find what customers have watched which movies using graphs, and execute the query using the python-oracledb library.</p><p>Execute the code below to run a graph query and print each row in the result set.</p><pre>sample_graph_query = &quot;&quot;&quot;<br>    SELECT * FROM GRAPH_TABLE(CUSTOMER_WATCHED_MOVIES<br>        MATCH (c IS CUSTOMER) -[w IS WATCHED]-&gt; (m IS MOVIE)<br>        COLUMNS(c.FIRSTNAME AS FIRSTNAME, c.LASTNAME AS LASTNAME, m.TITLE AS MOVIE_TITLE, w.DAY_ID as DAY_WATCHED)<br>    )<br>&quot;&quot;&quot;<br>for row in cursor.execute(sample_graph_query):<br>    print(row)</pre><h4>Use SQL Property Graphs and Langchain to provide more context for Generative AI queries</h4><p>Let’s bring Langchain into the mix to create prompt templates, which we can use to provide more context from our SQL Property Graph queries to get specific answers from the LLM.</p><p><strong>Example 1 — Gain insights for every row in the result set.</strong></p><p>In a new cell, import the required Langchain libraries and set the LLM you want to use to get a response. This makes the LLM accessible through the Langchain library.</p><pre>from langchain_openai import ChatOpenAI<br><br># Set up OpenAI LLM<br>print (&quot;WARNING: The step will fail if the API key is not present or is incorrect.&quot;)<br>print (&quot;Please update the OpenAI_API_key before calling the llm the next step.&quot;)<br><br># set the LLM to get response<br>llm = ChatOpenAI(<br>  model_name=&#39;gpt-3.5-turbo-16k&#39;,<br>  temperature = 0.1,<br>  openai_api_key=&quot;&lt;your OpenAI API key&gt;&quot;,<br>  max_tokens=2000<br>)<br>print(&quot;The LLM model you will use is OpenAI ChatGPT 3.5&quot;)</pre><p>Now, let’s create a prompt template and chain.</p><p>A prompt template is a reproducible way to generate prompts. It allows us to create prompts based on existing statements that have placeholders for queries or field names. A chain is a series of automated actions that connect AI components to provide context-aware responses. Chains are a core concept of LangChain and are made up of links, which are each individual actions that are strung together.</p><p>In this example, we will use a prompt template to find the genre of a given movie based on the summary.</p><pre>from langchain_core.prompts import PromptTemplate<br><br># Create a prompt template<br>template = &quot;What is the genre of {movie} based on this summary: {summary}?&quot;<br>prompt = PromptTemplate.from_template(template)<br><br># Create a chain with the prompt and LLM<br>chain = prompt | llm</pre><p>Next, we can run a SQL Property Graph query, and invoke the chain based on the response. In this example we will answer the question</p><p><em>“For every movie that a customer has watched, what is the genre based on the movie summary?”</em></p><p>To do that, we first write a SQL Property Graph query to find all movies that were watched by a customer, and get the movie title and summary back as the result set. Then we can iterate through the result set and pass the data into the chain by referencing the placeholders in our prompt template.</p><pre># Define your SQL query<br>sql = &quot;&quot;&quot;<br>    SELECT DISTINCT MOVIE_TITLE, MOVIE_SUMMARY<br>    FROM GRAPH_TABLE( CUSTOMER_WATCHED_MOVIES<br>        MATCH (c1 IS CUSTOMER)-[e1 IS WATCHED]-&gt;(m IS MOVIE)<br>        COLUMNS (m.title as MOVIE_TITLE, m.summary as MOVIE_SUMMARY) <br>    )<br>&quot;&quot;&quot;<br><br># Execute the SQL query<br>cursor.execute(sql)<br><br># Fetch all rows from the executed query<br>rows = cursor.fetchall()<br># print(rows)<br><br><br># Print the results<br>for row in rows:<br>    # Run the chain and print the output<br>    result = chain.invoke({&#39;movie&#39;: row[0], &#39;summary&#39;: row[1]})<br>    print(result.content)</pre><p>You should see a response from the LLM, giving the genre for each movie in the result set.</p><p><strong>Example 2 — Analyze trends based on result set.</strong></p><p>Since we have the genre of the movies in our dataset, this might not be the most impactful query. So, let’s run another example where we ask the LLM to analyze the watching preferences of a user based on their viewing habits.</p><p>To do that, use a new prompt template, and query. Here, we will answer the following question by providing the result set of the watching habits of a given customer as context to the LLM.</p><p><em>“Based on this dataset of movies a customer has watched, containing movie titles, genres and summaries. How would you describe the movie watching preferences of this user?”</em></p><pre># Create a prompt template<br>template = &quot;Based on this dataset of movies a customer has watched, containing movie titles, genres and summaries. How would you describe the movie watching preferences of this user? {data}&quot;<br>prompt = PromptTemplate.from_template(template)<br><br>chain = prompt | llm<br><br># Define your SQL query<br>sql = &quot;&quot;&quot;<br>    SELECT DISTINCT MOVIE_TITLE, MOVIE_SUMMARY<br>    FROM GRAPH_TABLE( CUSTOMER_WATCHED_MOVIES<br>        MATCH (c1 IS CUSTOMER)-[e1 IS WATCHED]-&gt;(m IS MOVIE)<br>        WHERE c1.CUST_ID = 101<br>        COLUMNS (m.title as MOVIE_TITLE, m.summary as MOVIE_SUMMARY) <br>    )<br>&quot;&quot;&quot;<br><br># Execute the SQL query<br>cursor.execute(sql)<br><br># Fetch all rows from the executed query<br>rows = cursor.fetchall()<br># print(rows)<br><br>result = chain.invoke({&#39;data&#39;: rows})<br>print(result.content)</pre><p>You should see a response from the LLM, giving an analysis of customer 101’s viewing habits. This can be useful for making informed decisions on what types of movies customers tend to like, so we can provide tailored recommendations to them.</p><p><strong>Example 3 — Gain insights on a larger result set with less effort.</strong></p><p>Lastly, we can ask the LLM questions about a result set, which can reduce the amount of time spent writing queries. For example, you would likely need to do some aggregations if you want to answer the following question, which might be confusing if you are a new SQL user.</p><p><em>“Which user has watched the most movies?”</em></p><p>Instead of writing the full SQL or SQL Property Graph query that could answer this question, you can provide the result set to the LLM and ask the LLM to figure it out.</p><pre># Create a prompt template<br>template = &quot;Based on this dataset of movies that customers have watched, containing customer IDs, movie IDs and date watched, Which customer has watched the most movies? {data}&quot;<br>prompt = PromptTemplate.from_template(template)<br><br>chain = prompt | llm<br><br># Define your SQL query<br>sql = &quot;&quot;&quot;<br>    SELECT *<br>    FROM GRAPH_TABLE( CUSTOMER_WATCHED_MOVIES<br>        MATCH (c1 IS CUSTOMER)-[e1 IS WATCHED]-&gt;(m IS MOVIE)<br>        COLUMNS (c1.CUST_ID as customer_id, m.MOVIE_ID as movie_id, e1.DAY_ID as date_watched) <br>    )<br>&quot;&quot;&quot;<br><br># Execute the SQL query<br>cursor.execute(sql)<br><br># Fetch all rows from the executed query<br>rows = cursor.fetchall()<br># print(rows)<br><br>result = chain.invoke({&#39;data&#39;: rows})<br>print(result.content)</pre><p>You should see a response from the LLM, telling you which user has watched the most movies. This can be useful to quickly answer questions about your data without writing a detailed query, which can decrease time spent writing code, so the business gets the information it needs more quickly.</p><h4>Next Steps</h4><p>Congratulations! You have implemented a simple GraphRAG solution. You can learn more about SQL Property Graphs in the <a href="https://docs.oracle.com/en/database/oracle/property-graph/">Oracle Graph documentation</a>. Stay tuned for part 2 of this post, where we will incorporate vector search to further enhance this solution for complex use cases.</p><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc76b48a4ca1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/graphrag-using-langchain-and-oracle-graph-on-oracle-database-23ai-part-1-dc76b48a4ca1">GraphRAG using Langchain and Oracle Graph on Oracle Database 23ai (Part 1)</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Oracle Database 23c with Oracle Graph on Oracle Cloud Infrastructure]]></title>
            <link>https://medium.com/oracledevs/use-oracle-database-23c-with-oracle-graph-on-oracle-cloud-infrastructure-b5baf1d5ee65?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5baf1d5ee65</guid>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[oracle-23c]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Tue, 12 Mar 2024 19:30:27 GMT</pubDate>
            <atom:updated>2024-05-24T19:59:09.808Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBBIasZIpZABe0A1hIyHlA.png" /></figure><p>In this article, we will install (1) Create Oracle Database 23c on OCI Oracle Base Database Service, (2) Create a SQL Property Graph in SQL Developer, and (2) install Oracle Graph Server, using the Oracle Cloud Marketplace image, to visualize graph queries and run graph algorithms.</p><h3><strong>Prerequisites</strong></h3><p>- You have an Oracle Cloud Infrastructure account.<br>- Your OCI user has the necessary permissions to create databases and compute instances.<br>- You have created a virtual cloud network and public subnet with ports 22, 1521 and 7007 open for TCP protocol.<br>- You have a valid SSH key pair.<br>- You have SQL Developer installed.</p><h3>Provision Oracle Database 23c</h3><p>In this section, we will create an instance of Oracle Database 23c in the Cloud.</p><ol><li>Log into your OCI account.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*Oa3MeTNfKRvgATHYDID15A.png" /></figure><p>2. Navigate to Oracle Base Database Service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*75nrKR1cwrp6NzVnu56cLg.png" /></figure><p>3. Select the compartment you want to create your Database System in the click “Create DB system”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnOAWOg0MlWp7koyY-52fA.png" /></figure><p>4. In the “Create DB system” dialog, input the necessary configuration settings. For this, you will need an ssh public key, a VCN created in OCI, and a public subnet created with ports 22 and 7007 open for TCP protocol (see example below):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMkQeKCGYhDrVYK16nsbSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzLFGHl_6SZddsSPs7BuXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BWwoXWSV714DbID3-arQw.png" /></figure><p>5. Click “Next” and enter the Database information, then select “Change database Image”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0wXLiA7NJCiqt6-JrOZPg.png" /></figure><p>6. Change the database version to Oracle Database 23c, then click “Select”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_YZAhS7jC5dX5r7dAlYHQ.png" /></figure><p>7. Set a password for the sys user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ngPcFgSr4UC5EqICXxzkVg.png" /></figure><p>8. Click “Create DB system” to kick off the provisioning. The provisioning process can take a few minutes. When the database is available, your DB systems details page should look like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*cxM-Z5PM8S909LfXbwC8uA.png" /></figure><h3><strong>Connect to SQL Developer</strong></h3><p>In this section, we will create a connection in SQL Developer for your Oracle Database 23c running on Oracle Cloud Infrastructure.</p><ol><li>From your DB Systems dialog, scroll down, select <strong>Nodes</strong>, and copy the Public IP address. Save this in a notepad for now, we will use it later to connect from SQL Developer.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KOQR90EUbzdnjA3BdrzylA.png" /></figure><p>2. Select the Database from the same DB Systems page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZ-_QQG48mJq15dUt0qQhw.png" /></figure><p>3. Select the Pluggable Database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cz4c--sWOxHHvdS-eIa7Mg.png" /></figure><p>4. Select <strong>PDB connection</strong> and copy the final portion of the Easy Connect string after the “/”, starting with the PDB name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vu5YLrmzNN2_iysd2gYGpA.png" /></figure><p>5. Launch SQL Developer and create a new connection with the following information:<br><strong>Name</strong>: A meaningful name for this connection, so you can easily find it.<br><strong>Username</strong>: “Sys”<br><strong>Password</strong>: Password you created for your sys user.<br><strong>Role</strong>: “SYSDBA”<br><strong>Hostname</strong>: The IP Address you copied in step 1.<br><strong>Service name</strong>: The string you copied in step 4.<br><strong>Port</strong>: “1521”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuF6MqQQ1Lz1S96NvzB9YQ.png" /></figure><p>6. Test to ensure the connection is successful and connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*2GCWJaCZavCFzjbJsjyZQQ.png" /></figure><h3><strong>Create Graph User</strong></h3><p>It is not best practice to use the SYS user for development activities. So, in this section, we will create a graph enabled user, named GRAPHUSER.</p><ol><li>Open a SQL Worksheet with the connection you made in the previous steps and run the following statement to create a graph user.</li></ol><pre>CREATE USER GRAPHUSER IDENTIFIED BY &quot;WelcomE123!123!&quot;;</pre><p>2. Run the following statement to grant unlimited tablespace to the user.</p><pre>ALTER USER GRAPHUSER QUOTA UNLIMITED ON USERS;</pre><p>3. Run the following statement to grant the necessary graph privileges to the graph user.</p><pre>GRANT CREATE SESSION, CREATE TABLE, CREATE PROPERTY GRAPH, <br>CREATE ANY PROPERTY GRAPH, CREATE VIEW, CREATE MATERIALIZED VIEW, <br>ALTER ANY PROPERTY GRAPH, DROP ANY PROPERTY GRAPH, <br>READ ANY PROPERTY GRAPH, GRAPH_DEVELOPER TO GRAPHUSER;</pre><p>4. Create a new connection in SQL Developer with your graph user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57-SyZpT_64PeU8NfakyPQ.png" /></figure><p>5. Verify your connection by clicking “Test”, and if the status changes to “Success”, click “Connect”.</p><h3><strong>Load Data</strong></h3><p>SQL Property Graphs are created by making a graph view on relational tables, so the next step is to create the tables to hold the source data. In this section, we will load two tables to create a graph of bank accounts and transfers between those accounts.</p><ol><li>Download the sample <a href="https://github.com/oracle-samples/pgx-samples/blob/master/23c-graph-demos/BankGraphDataset/BANK_ACCOUNTS.csv">bank accounts</a> and <a href="https://github.com/oracle-samples/pgx-samples/blob/master/23c-graph-demos/BankGraphDataset/BANK_TRANSFERS.csv">bank transfers</a> datasets.</li><li>Let’s import the bank accounts dataset. In SQL Developer, right click on the Tables for your graph user and select “Import Data”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*DLaCuGfgoehFIaN-CRGs9A.png" /></figure><p>3. In the Data Import Wizard, select the BANK_ACCOUNTS.csv file you downloaded earlier, and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiyrUpFlT69Xzd1F4hTBlA.png" /></figure><p>4. Name the table “BANK_ACCOUNTS” and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCtGr0xFnlaSNo1r1LzJ7Q.png" /></figure><p>5. Verify that all three columns are selected and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsxg2pd2M579g0hj971xWg.png" /></figure><p>6. Verify that the data types for ID, name and balance are number, varchar2, and number respectively. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*536UpkIDCdlPdmGyQdEk_g.png" /></figure><p>7. Click “Finish”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zH9zozmdlvbDEZE1LHmHfw.png" /></figure><p>8. Now, let’s import the bank transfers dataset. In SQL Developer, right click on the Tables for your graph user and select “Import Data”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*DLaCuGfgoehFIaN-CRGs9A.png" /></figure><p>9. In the Data Import Wizard, select the BANK_TRANSFERS.csv file you downloaded earlier, and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmeaJN-IeQtlzyXOjpyj6g.png" /></figure><p>10. Name the table “BANK_TRANSFERS” and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIC4-sjsSxft12be3Ri4lw.png" /></figure><p>11. Verify that all five columns are selected and click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIcWA1Cd7hfPJbjpPORAtw.png" /></figure><p>12. Verify that the data types for TXN_ID, src_acct_id, dst_acct_id, description and amount are number, number, number, varchar2, and number respectively. Then click “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ChP5-EM4KB-HoZY6FM7-XQ.png" /></figure><p>13. Click “Finish”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnFH3Pdkt77uF1Oa7a8MNA.png" /></figure><p>14. Notice that you now have the BANK_ACCOUNTS and BANK_TRANSFERS tables visible to you in SQL Developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X8U6VW2sbGyYEQgW6jS6JA.png" /></figure><h3><strong>Create SQL Property Graph</strong></h3><p>In this section, we will create a SQL Property Graph from the dataset we loaded in the last section and run a couple queries in SQL Developer to ensure the graph was created successfully.</p><ol><li>In a SQL worksheet, paste the following Create Property Graph statement:</li></ol><pre>CREATE PROPERTY GRAPH BANK_GRAPH <br>    VERTEX TABLES (<br>        BANK_ACCOUNTS<br>        KEY (ID)<br>        PROPERTIES (ID, Name, Balance) <br>    )<br>    EDGE TABLES (<br>        BANK_TRANSFERS <br>        KEY (TXN_ID) <br>        SOURCE KEY (src_acct_id) REFERENCES BANK_ACCOUNTS(ID)<br>        DESTINATION KEY (dst_acct_id) REFERENCES BANK_ACCOUNTS(ID)<br>        PROPERTIES (src_acct_id, dst_acct_id, amount)<br>    );</pre><p>2. Run the statement. The output should state “Property GRAPH created.”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k-rEr2NGKkRYVWnTuLzsg.png" /></figure><p>3. Run the following statement to list all SQL Property Graphs for your user. Notice that BANK_GRAPH is listed.</p><pre>SELECT * FROM user_property_graphs;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s16UTNaDbM7TCD65_9YQCA.png" /></figure><p>4. You can run SQL Property Graph queries from the same SQL worksheet. For example, run the following query to find the top 10 accounts by incoming transfers.</p><pre>SELECT acct_id, COUNT(1) AS Num_Transfers <br>    FROM graph_table ( BANK_GRAPH <br>        MATCH (src) - [IS BANK_TRANSFERS] -&gt; (dst) <br>        COLUMNS ( dst.id AS acct_id )<br>    ) GROUP BY acct_id ORDER BY Num_Transfers DESC <br>FETCH FIRST 10 ROWS ONLY;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*5eAfeFnQkfvLCA86Ft6xFw.png" /></figure><p>Find more queries for this dataset in <a href="https://github.com/oracle-samples/pgx-samples/blob/master/23c-graph-demos/oracle-graph-23c-sqldeveloper.sql">this GitHub repository</a>.</p><h3><strong>Launch Graph Server and Client OCI Marketplace Image</strong></h3><p>If you want to visualize your SQL Property Graph queries, you can do so using the Graph visualization tool. This requires an install of Oracle Graph Server, which we will install in this section. You can also run graph algorithms on your SQL Property Graph in Graph Server.</p><ol><li>From your Oracle Cloud Infrastructure console, navigate to the OCI Marketplace.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdA3HMmmrNSKmhEzy_ubig.png" /></figure><p>2. In the marketplace, search for and select “Oracle Graph Server and Client”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYWM4dJzIUYlxY1LIn6WTg.png" /></figure><p>3. Select the latest version of Oracle Graph Server and Client and select “Launch Stack”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsMTp7f5h-Y34nO-JnyN5A.png" /></figure><p>4. In the Stack Information page, leave everything as default, and click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8dDNpxb5O4ISXk5DNqkKw.png" /></figure><p>5. Now, input the necessary configuration settings, then click Next (see example below). You will need to create a JDBC URL for this step, which can be created using the hostname, port and service name used to connect to the database with SQL Developer in this format:</p><pre>jdbc:oracle:thin:@//&lt;hostname&gt;:&lt;port&gt;/&lt;service_name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAO3uOME5TJ1rU_-Y18QIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNzsxJOvYorc3gI9-RgIAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmzwkPS4I9ZiBxblVgHB2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zEgqixD5whTXnKhHVfwF8A.png" /></figure><p>6. Review your settings, enable “Run apply”, and select “Create”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eCJGOfcrTYlJ-74OKJ1KFQ.png" /></figure><p>7. You will then be brought to the Job details page where you can monitor the status of the stack deployment. When the job is complete, the box on the top left will turn green and the status will change to “succeeded”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2GiAuUC4ifUNqCynPyphg.png" /></figure><p>8. Once the job is complete, you can click the Application Information tab, and navigate directly to the graph visualization application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlSDDeF7w9C7MS0bNkR4Bw.png" /></figure><p>9. It may take a few additional minutes after the job is complete for Graph Server to finish setting up, so you may not see the login screen immediately. When it is finished setting up, you can log into the graph visualization tool using your graph user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9SNI_ClgSQDvxAJntHhJQw.png" /></figure><h3><strong>Visualize SQL Graph Queries</strong></h3><p>In this section, we will run a SQL Property Graph query, and display it as a graph, using the Graph Visualization tool.</p><ol><li>Select the <strong>Database (SQL Property Graphs)</strong> tab.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C33AT1rVrC2I8aqEBR9_eQ.png" /></figure><p>2. Run the following query to visualize all vertices connected by an edge. Notice that the columns clause has vertex_id and edge_id. These are required to display the result set as a graph.</p><pre>SELECT id_a, id_e, id_b<br> FROM GRAPH_TABLE ( BANK_GRAPH<br>  MATCH (a) -[e]-&gt; (b)<br>  COLUMNS (vertex_id(a) AS id_a, edge_id(e) AS id_e, vertex_id(b) AS id_b )<br>) FETCH FIRST 100 ROW ONLY</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ch93g-pdW9WqGwTMbq1o_Q.png" /></figure><h3><strong>Next Steps</strong></h3><p>Congratulations! You now have Graph Server instance with Oracle Database 23c on OCI with a sample graph. You can continue visualizing your own graph queries using the syntax outlined <a href="https://docs.oracle.com/en/database/oracle/property-graph/23.1/spgdg/sql-graph_table-queries.html#GUID-35E9A1DE-26C0-4B42-971E-E9AAEFAC084E">here. </a>You can also learn more about the visualization settings available in the graph visualization tool <a href="https://docs.oracle.com/en/database/oracle/property-graph/23.1/spgdg/using-graph-visualization-application.html#GUID-D7432CA4-1A82-4EAA-A12B-C687AFB661A2">here</a>.</p><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5baf1d5ee65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/use-oracle-database-23c-with-oracle-graph-on-oracle-cloud-infrastructure-b5baf1d5ee65">Use Oracle Database 23c with Oracle Graph on Oracle Cloud Infrastructure</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Oracle Graph Python Client with Autonomous Database]]></title>
            <link>https://medium.com/oracledevs/use-oracle-graph-python-client-with-autonomous-database-3204e5bbc1dd?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3204e5bbc1dd</guid>
            <category><![CDATA[autonomous-database]]></category>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[oracle-graph]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 18:34:20 GMT</pubDate>
            <atom:updated>2023-03-01T19:48:08.342Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OM9CDMXd35xJmZZjXDYmpg.png" /></figure><p>In this article we will walk through the steps to use the Oracle Graph Client with Autonomous Database. The <a href="https://docs.oracle.com/en/database/oracle/property-graph/22.2/spgdg/using-autonomous-database-graph-client.html">Autonomous Database Graph Client</a> makes it easy to connect to, query, and work with graphs in Graph Studio from a Python or Java client. This enables developers to work with Graph Studio programmatically instead of using the UI. In this example, we will use the python client on a Jupyter notebook to query an existing graph in Graph Studio.</p><h3><strong>Prerequisites</strong></h3><ol><li>You have an Oracle Cloud Account.</li><li>You have created an Autonomous Database instance, and a graph enabled user. If you have not, you can find the instructions to do so <a href="https://medium.com/@rahultasker/set-up-your-autonomous-database-to-use-graph-studio-9e7d1cbf46c8">here</a>.</li><li>You have created the BANK_GRAPH. You can find the instructions to do so in this <a href="https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/view-workshop?wid=770&amp;clear=RR,180&amp;session=34434410321071">Oracle Livelab</a> (Labs 1&amp;2).</li><li>You have Python 3.9.0 or higher, and Jupyter installed on the same machine.</li></ol><h3>Download and Install the Oracle Graph Client</h3><ol><li>Download the latest version of Oracle Graph Client from <a href="https://www.oracle.com/database/technologies/spatialandgraph/property-graph-features/graph-server-and-client/graph-server-and-client-downloads.html">here</a>. Select the link that says “<strong>Oracle Graph Client</strong>” for the latest version.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RmnxZDJLjPh0h9_fpsRsnQ.png" /></figure><p>2. Select the platform that best applies to your machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wWoferTj8BapmxhOKaf8w.png" /></figure><p>3. Since we are using the ADB Graph Client, we only need to download the Graph Client. Everything else can be unchecked. Be sure to review and check the license agreement at the top left of the screen and select <strong>Download.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fa2q9PUNA5aOmpqDK45TYQ.png" /></figure><p>4. A dmg file should appear in your Downloads folder for the Oracle Download Manager. Launch this application.</p><p>5. When the Oracle Download Manager is open, select your desired download location, and select <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zKUIXDF7sReqYcIj6qRZw.png" /></figure><p>6. Once the download is complete, you can close the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hcIRIVb3EMVVbOkslB3Iuw.png" /></figure><p>7. Open your terminal, navigate to the folder you entered in the Oracle Download Manager (Downloads folder by default). <strong>Unzip</strong> the folder that was downloaded. This will keep the graph client zip file zipped. Other methods may unzip that folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OWVjsjVHCOMw0FHexInNHA.png" /></figure><p>8. Install the graph client using pip. You should see a success message at after installing.</p><pre>pip install oracle-graph-client-23.1.0.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTDLLimvgW5Oz155mHOvLQ.png" /></figure><p>You have installed Oracle Graph Client on your machine. Next, we will use the Python client in a Jupyter notebook to query from the BANK_GRAPH in Graph Studio.</p><h3>Set up Notebook Environment</h3><ol><li>Download the sample notebook from <a href="https://github.com/oracle-samples/pgx-samples">this GitHub repository</a>, under the <em>adb-client-jupyter</em> folder, to your local machine.</li></ol><p>2. Launch Jupyter notebook and open the sample notebook.</p><p>3. Click the Run button through the paragraphs for the first step. Notice that the second step requires some values from our OCI tenancy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_2TnqYHYK84x2mk2y0wxg.png" /></figure><p>4. Log into your OCI tenancy and navigate to your tenancy details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYHMeLLQNyR3UJMm-BqcKA.png" /></figure><p>5. Copy the tenancy ocid. Navigate back to the jupyter notebook and replace <em>&lt;tenancy_ocid&gt; </em>with the copied value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQJExoWAjRkUNOOCTzkwrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdDZYwfjgVTs45Bhv65hNg.png" /></figure><p>6. Navigate to your Autonomous Database instance. Copy the Database name and database ocid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn5onp2jJ9oq56IaKhDBnw.png" /></figure><p>7. Navigate back to the jupyter notebook and replace <em>&lt;autonomous_database_name&gt; </em>with the database name value and replace the <em>&lt;autonomous_database_ocid&gt;</em> with the ocid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnR_bzGJus9kTverI47tfA.png" /></figure><p>8. From your ADB instance, select the <strong>Tool Configuration</strong> tab. Copy the Graph Studio URL. Navigate back to the jupyter notebook and replace <em>endpoint</em> value with the copied URL, removing the <em>graphstudio/ </em>extension from the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDnegP143DHB2iVKVEwOog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KJbn7A4nIXmq_3o4adRZxg.png" /></figure><p>9. Replace <em>&lt;graphuser_password&gt; </em>with the password for your GRAPHUSER and run the remaining paragraphs for the second step. These will check if the environment is started and start the graph environment.</p><h3>Use Autonomous Database Graph Client</h3><ol><li>Run through step 3 to create the PGX Session and load the graph into memory.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OcZpCkEGH6PD8ZM4FRwtwA.png" /></figure><p>2. Run through step 4 to run the PageRank algorithm. This will add a <em>pagerank</em> property to the nodes in the graph. These represent the importance of each node within the graph, based on the number incoming relationships and the importance of the corresponding source nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*u3JQ7DrhC1j_8MkXXtroSg.png" /></figure><p>3. Run through step 5 to query the graph for the account ID and the corresponding PageRank value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*n8YTvE4CpCodnf_fGrOeEA.png" /></figure><p>4. Run through step 6 to convert the result set to a pandas dataframe and use to gather some statistics from the dataframe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*TASyVfJJDwlXuxEd6mRyHQ.png" /></figure><p>5. Run through step 7 to create meaningful visualization charts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*_yDtZxEOVSaeHR2eUEnK0Q.png" /></figure><p>6. Optionally, run through step 8 to close the PGX session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bilx3g1Pq-2kfbmbK_08oA.png" /></figure><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><p>If you’re curious about the goings-on of Oracle Developers in their natural habitat, come <a href="https://bit.ly/odevrel_slack">join us on our public Slack channel</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3204e5bbc1dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/use-oracle-graph-python-client-with-autonomous-database-3204e5bbc1dd">Use Oracle Graph Python Client with Autonomous Database</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using APEX with RDF Graphs on Oracle Autonomous Database]]></title>
            <link>https://medium.com/oracledevs/using-apex-with-rdf-graphs-on-oracle-autonomous-database-7255c09880ff?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7255c09880ff</guid>
            <category><![CDATA[oracle-apex]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Mon, 09 Jan 2023 14:55:34 GMT</pubDate>
            <atom:updated>2023-01-24T16:24:21.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*J7MKhsp6SFWdp3d2r-wZNg.png" /></figure><p>Oracle Autonomous Database includes Graph Studio and Oracle APEX. Graph Studio automates graph data management, making it simple to model, analyze and visualize data. Oracle APEX is a low code development tool that simplifies the application development lifecycle.</p><p>This article will show you how to create an application using SPARQL and RDF graphs in minutes. We will leverage the built in capabilities of the Oracle Autonomous Database to easily run SPARQL queries on an RDF Graph and output the result to a report in APEX.</p><h3>Prerequisites:</h3><ul><li>Provision an Autonomous Database instance with Graph enabled user. If you have not done this, see <a href="https://medium.com/@rahultasker/set-up-your-autonomous-database-to-use-graph-studio-9e7d1cbf46c8">this blog post</a>. In this blog post, we assume that user is named <strong>GRAPHUSER</strong></li><li>Create an RDF Graph. If you have not done this, see <a href="https://medium.com/oracledevs/simple-steps-to-create-an-rdf-graph-in-graph-studio-f63fe34c27e0">this article</a>.</li></ul><h3>Enable Java in your Database</h3><p>SPARQL queries are run in APEX using the SEM_MATCH API, which requires Java to be enabled on your Autonomous Database instance.</p><ol><li>From cloud console, navigate to your Autonomous Database instance, select <strong>Database actions.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*dXjmog-iqPWNq5PyLyrtzw.png" /></figure><p>2. Select <strong>SQL.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*LAxs8q60d3CrYiUD5Kn7YQ.png" /></figure><p>3. Run the following code snippet to enable Java in the database.</p><pre>BEGIN<br>  DBMS_CLOUD_ADMIN.ENABLE_FEATURE(<br>  feature_name =&gt; &#39;JAVAVM&#39; );<br>END;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*gkSi4a6wTYG3QAjso6VPtQ.png" /></figure><p>4. Restart your Autonomous Database. When a dialog appears asking you to confirm, press <strong>Restart</strong>. It may take a few minutes to restart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*D1Pfs5ToZ0tiE-emmMsGXQ.png" /></figure><h3>Create APEX Workspace</h3><ol><li>From cloud console, navigate to your Autonomous Database instance, select the <strong>Tools</strong> tab, and select <strong>Open APEX.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e4UZLfAqjOwIiPThn4I7A.png" /></figure><p>2. Sign into Administrative Services using your Admin password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLpb3LObpQOiQgoDlnSUjg.png" /></figure><p>3. Select <strong>Create Workspace</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1fSwuVIYgfm6R8ctIXm4g.png" /></figure><p>4. Select <strong>Existing Workspace</strong> to create a workspace for GRAPHUSER.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waiUsYL8jEztp0i5jynVhw.png" /></figure><p>5. Create a workspace for your graph user. In this example, we will use GRAPH USER as the database user, workspace name and workspace username. Then select <strong>Create Workspace</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*yHlFbjXPH6sVrlmS6rMGIQ.png" /></figure><p>6. Sign out of Administrative Services, so you can sign into the workspace that we created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkFPW20c9kzisjKCL_erhw.png" /></figure><h3>Create APEX Application</h3><ol><li>From cloud console, navigate to your Autonomous Database instance, select the <strong>Tools</strong> tab, and select <strong>Open APEX.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*tmCQonJm_9bwmyuZSCGcsQ.png" /></figure><p>2. Sign in using the workspace credentials that you made for GRAPHUSER.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VhU_BLNt_PtlWpcaMJbfYw.png" /></figure><p>3. Select <strong>App Builder</strong> &gt; <strong>Create New App</strong> &gt; <strong>New Application</strong></p><p>4. Name the Application. In this example we will use the name ‘<strong>RDF Graph Sample App</strong>’. Then click <strong>Create Application.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*iSaEHS4STOICE_uO9thHdA.png" /></figure><h3>Create Report with SPARQL Query</h3><ol><li>Within App Builder for your new application, select the default home page</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*MqQlGMLDCpVc2ueh_kUSRQ.png" /></figure><p>2. From the Regions section, drag the <strong>Interactive Report</strong> into the body of the page designer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*2aSLRvNTk3Kum6cjMQg3ZQ.png" /></figure><p>3. Change the title of the interactive report to ‘<strong>My RDF Query</strong>’. Change the type to <strong>SQL Query</strong>, and expand the SQL Query text box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*p2gsHXureqiXfi4j4j5PKQ.png" /></figure><p>4. Paste the following code snippet to search for all the distinct genres that each actor has been in. This snippet uses the <strong>sem_match</strong> API to run the SPARQL query against the moviestream graph.</p><pre>SELECT actor, genres from table (sem_match(&#39;<br>PREFIX  rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;<br>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;<br>PREFIX  xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;<br>PREFIX   ms: &lt;http://www.example.com/moviestream/&gt;<br><br>SELECT ?actor (GROUP_CONCAT(DISTINCT STR(?genre) ; separator=&quot;, &quot;) as ?genres)<br>WHERE { ?movie ms:actor/ms:name ?actor .<br>        ?movie ms:genre/ms:genreName ?genre .<br>} <br>GROUP BY ?actor&#39;, sem_models(&#39;moviestream&#39;), null, null, null, null, &#39; &#39;, null, null, &#39;GRAPHUSER&#39;, &#39;RDF_NETWORK&#39;));</pre><p>5. Click the check mark at the top of the dialog box to <strong>validate</strong>, then click <strong>OK</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*iMq7xl3VCpY-1UoVM9PE1Q.png" /></figure><p>6. Click the run button at the top right of the page designer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBgpN5pqcfZJxq6Y-GEzvw.png" /></figure><p>7. Log in using your GRAPHUSER credentials, and you will see the results of that SPARQL Query displayed in an interactive grid!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nm_v4TMcfmEP0CMBxcFXvg.png" /></figure><p>If you do not see the results displayed in the interactive grid, see the troubleshooting section at the end of this article.</p><h4>Querying with User Input</h4><ol><li>In your page designer, drag in a new <strong>Text Field </strong>and name it <strong>USER_INPUT</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WzCTErqTDHoAJBYS6WoSA.png" /></figure><p>2. Drag in a new <strong>Interactive Report</strong>. Name it ‘<strong>Genres by Actor</strong>’, change the type to a <strong>SQL Query</strong> and expand the SQL Query text box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JwgqVOyb_xhhk7J_FYwVQ.png" /></figure><p>3. Paste in the following code snippet which will query for the genre of movies that an actor has been in by the specified user input.</p><pre>SELECT actor, gname from table (sem_match(&#39;<br>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;<br>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;<br>PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;<br>PREFIX ms: &lt;http://www.example.com/moviestream/&gt;<br><br>SELECT DISTINCT ?actor ?gname <br>WHERE {<br>  ?movie ms:actor/ms:name ?actor;<br>  ms:genre/ms:genreName ?gname .<br>}<br>ORDER BY ASC(?gname)&#39;, sem_models(&#39;moviestream&#39;), null, null, null, null, &#39; &#39;, null, null, &#39;GRAPHUSER&#39;, &#39;RDF_NETWORK&#39;))<br>where actor$_prefix = :USER_INPUT;</pre><p>4. Validate and select <strong>OK.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*gPU7wP5j9EKRPmc9Wc8UVQ.png" /></figure><p>5. <strong>Right Click</strong> on the USER_INPUT field and select <strong>Create Dynamic Action.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*DfZz2dqhkOdPVjChLASlzA.png" /></figure><p>6. Name the Dynamic Action ‘<strong>On Return</strong>’, and ensure the event is set to ‘<strong>Change</strong>’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d5-kCsFkzrP1Da7P3Zt9Eg.png" /></figure><p>7. Change the True action to be <strong>Submit Page.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H809fQCmoKMDO1ODaHo0Sg.png" /></figure><p>8. Click the run button at the top right of the page designer.</p><p>9. You will notice that the report is blank. this is because we haven&#39;t specified a user input yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwMxpXf4mRm0pOFxdX-86A.png" /></figure><p>10. If we type ‘<strong>Keanu Reeves</strong>’ into the input box, and press enter, we will see all the genres that Keanu Reeves has made movies in, by running a SPARQL query based on the user input field!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXCMJuVnmFcoaXFMAl08yA.png" /></figure><h3>Troubleshooting</h3><p>If your columns do not display in the interactive grid, you can explicitly select the columns from the <strong>Actions</strong> dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2B_UXF2kF0Q1_iHgishgfw.png" /></figure><p>If this is the case, select the <strong>Actions</strong> dropdown, and select <strong>Columns.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RGkhCxR52SVgSA-kHwGeQ.png" /></figure><p>Select the <strong>Move All </strong>button to display all columns in the report, and select <strong>Apply</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*MWu-4abhQdPaYzwffKqZHg.png" /></figure><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><p>If you’re curious about the goings-on of Oracle Developers in their natural habitat, come <a href="https://bit.ly/odevrel_slack">join us on our public Slack channel</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7255c09880ff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/using-apex-with-rdf-graphs-on-oracle-autonomous-database-7255c09880ff">Using APEX with RDF Graphs on Oracle Autonomous Database</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Oracle Graph Server and Client]]></title>
            <link>https://medium.com/oracledevs/getting-started-with-oracle-graph-server-and-client-43e458253fec?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/43e458253fec</guid>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Fri, 15 Jul 2022 14:09:53 GMT</pubDate>
            <atom:updated>2022-08-16T16:46:08.958Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will explore a simple use case to get started with Oracle Graph Server and Client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*bmUyLsx-cmR7RSx6vhiQhw.png" /></figure><h3>Prerequisites</h3><p>This article assumes that you already have an <strong>Oracle Database and have Graph Server configured for that database</strong>. If you have not done so, you can follow <a href="https://medium.com/@rahultasker/deploy-oracle-graph-on-oci-with-autonomous-database-without-a-database-wallet-15708145c8a4">these steps</a> to deploy the Graph Server/Client Marketplace image with the Autonomous Database on Oracle Cloud, or follow our <a href="https://docs.oracle.com/en/database/oracle/property-graph/21.2/spgdg/oracle-graph-server-and-client-installation.html">official documentation</a> to deploy Graph Server/Client.</p><p>We also assume that you have <strong>created a database user with the necessary permissions for graph</strong>. If you do not, you can follow <a href="https://medium.com/@rahultasker/deploy-oracle-graph-on-oci-with-autonomous-database-without-a-database-wallet-15708145c8a4">these steps</a> if you are using an Autonomous Database, or follow <a href="https://docs.oracle.com/en/database/oracle/property-graph/22.2/spgdg/basic-steps-using-oracle-database-authentication.html">these steps</a> if you are using a self-managed Oracle database.</p><p>You have <strong>SQLcl and necessary packages installed</strong> on your Graph Server VM. The Oracle Marketplace image has this installed by default. If you have a self-managed database, you can install <a href="https://docs.oracle.com/en/database/oracle/property-graph/22.2/spgdg/installing-pl-sql-packages-oracle-database.html">this PL/SQL package</a> to your database; go <a href="https://www.oracle.com/tools/downloads/sqlcl-downloads.html">here</a> to download SQLcl, and <a href="https://docs.oracle.com/en/database/oracle/sql-developer-command-line/20.2/sqcug/using-pgql-plug-sqlcl.html#GUID-E0EFA43F-003F-4C8C-8056-54E9A428B8B7">here</a> to download the PGQL plugin for SQLcl.</p><h3>Create Database Tables</h3><ol><li>Connect to your Oracle Database with your Graph-enabled user. For instructions on connecting to an Oracle Database, see this <a href="https://docs.oracle.com/en/database/oracle/oracle-database/tutorial-create-conn/index.html?opt-release-19c">document</a>. To connect to an Autonomous Database, see this <a href="https://docs.oracle.com/en/cloud/paas/atp-cloud/atpgs/autonomous-connect-sql-developer.html#GUID-14217939-3E8F-4782-BFF2-021199A908FD">document</a>.</li><li>Create the following tables:</li></ol><pre>create table users_table(<br>   user_id         NUMBER(4),<br>   first_name      VARCHAR2(50),<br>   last_name       VARCHAR2(50),<br>   gender          VARCHAR2(50),<br>   date_of_birth   TIMESTAMP(3),<br>   phone_number    VARCHAR2(50),<br>   infected        VARCHAR2(50),<br>   date_diagnosis  TIMESTAMP(3),<br>   constraint pk_uid primary key (user_id)<br>);</pre><pre>create table contacts(<br>   contact_id      NUMBER(4),<br>   reporting_user  NUMBER(4),<br>   contact_user    NUMBER(4),<br>   contact_start   TIMESTAMP(3),<br>   contact_end     TIMESTAMP(3),<br>   infectious_start TIMESTAMP(3),<br>   infectious_end  TIMESTAMP(3),<br>   constraint pk_cid primary key (contact_id),<br>   constraint FK_rep_user<br>      FOREIGN key (reporting_user) references users_table(user_id),<br>   constraint FK_con_user<br>      FOREIGN key (contact_user) references users_table(user_id)</pre><pre>);</pre><p>The users_table will represent all vertices in this graph. The contacts table will represent all edges in this graph.</p><h3>Load Data</h3><ol><li>Download <a href="https://objectstorage.us-ashburn-1.oraclecloud.com/p/p3AFrSMppUbwMnKlfO1258cI2n4w-vWfW0cp1gRbP8B-nv2Fb_ZvC-zGVUS30bfQ/n/oradbclouducm/b/contact-tracing-blog/o/oracle_graph_server_contact_tracing.zip">this zip file</a>, which contains csv files for each table.</li><li>Load users.csv into users_table and contacts.csv into contacts. This can be done through SQL Developer, with an example shown <a href="https://docs.oracle.com/database/121/ADMQS/GUID-7068681A-DC4C-4E09-AC95-6A5590203818.htm#ADMQS0826">here</a>.</li></ol><h3>Create Graph</h3><ol><li>SSH to your graph server instance.</li><li>Log in to SQLcl using your graph user. If you are using the marketplace image with Autonomous, that will look like the following:</li></ol><pre>$ sql -oci<br>$ Username? (&#39;&#39;?) <strong>graph_user@&lt;ADB_connection_string&gt;</strong><br>$ Password? <strong>&lt;graph_user_password&gt;</strong></pre><p>3. Enable PGQL mode.</p><pre>pgql auto on;</pre><p>4. Create Property Graph.</p><pre>PGQL&gt; CREATE PROPERTY GRAPH Contact_Graph<br>   VERTEX TABLES ( <br>      graph_user.users_table KEY ( user_id ) <br>      PROPERTIES ( <br>         date_diagnosis, <br>         date_of_birth, <br>         first_name,<br>         gender,<br>         infected,<br>         last_name,<br>         phone_number,<br>         user_id <br>      )) <br>   EDGE TABLES ( <br>      graph_user.contacts SOURCE KEY ( reporting_user ) <br>      REFERENCES users_table DESTINATION KEY ( contact_user ) <br>      REFERENCES users_table PROPERTIES ( <br>         contact_end,<br>         contact_id,<br>         contact_start,<br>         contact_user,<br>         infectious_end,<br>         infectious_start,<br>         reporting_user<br> ));</pre><p>4. Disconnect from SQLcl.</p><h3>Log in Using the Graph Visualization Tool</h3><p>At this point, we should be able to see that the graph has been created in the database. We will be able to run PGQL queries using SQLcl or the Graph visualization tool. Note that when we load the graph into memory we can additionally run graph analytics algorithms, and gain even more insight into our data.</p><ol><li>In a browser, navigate to your Oracle Graph visualization tool. This should look like:</li></ol><pre><a href="https://129.213.36.55:7007/ui/login">https://&lt;IP of graph viz&gt;:7007/ui/</a></pre><p>2. Select the <strong>Advanced Options</strong> drop-down, and select the <strong>Database</strong> tab.</p><p>3. In the <strong>Database URL </strong>box, enter your database JDBC url.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*zI4FY6L2tUmOACKEErqI6g.png" /></figure><p>4. Click <strong>Submit.</strong></p><h3>Query your Graph</h3><ol><li>In Graph Visualization, select the drop-down box on the bottom left and select the graph that we just made.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*eiUGypFhRYfLCAe_JeSAeA.png" /></figure><p>2. Query and visualize 100 elements (nodes and edges) of CONTACT_GRAPH. This query shows the result of 100 elements where a source vertex has a transaction to a destination vertex. In other words, this shows 100 times people came into contact with one another.</p><pre>select * <br>from match (s)-[t]-&gt;(d) on contact_graph <br>limit 100</pre><p>3. Query and visualize based on if the contacter was infected.</p><pre>select * from<br>match (s) - [t] -&gt; (d) on contact_graph <br>where s.infected=&#39;yes&#39;</pre><p>4. Query and visualize assuming a person could be infectious two weeks before or after diagnosis.</p><pre>select * from <br>match (s) - [t] -&gt; (d) on contact_graph <br>where s.infected = &#39;yes&#39; and (s.date_diagnosis &gt;=  t.infectious_start and s.date_diagnosis &lt;=  t.infectious_end)</pre><p>5. We can drill even deeper to see if there has been anyone infected in a group, who then exposed more people.</p><pre>select * from<br>match (s) - [t] -&gt; (d) - [f] -&gt; (v) on contact_graph <br>where s.infected = &#39;yes&#39; and (s.date_diagnosis &gt;=  t.infectious_start and s.date_diagnosis &lt;=  t.infectious_end)</pre><p>6. But, we also want to see if the people contacted were exposed within the infectious range.</p><pre>select * from<br>match (s) - [t] -&gt; (d) - [f] -&gt; (v) on contact_graph<br>where s.infected = &#39;yes&#39; and (s.date_diagnosis &gt;=  t.infectious_start and s.date_diagnosis &lt;=  t.infectious_end)<br>and d.infected = &#39;yes&#39; and (d.date_diagnosis &gt;=  f.infectious_start and d.date_diagnosis &lt;=  f.infectious_end)</pre><h3>Example Use Case</h3><p>Let’s say that Judy (user ID 1) hears that Janet (user ID 73) was infected and spread the virus to several others. This person is concerned for their health, and asks <em>“Was I two or less contact points away from Janet at any point?” </em>We can help her by running a <em>Match All </em>query with Janet’s and Judy’s user ID.</p><ol><li>Run the following query. Here we are querying for all paths, with two or less edges, between Judy and Janet.</li></ol><pre>SELECT p1.user_id AS start, p2.user_id as end_<br>   FROM MATCH All (p1) -[e]-&gt;{,2} (p2)<br>   WHERE p1.user_id =1 AND p2.user_id =73</pre><p>2. Click on the table mode option in the Graph visualization tool to see that there are thirty two paths, with two or less edges, between Judy and Janet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6udqnwlqEE3zOXmCIHVBtw.png" /></figure><p>3. We can confirm that Judy and Janet were never directly in contact with the following query, which should return an empty result.</p><pre>SELECT *<br>   FROM MATCH (p1) -[e]-&gt; (p2)<br>   WHERE p1.user_id =73 AND p2.user_id =1</pre><p>4. We can then query to see who Janet came in contact with, while she was infected, and if those people were infected and contagious while in contact with Judy.</p><pre>SELECT *<br>   FROM MATCH (p1) -[e]-&gt; (i) -[f]-&gt; (p2)<br>   WHERE p1.user_id =73 AND p2.user_id =1<br>and<br>   i.infected=&#39;yes&#39;<br>and<br>   ((e.infectious_start &lt;= e.contact_start and e.contact_start &lt;= e.infectious_end)<br>   or (e.contact_start &lt;= e.infectious_start and e.contact_end &lt;= e.infectious_end)<br>   or (e.contact_start &lt;= e.infectious_start and e.infectious_end &lt;= e.contact_end))<br>and<br>   ((f.infectious_start &lt;= f.contact_start and f.contact_start &lt;= f.infectious_end)<br>   or (f.contact_start &lt;= f.infectious_start and f.contact_end &lt;= f.infectious_end)<br>   or (f.contact_start &lt;= f.infectious_start and f.infectious_end &lt;= f.contact_end))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*gImEf-iUfOuZDojQVwryWA.png" /></figure><p>With this information, we can answer Judy’s question by telling her she was two contact points away from Janet thirty two times. However, the two of them were never in direct contact, and only four of those contact points were during the infectious range for Janet and the middle point of contact.</p><p>You can then continue to query with a similar syntax, and explore the graph! You can find the official documentation for PGQL <a href="https://pgql-lang.org/">here</a>.</p><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43e458253fec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/getting-started-with-oracle-graph-server-and-client-43e458253fec">Getting Started with Oracle Graph Server and Client</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Oracle Graph on OCI with Autonomous Database without a Database Wallet]]></title>
            <link>https://medium.com/@rahultasker/deploy-oracle-graph-on-oci-with-autonomous-database-without-a-database-wallet-15708145c8a4?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/15708145c8a4</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[oracle-graph]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Fri, 15 Jul 2022 14:08:11 GMT</pubDate>
            <atom:updated>2023-07-27T19:44:00.586Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will show you how to install Oracle Graph Server, using the Oracle Cloud Marketplace image, with the Autonomous Database. For this use case, we will securely connect to the Autonomous Database without a wallet, using TLS. Instructions on configuring TLS will follow but for more information, see <a href="https://blogs.oracle.com/developers/post/securely-connecting-to-autonomous-db-without-a-wallet-using-tls">this blog post</a>.</p><p><strong>Prerequisites</strong></p><ul><li>You will need to provide the SSH key, Virtual Cloud Network and Subnet information during the deployment process.</li><li>This blog assumes you have followed <a href="https://medium.com/@rahultasker/set-up-your-autonomous-database-to-use-graph-studio-9e7d1cbf46c8">these steps</a> to deploy and Autonomous Database with a Graph enabled user.</li></ul><h3>Deploy the Graph Server &amp; Client Marketplace Image</h3><h4>Locate your ADB connection string</h4><ol><li>Go to your Cloud Console and navigate to your Autonomous Database instance.</li><li>Find the label “<strong>Access Control List”</strong> and select <strong>Edit.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YZB2bIZO7eo0Mnk5SYfQiA.png" /></figure><p>3. For now, add your IP address, and save changes. The database will take a moment to update before you are able to continue.</p><p><strong>Note</strong>: When the Access Control List is enabled, all clients connecting to this Autonomous Database instance have to be in the ACL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3JrJXbEvkZQGaKDb0ieDJw.png" /></figure><p>4. Find the label “<strong>Mutual TLS (mTLS) Authentication”</strong> and select <strong>Edit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8ygDOvGNsGF4604G1yjBw.png" /></figure><p>5. <strong>Uncheck</strong> the box to require mutual TLS, and save changes. The database will take a moment to update before you are able to continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*PIPOKYR2aQ4pEG8WOjll7w.png" /></figure><p>6. Select <strong>DB Connection</strong>. The Database Connection console will appear. Ensure that the TLS Authentication is set to <strong>TLS</strong>, then copy any of the connection strings displayed in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eKrQxHnqtI4sReHEh6E6xg.png" /></figure><p>7. Paste the connection string into a notepad for later use.</p><h4>Locate the Graph Server and Client in the Oracle Cloud Marketplace</h4><p>Oracle Cloud Marketplace is an online platform which offers Oracle and partner software as click-to-deploy solutions that are built to extend Oracle Cloud products and services. Oracle Cloud Marketplace stacks are a set of Terraform templates that provide a fully automated end-to-end deployment of a partner solution on Oracle Cloud Infrastructure.</p><p>1. Go to your Cloud Console. Navigate to the <strong>Marketplace</strong> tab and enter <strong>Graph Server and Client</strong> in the search bar. Click on the Oracle Graph Server and Client stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dc1xUcr6_gkN-Ngo.jpg" /></figure><p>2. Select the stack and then review the System Requirements and Usage Instructions. Then select the latest version and choose a compartment and click on <strong>Launch Stack</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F80XXhNnimbQzHQf.jpg" /></figure><p>3. Most of the defaults are perfect for our purposes. However, you will need to choose, or provide the following:</p><ul><li>Select a VM shape.</li><li>Paste your public SSH key. This is used when you ssh into the provisioned compute later, if necessary.</li><li>Choose an existing virtual cloud network.</li><li>Select a subnet compartment and subnet.</li><li>Enter the JDBC URL for the ADB instance, formatted as jdbc:oracle:thin:@&lt;connection string copied from the ADB instance&gt;</li></ul><p>4. Click <strong>Next</strong> to initiate the Resource Manager Job for the stack. The job will take 2-3 minutes to complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-Hi33hG-nj41ZO5w.png" /></figure><h4>Add Graph Server and Client Compute Instance to Access Control List</h4><p>When your Resource Manager Job is successful, copy the public IP address of the Graph Compute instance, so we can add it to the database’s Access Control List. This will allow the graph server to connect to the database without using the ADB Wallet.</p><p>1. Log in to the Oracle Cloud console and select your ADB instance to view the instance details. In the details, find the section titled <strong>Network</strong> and click on <strong>Edit</strong> next to <strong>Access Control List</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CX8kvKqobUFEQ7x_95hgAQ.png" /></figure><p>2. In the <strong>Edit Access Control List</strong> dialog, choose <strong>IP Address</strong> and paste the public IP of the Compute Instance created by the Resource Manager Job.</p><p>3. Click <strong>Save Changes.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XmGanj0OB5ac5mG_Xaokcg.png" /></figure><h4>Access Graph Studio</h4><p>In a browser, navigate to https://&lt;public_ip of compute instance&gt;:7007/ui/ and log in using the graph user credentials. Here you will be able to query from any graphs that have been created and loaded into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSbvouTKVmwmArdW3NQflQ.png" /></figure><p>From this screen, you can select <strong>Advanced Options</strong>, Select the <strong>Database</strong> tab, enter the <strong>JDBC url</strong> that we made earlier, and login with your graph user credentials. Here you will be able to query from any graphs you have created, even if they have not been loaded into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pzcHks7dnWfKWUjfeabhuQ.png" /></figure><p>You should now see this screen, and can get started visualizing your graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_CgYFgyo1CB6ik0IKG1ew.png" /></figure><h4>Next Steps</h4><p>The Graph Visualization UI is a useful tool to query existing graphs. If you have not created any graphs, you can get started follow <a href="https://medium.com/@rahultasker/getting-started-with-oracle-graph-server-and-client-43e458253fec">this example</a>.</p><h3>Troubleshooting</h3><h4>If you see a <strong>500 Error</strong> when trying to log in, follow these steps</h4><ol><li>ssh opc@&lt;public_ip of compute instance&gt; .</li><li>Add jdbc url to /etc/oracle/graph add the jdbc url in pgx.conf .</li><li>Restart PGX by running sudo systemctl restart pgx.</li><li>Go to https://&lt;public_ip of compute instance&gt;:7007/ui/ after waiting a few minutes to restart.</li></ol><h4>If you see an <strong>unauthorized error</strong> when trying to log in, follow these steps</h4><ol><li>Navigate to your Autonomous Database and access Database Actions as the ADMIN user.</li><li>Select SQL Query .</li><li>Run the following statements:</li></ol><pre>DECLARE<br>   PRAGMA AUTONOMOUS_TRANSACTION;<br>   role_exists EXCEPTION;<br>   PRAGMA EXCEPTION_INIT(role_exists, -01921);<br>   TYPE graph_roles_table IS TABLE OF VARCHAR2(50);<br>   graph_roles graph_roles_table;<br> BEGIN<br>   graph_roles := graph_roles_table(<br>     &#39;GRAPH_DEVELOPER&#39;,<br>     &#39;GRAPH_ADMINISTRATOR&#39;,<br>     &#39;PGX_SESSION_CREATE&#39;,<br>     &#39;PGX_SERVER_GET_INFO&#39;,<br>     &#39;PGX_SERVER_MANAGE&#39;,<br>     &#39;PGX_SESSION_READ_MODEL&#39;,<br>     &#39;PGX_SESSION_MODIFY_MODEL&#39;,<br>     &#39;PGX_SESSION_NEW_GRAPH&#39;,<br>     &#39;PGX_SESSION_GET_PUBLISHED_GRAPH&#39;,<br>     &#39;PGX_SESSION_COMPILE_ALGORITHM&#39;,<br>     &#39;PGX_SESSION_ADD_PUBLISHED_GRAPH&#39;);<br>   FOR elem IN 1 .. graph_roles.count LOOP<br>   BEGIN<br>     dbms_output.put_line(&#39;create_graph_roles: &#39; || elem || &#39;: CREATE ROLE &#39; || graph_roles(elem));<br>     EXECUTE IMMEDIATE &#39;CREATE ROLE &#39; || graph_roles(elem);<br>   EXCEPTION<br>     WHEN role_exists THEN<br>       dbms_output.put_line(&#39;create_graph_roles: role already exists. continue&#39;);<br>     WHEN OTHERS THEN<br>       RAISE;<br>     END;<br>   END LOOP;<br> EXCEPTION<br>   when others then<br>     dbms_output.put_line(&#39;create_graph_roles: hit error &#39;);<br>     raise;<br>END;<br>/</pre><pre>GRANT PGX_SESSION_CREATE TO GRAPH_USER;<br>GRANT PGX_SERVER_GET_INFO TO GRAPH_USER;<br>GRANT PGX_SERVER_MANAGE TO GRAPH_USER;<br>GRANT PGX_SESSION_CREATE TO GRAPH_USER;<br>GRANT PGX_SESSION_NEW_GRAPH TO GRAPH_USER;<br>GRANT PGX_SESSION_GET_PUBLISHED_GRAPH TO GRAPH_USER;<br>GRANT PGX_SESSION_MODIFY_MODEL TO GRAPH_USER;<br>GRANT PGX_SESSION_READ_MODEL TO GRAPH_USER;</pre><p>4. Log in again in a fresh window.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15708145c8a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Contact Tracing with Oracle Graph Studio Notebooks]]></title>
            <link>https://medium.com/@rahultasker/contact-tracing-with-oracle-graph-studio-notebooks-9e8468ffa5b8?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e8468ffa5b8</guid>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[autonomous-database]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 18:00:09 GMT</pubDate>
            <atom:updated>2022-08-16T16:39:49.590Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5jJ9S_bmPr2As_lqHvbHUg.jpeg" /></figure><p>In this article, we will explore the use of Oracle Graph notebooks built into the Autonomous Database. To do so, we will use Oracle Graph to explore a contact tracing scenario:</p><p><em>You are the owner of an establishment. Given a dataset of customers, some of whom have been diagnosed with a contagious virus, and people those customers came into contact with, can we determine how much the virus spread at our location? What information can we derive that would be useful for ourselves, and for our customers?</em></p><h4><strong>Prerequisites</strong></h4><ul><li>This blog assumes you have followed <a href="https://medium.com/@rahultasker/set-up-your-autonomous-database-to-use-graph-studio-9e7d1cbf46c8">these steps</a> to deploy and Autonomous Database with a Graph enabled user.</li></ul><h3>Load Data into Autonomous Database</h3><p>Before we start making graphs, we need to make sure that we have database tables with data loaded into the Autonomous Database.</p><ol><li>Download <a href="https://objectstorage.us-ashburn-1.oraclecloud.com/p/4AR9mQGFwgJrY5tqS0Cg3bR9qoR9ivnwO4Wlfl_KMlWRsTtx_yn9ExT7FpvUSGUt/n/oradbclouducm/b/contact-tracing-blog/o/oracle_graph_studio_contact_tracing.zip">this zip file</a> and extract the contents. There should be a <em>contacts.csv</em> and <em>users.csv</em> files, which we will use now, as well as a <em>contact_graph.dsnb</em> file which we will use later.</li></ol><p>2. Access <strong>Database Actions</strong> from the Oracle Cloud Infrastructure Console as the Graph enabled user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*141WRwL7b7_ncuEMrpks3w.png" /></figure><p>3. Select <strong>SQL.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJw7pfiFMX4l9kAtXPEK1g.png" /></figure><p>4. Execute the following PL/SQL code to create tables for this dataset.</p><pre>create table users_table(<br>   user_id         NUMBER(4),<br>   first_name      VARCHAR2(50),<br>   last_name       VARCHAR2(50),<br>   gender          VARCHAR2(50),<br>   date_of_birth   TIMESTAMP(3),<br>   phone_number    VARCHAR2(50),<br>   infected        VARCHAR2(50),<br>   date_diagnosis  TIMESTAMP(3),<br>   constraint pk_uid primary key (user_id)<br>);</pre><pre>create table contacts(<br>   contact_id      NUMBER(4),<br>   reporting_user  NUMBER(4),<br>   contact_user    NUMBER(4),<br>   contact_start   TIMESTAMP(3),<br>   contact_end     TIMESTAMP(3),<br>   infectious_start TIMESTAMP(3),<br>   infectious_end  TIMESTAMP(3),<br>   constraint pk_cid primary key (contact_id),<br>   constraint FK_rep_user <br>      FOREIGN key (reporting_user) references users_table(user_id),<br>   constraint FK_con_user <br>      FOREIGN key (contact_user) references users_table(user_id)</pre><pre>);</pre><p>5. Refresh the <strong>Navigator</strong> on the left, <strong>right click USERS_TABLE</strong> and select <strong>Data Loading &gt; Upload Data.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*lJ1hI2jvuLXop0NCfi16gA.png" /></figure><p>6. Upload the users.csv file. Click <strong>Next.</strong></p><p>7. In the Data Mapping section, change the date formatting to:</p><pre>YYYY-MM-DD HH24:MI:SS.FF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jKNE8RudBHWcbmY5mztMEw.png" /></figure><p>8.<strong> </strong>Click <strong>Next</strong>, and <strong>Finish.</strong></p><p>9. R<strong>ight click the CONTACTS</strong> and select <strong>Data Loading &gt; Upload Data.</strong></p><p>10. Upload the contacts.csv file. Click <strong>Next.</strong></p><p>11. In the Data Mapping section, change the date formatting to:</p><pre>YYYY-MM-DD HH24:MI:SS.FF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81MBkcCI2aYzIcjhgnK0Ng.png" /></figure><p>12. Click <strong>Next</strong>, and <strong>Finish.</strong></p><h3>Create Graph</h3><ol><li>From your OCI console, navigate to your Autonomous Database Instance, and select <strong>Tools &gt; Graph Studio.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vX4FDMJH1Ri7HAtlat6W3A.png" /></figure><p>2. Log in as your graph user.</p><p>3. Select the <strong>graphs</strong> on the navigation bar, and click <strong>create.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mneuC1hzfhfW2Q4F9l0B1g.png" /></figure><p>4. Select the contacts and users tables, then click <strong>Next.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhEWPzzI3sUeNijm9qYK9A.png" /></figure><p>5. Your modeler should look like the following image. Click <strong>Next.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_oMdGgmOBe1SISFOqEElYA.png" /></figure><p>6. Click <strong>Create Graph</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIGT1yGqHhOHJRjvlynpdw.png" /></figure><p>7. You will be prompted to enter a graph name and model name. I will keep the model name as default and call the graph “contact_graph”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*m9LVDpTPhbBi6iqVwA7C1Q.png" /></figure><p>8. After a few minutes, you should see that the environment was created and the graph has been loaded into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-w5l1iPPjwM5SeIhceo2Q.png" /></figure><h3>Visualize Graph</h3><ol><li>Navigate to the Notebooks page in graph studio, and click Import.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkUHJ3bNd9Bx98ghBCPpZQ.png" /></figure><p>2. Drag in the <em>contact_graph.dsnb</em> file from the zip file you downloaded earlier.</p><p>3. Click <strong>Import.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*FHt12Ptyw6QnDfGTSLF6ng.png" /></figure><p>4. <strong>Click the run button</strong> at the top of the notebook to run all paragraphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYmxpd4yJqbr1uvPolcOOA.png" /></figure><p>5. Explore the notebook. It has already been created with a series of <em>sql</em> and <em>pgql</em> queries with notes to help you understand what each query is doing, and how it can help us answer our initial questions for this use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*SLyzXUp75VDYMlDsQR58kw.png" /></figure><p>Please learn more about <strong>Oracle Graph</strong> from:</p><ul><li><a href="https://medium.com/tag/oracle-graph">Medium</a> (= all articles with Oracle Graph tag)</li><li><a href="https://stackoverflow.com/questions/tagged/oracle-graph">Stack Overflow</a> (= questions with oracle-graph tag)</li><li><a href="https://join.slack.com/t/andouc/shared_invite/zt-1a2hmiz6f-vLlblcQyv0t9FMraMMP5uQ">Slack AnDOUC</a> (= invitation link, please visit #graph)</li><li><a href="https://join.slack.com/t/oracledevrel/shared_invite/zt-uffjmwh3-ksmv2ii9YxSkc6IpbokL1g">Slack OracleDevRel</a> (= invitation link, please visit #oracle-db-graph)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e8468ffa5b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set up your Autonomous Database to use Graph Studio]]></title>
            <link>https://medium.com/@rahultasker/set-up-your-autonomous-database-to-use-graph-studio-9e7d1cbf46c8?source=rss-f1c81a20cb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e7d1cbf46c8</guid>
            <category><![CDATA[oracle-graph]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[autonomous-database]]></category>
            <dc:creator><![CDATA[Rahul Tasker]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 17:55:36 GMT</pubDate>
            <atom:updated>2022-07-19T15:08:12.880Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will Provision an Autonomous Database, and configure a graph enabled user. This will allow you to log into Graph Studio, which is built into the Autonomous Database web console.</p><h3>Provision Autonomous Database</h3><p>1. Log in to Oracle Cloud.</p><p>2. Once you are logged in, you are taken to the cloud services dashboard where you can see all the services available to you. Click the navigation menu in the upper left corner to show top level navigation choices.<br><strong>Note:</strong> You can also directly access your Oracle Autonomous Data Warehouse or Oracle Autonomous Transaction Processing service in the <strong>Quick Actions</strong> section of the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rfOy6L-7AEgIAwz2.png" /></figure><p>3. The following steps apply similarly to either Oracle Autonomous Data Warehouse or Oracle Autonomous Transaction Processing. This lab shows provisioning of an Oracle Autonomous Data Warehouse database, so click <strong>Autonomous Data Warehouse</strong>.</p><p>4. Make sure your workload type is <strong>Data Warehouse</strong> or <strong>All</strong> to see your Oracle Autonomous Data Warehouse instances. Use the <strong>List Scope</strong> drop-down list to select a compartment.<br><strong>Note:</strong> Avoid the use of the ManagedCompartmentforPaaS compartment as this is an Oracle default used for Oracle Platform Services.</p><p>5. Click <strong>Create Autonomous Database</strong> to start the instance creation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/0*64kYV3Tg6rmPik5W.png" /></figure><p>6. Provide basic information for the autonomous database:</p><ul><li><strong>Choose a compartment</strong> — Select a compartment for the database from the drop-down list.</li><li><strong>Display Name</strong> — Enter a memorable name for the database for display purposes.</li><li><strong>Database Name</strong> — Use letters and numbers only, starting with a letter. Maximum length is 14 characters. (Underscores not initially supported.)</li></ul><p>7. Choose a workload type. Select the workload type for your database from the choices:</p><ul><li><strong>Data Warehouse</strong> — For this lab, choose <strong>Data Warehouse</strong> as the workload type.</li><li><strong>Transaction Processing</strong> — Alternatively, you could have chosen Transaction Processing as the workload type.</li></ul><p>8. Choose a deployment type. Select the deployment type for your database from the choices:</p><ul><li><strong>Shared Infrastructure</strong> — For this lab, choose <strong>Shared Infrastructure</strong> as the deployment type.</li><li><strong>Dedicated Infrastructure</strong> — Alternatively, you could have chosen Dedicated Infrastructure as the deployment type.</li></ul><p>9. Configure the database:</p><p><strong>Note:</strong> This example is not compatible with the Always Free Autonomous Database.</p><ul><li><strong>Choose database version</strong> — Select a database version from the available versions.</li><li><strong>OCPU count</strong> — Number of CPUs for your service.</li><li><strong>Storage (TB)</strong> — Select your storage capacity in terabytes.</li><li><strong>Auto Scaling</strong> — Check this box to allow the system to automatically use up to three times more CPU and IO resources to meet workload demand.</li><li><strong>New Database Preview</strong> — If a checkbox is available to preview a new database version, do NOT select it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppsooA8ERKj8buPbngQOng.png" /></figure><p>10. Create administrator credentials:</p><ul><li><strong>Password and Confirm Password</strong>: Specify the password for ADMIN user of the service instance.</li></ul><p>The password must meet the following requirements:</p><ul><li>The password must be between 12 and 30 characters long and must include at least one uppercase letter, one lowercase letter, and one numeric character.</li><li>The password cannot contain the username.</li><li>The password cannot contain the double quote (“) character.</li><li>The password must be different from the last 4 passwords used.</li><li>The password must not be the same one set less than 24 hours ago.</li><li>Re-enter the password to confirm it. Make a note of this password</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*CVkY4OhcJ_IMlcyY5kleDA.png" /></figure><p>11. Choose network access. For this lab, Select <strong>Secure access from allowed IPs and VCNs only</strong>, and select <strong>Add My IP Address</strong> for now. Uncheck the box that says <strong>Require mutual TLS authentication</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*lOdXA5BzGstwVshttiWolw.png" /></figure><p>12. Choose a license type.</p><ul><li><strong>License Included</strong>: The cost of the database set at the <a href="https://www.oracle.com/cloud/price-list.html#adw">normal rate</a>.</li><li><strong>Bring Your Own License (BYOL)</strong>: For customers with existing Oracle licenses that you are migrating to the cloud. You pay a reduced price for what you use, but additionally continue paying the support stream.</li></ul><p>For this lab, I will choose <strong>License Included</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-aWqZJe7qe0XxMtS.png" /></figure><p>13. Your instance will begin provisioning. In a few minutes, the state will turn from Provisioning to Available. At this point, your Oracle Autonomous Data Warehouse database is ready to use.</p><h3>Create Graph User</h3><p>Working with Graphs in Graph Studio requires users with granted roles. You can create Graph users with the correct set of roles and privileges using Oracle Database Actions.</p><ol><li>Access <strong>Database Actions</strong> from the Oracle Cloud Infrastructure Console as the ADMIN user</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*141WRwL7b7_ncuEMrpks3w.png" /></figure><p>2. Under <strong>Administration</strong> from the Database Actions Menu, click <strong>Database Users</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*f0IgS8oZ4s5q9_PX0jqURw.png" /></figure><p>3. Click <strong>Create User</strong> on the Database Users page, in the All Users area.</p><p>4. Enter a <strong>user name</strong> (ex. GRAPHUSER, password and enter the password again to confirm the password.</p><p>5. Switch on the <strong>Graph Enable</strong> toggle button for the user.<br>The GRAPH_DEVELOPER role gets automatically assigned to the user.</p><p>6. Switch on the <strong>Web Access </strong>toggle button to provide the new user access to web console in Autonomous Database</p><p>7. Enter a <strong>quota</strong> value on tablespace. For this example, I recommend setting unlimited tablespace.</p><p>8. Click <strong>Create User</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*c-5zt3ADw6tqrDmZT9PDeA.png" /></figure><h3>Log In to Graph Studio</h3><ol><li>From your OCI console, navigate to your Autonomous Database Instance, and select <strong>Tools &gt; Graph Studio.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vX4FDMJH1Ri7HAtlat6W3A.png" /></figure><p>2. Log in as your graph user, and you are ready to start making graphs! You can follow <a href="https://medium.com/@rahultasker/contact-tracing-with-oracle-graph-studio-notebooks-9e8468ffa5b8">this blog</a> to get started with a sample notebook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51VwlL2DbGRPoZsReb9zJg.png" /></figure><h3>Troubleshooting</h3><h4>If you see an unauthorized error when trying to log into Graph Studio, follow these steps</h4><ol><li>Navigate to your Autonomous Database and access Database Actions as the ADMIN user.</li><li>Select SQL Query.</li><li>Run the following statements:</li></ol><pre>DECLARE<br>   PRAGMA AUTONOMOUS_TRANSACTION;<br>   role_exists EXCEPTION;<br>   PRAGMA EXCEPTION_INIT(role_exists, -01921);<br>   TYPE graph_roles_table IS TABLE OF VARCHAR2(50);<br>   graph_roles graph_roles_table;<br> BEGIN<br>   graph_roles := graph_roles_table(<br>     &#39;GRAPH_DEVELOPER&#39;,<br>     &#39;GRAPH_ADMINISTRATOR&#39;,<br>     &#39;PGX_SESSION_CREATE&#39;,<br>     &#39;PGX_SERVER_GET_INFO&#39;,<br>     &#39;PGX_SERVER_MANAGE&#39;,<br>     &#39;PGX_SESSION_READ_MODEL&#39;,<br>     &#39;PGX_SESSION_MODIFY_MODEL&#39;,<br>     &#39;PGX_SESSION_NEW_GRAPH&#39;,<br>     &#39;PGX_SESSION_GET_PUBLISHED_GRAPH&#39;,<br>     &#39;PGX_SESSION_COMPILE_ALGORITHM&#39;,<br>     &#39;PGX_SESSION_ADD_PUBLISHED_GRAPH&#39;);<br>   FOR elem IN 1 .. graph_roles.count LOOP<br>   BEGIN<br>     dbms_output.put_line(&#39;create_graph_roles: &#39; || elem || &#39;: CREATE ROLE &#39; || graph_roles(elem));<br>     EXECUTE IMMEDIATE &#39;CREATE ROLE &#39; || graph_roles(elem);<br>   EXCEPTION<br>     WHEN role_exists THEN<br>       dbms_output.put_line(&#39;create_graph_roles: role already exists. continue&#39;);<br>     WHEN OTHERS THEN<br>       RAISE;<br>     END;<br>   END LOOP;<br> EXCEPTION<br>   when others then<br>     dbms_output.put_line(&#39;create_graph_roles: hit error &#39;);<br>     raise;<br>END;<br>/</pre><pre>GRANT PGX_SESSION_CREATE TO GRAPHUSER;<br>GRANT PGX_SERVER_GET_INFO TO GRAPHUSER;<br>GRANT PGX_SERVER_MANAGE TO GRAPHUSER;<br>GRANT PGX_SESSION_CREATE TO GRAPHUSER;<br>GRANT PGX_SESSION_NEW_GRAPH TO GRAPHUSER;<br>GRANT PGX_SESSION_GET_PUBLISHED_GRAPH TO GRAPHUSER;<br>GRANT PGX_SESSION_MODIFY_MODEL TO GRAPHUSER;<br>GRANT PGX_SESSION_READ_MODEL TO GRAPHUSER;</pre><p>4. Log in again in a fresh window.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e7d1cbf46c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>