<?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 Shreya Chaudhary on Medium]]></title>
        <description><![CDATA[Stories by Shreya Chaudhary on Medium]]></description>
        <link>https://medium.com/@shreya-chaudhary?source=rss-9d61d58508ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vo-8HYNssBKYpFcJ.jpg</url>
            <title>Stories by Shreya Chaudhary on Medium</title>
            <link>https://medium.com/@shreya-chaudhary?source=rss-9d61d58508ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:52:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shreya-chaudhary/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[An Introduction to pySpark and TigerGraph]]></title>
            <link>https://medium.datadriveninvestor.com/an-introduction-to-pyspark-and-tigergraph-9c3396835bc2?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c3396835bc2</guid>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[fraud-detection]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[pyspark]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Sun, 03 Jul 2022 04:35:30 GMT</pubDate>
            <atom:updated>2022-07-22T04:26:32.734Z</atom:updated>
            <content:encoded><![CDATA[<h4>Interacting with TigerGraph’s AMLSim Fraud Detection Graph with pySpark</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*Km9XiUUAGSHWSOTT.jpg" /><figcaption><a href="https://pixabay.com/photos/sparkler-sylvester-dark-shining-477598/">Image from Pixabay</a></figcaption></figure><h3>Introduction</h3><h4>Preface</h4><blockquote>Note: You can find a similar blog post on integrating Spark and TigerGraph <a href="https://shreya-chaudhary.medium.com/an-introduction-to-spark-and-tigergraph-88b07bb9f66b">here</a>. This blog will walk through similar content but will use pySpark instead of Spark. The set up—most of Part I and all of Part II—will be the same, so you can either skip or breifly skim over those sections if you read the other blog.</blockquote><p><a href="https://shreya-chaudhary.medium.com/an-introduction-to-spark-and-tigergraph-88b07bb9f66b">An Introduction to Spark and TigerGraph</a></p><h4>Opening</h4><p>Apache Spark is a data processing software known for its ability to process large datasets and distribute data processing tasks among multiple computers. PySpark is the Python API for Spark and allows Python users to manipulate the data using Spark all in Python. TigerGraph is an enterprise-scale graph database. Together, Spark and PySpark’s abilities with TigerGraph’s graph database can be used to manipulate and analyse big data to make big discoveries.</p><p>This tutorial will walk through the basics of getting started with both pySpark and TigerGraph and using TigerGraph’s JDBC driver to connect the two.</p><h4>Tools</h4><ul><li><a href="https://www.scala-lang.org/">Scala</a> (v2.12.15) → Spark is written in Scala, so Scala will need to be downloaded.</li><li><a href="https://www.java.com/en/">Java</a> (v16.0.1) → This should already be installed on the computer. Java will be used to process the driver.</li><li><a href="https://info.tigergraph.com/enterprise-free">TigerGraph On-Premise</a> (v3.6.0) → TigerGraph on-premise will be used to run and host the database.</li><li><a href="https://github.com/tigergraph/ecosys/tree/master/tools/etl/tg-jdbc-driver">TigerGraph JDBC Driver</a> (v1.3.0) → This will connect Spark with TigerGraph.</li><li><a href="https://spark.apache.org/">Apache Spark</a> (v3.2.1) → The primary data processing software used.</li><li><a href="https://www.python.org/downloads/">Python3</a> (v3.8.9) → The primary language used for this project is Python.</li><li><a href="https://pip.pypa.io/en/stable/">Pip</a> (v22.1.2) → Pip is a Python package installer and an alternate method to install pySpark.</li><li><a href="https://spark.apache.org/docs/latest/api/python/getting_started/index.html">pySpark</a> (v3.2.1) → This is the Python API for Spark that will be used to interact with TigerGraph.</li><li><a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> (v4.2.0.5815) → Docker will be used to run TigerGraph on-premise.</li></ul><h4>Code</h4><p>The full code for this project can be found <a href="https://github.com/GenericP3rson/TigerGraph_pySpark_AML">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGraph_pySpark_AML">GitHub - GenericP3rson/TigerGraph_pySpark_AML: How to Use pySpark with TigerGraph&#39;s AML Sim Fraud Graph</a></p><h4>Outline</h4><ol><li>Installation</li><li>Create the AML Sim Graph</li><li>Create the Project</li><li>Read TigerGraph Data with PySpark</li><li>Resources and Next Steps</li></ol><h3>Part I: Installation</h3><h4>Spark</h4><p>To start off, we will download Spark and Scala using brew, a software that can be used on Linux and Mac OS. Spark is the data manipulation software we will use, and Spark itself is built on Scala.</p><pre>brew install scala &amp;&amp; brew install apache-spark</pre><p>To verify Spark and Scala were downloaded properly, open the Spark shell with:</p><pre>spark-shell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLH6CB23byrKPrwTfAeeHQ.png" /><figcaption>The welcome page of Spark’s shell</figcaption></figure><p>If the shell runs without any errors, Spark is successfully downloaded!</p><h4>PySpark</h4><p>PySpark should get automatically downloaded when installing Spark. To verify it is installed, run pyspark to open the Python Spark shell.</p><pre>pyspark</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IXaaBXL5_wRNDZRosOR4ug.png" /><figcaption>pySpark Shell</figcaption></figure><blockquote>Note: Notice that, unlike the previous shell, this Python shell is preceded with &gt;&gt;&gt; instead of scala&gt;.</blockquote><p>If it is not downloaded, pySpark can also be downloaded via pip. To do so, create a virtual environment and pip install pySpark.</p><pre>python3 -m venv venv</pre><pre>source venv/bin/activate</pre><pre>pip install pyspark</pre><h4>JDBC Driver</h4><p>Download the latest JDBC driver from <a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">Maven</a>.</p><p><a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">Maven Central Repository Search</a></p><p>At the time of publication, the most recent driver is 1.3.0, so that will be used for this blog. Hold on to the tigergraph-jdbc-driver-1.3.0.jar file downloaded; we will use it when creating the repository.</p><h4>TigerGraph On-Premise</h4><p>TigerGraph can be downloaded via Docker. The full instructions to download it can be found <a href="https://docs.tigergraph.com/tigergraph-server/current/getting-started/docker">here</a>.</p><p><a href="https://docs.tigergraph.com/tigergraph-server/current/getting-started/docker">Get Started with Docker - TigerGraph Server</a></p><p>In summary, start Docker on your computer (by <a href="https://docs.docker.com/get-docker/">downloading the Desktop app</a> and running the application). Next, create a folder on your machine to hold the Docker data.</p><pre>mkdir data <br>chmod 777 data</pre><p>Finally, run the TigerGraph Docker image.</p><pre>docker run -d -p 14022:22 -p 9000:9000 -p 14240:14240 --name tigergraph --ulimit nofile=1000000:1000000 -v ~/data:/home/tigergraph/mydata -t docker.tigergraph.com/tigergraph:latest</pre><p>To enter the TigerGraph shell, you can ssh into the solution.</p><pre>ssh -p 14022 tigergraph@localhost</pre><p>At the password prompt, enter tigergraph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGTCrp4Pfb3MFpa0GBcFDg.png" /><figcaption>TigerGraph Welcome Message</figcaption></figure><p>Perfect! Your TigerGraph box is ready to load a graph!</p><h3>Part II: Create the AML Sim Graph</h3><h4>Set Up</h4><p>To begin, run gadmin start all in the TigerGraph shell. This will start all TigerGraph services.</p><pre>gadmin start all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODBhU7QnlVa1Kj_zUqbeLQ.png" /><figcaption>gadmin start all</figcaption></figure><p>The graph this tutorial will load is the <a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab">AML Sim Graph</a>. To start off, clone the repository.</p><p><a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab">GitHub - TigerGraph-DevLabs/AMLSim_Python_Lab</a></p><pre>git clone <a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab.git">https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab.git</a></pre><pre>cd AMLSim_Python_Lab</pre><p>This repository contains GSQL files of the documents to create the graph.</p><h4>Schema</h4><p>To build the schema, run schema.gsql.</p><pre>gsql db_scripts/schema/schema.gsql</pre><p>This will create the AMLSim graph.</p><h4>Loading Jobs</h4><p>Next, to load the data, run the three loading files.</p><pre>cd db_scripts/load</pre><pre>gsql load_job_accounts.gsql<br>gsql load_job_alerts.gsql<br>gsql load_job_transactions.gsql</pre><pre>cd ../..</pre><p>This will load the CSV data in the data folder to the graph.</p><h4>Install Queries</h4><p>Finally, install queries to the graph database. This tutorial will only walk through an example of running one query, but you may install as many as you would like.</p><pre>gsql db_scripts/query/selectAccountTx.gsql</pre><h4>Exploring in GraphStudio</h4><p>To view the AMLSim graph visually, you can open <a href="http://localhost:14240/">http://localhost:14240/</a> to view GraphStudio. There, you can access the schema, view the stats of the loaded data, and run queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8MzpK6FQmkJw8UR_w898Q.png" /><figcaption>Data loading page in GraphStudio</figcaption></figure><h3>Part III: Create the Project</h3><h4>Project Structure</h4><p>Unlike Scala and Java, Python Scala projects do not need a specific format type. All of the files for this project will be located in the same folder.</p><pre>index.py</pre><pre>tigergraph-jdbc-driver-1.3.0.jar</pre><blockquote>Note: The version and naming syntax of the .jar driver can change; just ensure it is the file downloaded from <a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">Maven</a>.</blockquote><h4>index.py</h4><p>Start index.py by importing SparkSession from pySpark.</p><pre>from pyspark.sql import SparkSession</pre><p>Next, set the spark variable using SparkSession.builder.</p><pre>spark = SparkSession.builder \</pre><pre>.appName(&quot;TigerGraphAnalysis&quot;) \</pre><pre>.config(&quot;spark.driver.extraClassPath&quot;, &quot;/usr/local/Cellar/apache-spark/3.2.1/libexec/jars/*:tigergraph-jdbc-driver-1.3.0.jar&quot;) \</pre><pre>.getOrCreate()</pre><p>The appName is simply the name of the project—in my case, “TigerGraphAnalysis.” The .config sets the driver’s path. This input for this contains the directory to the Spark jars and the path to the driver. If you installed Spark via Homebrew, the location will be like the above, /usr/local/Cellar/apache-spark/3.2.1/libexec/jars/*. Next, if the driver is in the same folder as the file, you can simply enter the filename, tigergraph-jdbc-driver-1.3.0.jar. Finally, combine the two paths with a colon and enter it in the config: /usr/local/Cellar/apache-spark/3.2.1/libexec/jars/*:tigergraph-jdbc-driver-1.3.0.jar.</p><h4>Run the Project</h4><p>To run the project, spark-submit must be used to run the file and the driver must be specified with the --jars flag.</p><pre>spark-submit --jars tigergraph-jdbc-driver-1.3.0.jar index.py</pre><p>With that, we are set to begin interacting with the AMLSim graph!</p><h3>Part IV: Read TigerGraph Data with PySpark</h3><p>In general, pySpark’s syntax is similar to Spark’s syntax.</p><h4>Read Vertices</h4><pre>jdbcDF1 = spark.read \</pre><pre>.format(&quot;jdbc&quot;) \</pre><pre>.option(&quot;driver&quot;, &quot;com.tigergraph.jdbc.Driver&quot;) \</pre><pre>.option(&quot;url&quot;, &quot;jdbc:tg:http://127.0.0.1:14240&quot;) \</pre><pre>.option(&quot;user&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;password&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;graph&quot;, &quot;AMLSim&quot;) \</pre><pre>.option(&quot;dbtable&quot;, &quot;vertex Transaction&quot;) \</pre><pre>.option(&quot;limit&quot;, &quot;1000&quot;) \</pre><pre>.option(&quot;debug&quot;, &quot;0&quot;) \</pre><pre>.load()</pre><pre>jdbcDF1.show()</pre><p>To start, reading vertices contain options to specify the usage of the JDBC driver and options to specify graph information and credentials. To select a vertex, the dbtable must be vertex followed by the vertex type—in this case, Transaction. Finally, limit specifies the maximum number of vertices to return.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*iT4ctNGsuf2Y5hlzG5M-Qw.png" /><figcaption>Vertex results</figcaption></figure><h4>Read Edges</h4><pre>jdbcDF2 = spark.read \</pre><pre>.format(&quot;jdbc&quot;) \</pre><pre>.option(&quot;driver&quot;, &quot;com.tigergraph.jdbc.Driver&quot;) \</pre><pre>.option(&quot;url&quot;, &quot;jdbc:tg:http://127.0.0.1:14240&quot;) \</pre><pre>.option(&quot;user&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;password&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;graph&quot;, &quot;AMLSim&quot;) \</pre><pre>.option(&quot;dbtable&quot;, &quot;edge RECEIVE_TRANSACTION&quot;) \</pre><pre>.option(&quot;limit&quot;, &quot;1000&quot;) \</pre><pre>.option(&quot;source&quot;, &quot;9934&quot;) \</pre><pre>.option(&quot;debug&quot;, &quot;0&quot;) \</pre><pre>.load()</pre><pre>jdbcDF2.show()</pre><p>The function to read edges is similar. The dbtable, in this case, is edge followed by the edge type—for this example, RECIEVE_TRANSACTION. Once again, limit is the maximum number of edges. Finally, source is the id of the source vertex of the edge. For this example, the source vertex is a Transaction vertex with the id of 9934.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*xLEIu5UjBzI689Iz6N_1lQ.png" /></figure><p>There is only one edge connected to Transaction 9934.</p><h4>Run Queries</h4><pre>jdbcDF3 = spark.read \</pre><pre>.format(&quot;jdbc&quot;) \</pre><pre>.option(&quot;driver&quot;, &quot;com.tigergraph.jdbc.Driver&quot;) \</pre><pre>.option(&quot;url&quot;, &quot;jdbc:tg:http://127.0.0.1:14240&quot;) \</pre><pre>.option(&quot;user&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;password&quot;, &quot;tigergraph&quot;) \</pre><pre>.option(&quot;graph&quot;, &quot;AMLSim&quot;) \</pre><pre>.option(&quot;dbtable&quot;, &quot;query selectAccountTx(acct=9934)&quot;) \</pre><pre>.option(&quot;debug&quot;, &quot;0&quot;) \</pre><pre>.load()</pre><pre>jdbcDF3.show()</pre><p>Finally, to run queries, the dbtable is query followed by the name of the installed query and the query’s parameters. In the example, the query selectAccountTx is run to find all transactions to and from the account with id 9934.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*7TNXTlcbTd0NquJxh10ULA.png" /><figcaption>Query results</figcaption></figure><h3>Part V: Resources and Next Steps</h3><p>Congrats on completing this blog! If you made it this far, you can now interact with TigerGraph via Spark. To find the full code, check out the GitHub repository <a href="https://github.com/GenericP3rson/TigerGraph_pySpark_AML">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGraph_pySpark_AML">GitHub - GenericP3rson/TigerGraph_pySpark_AML: How to Use pySpark with TigerGraph&#39;s AML Sim Fraud Graph</a></p><p>In addition, check out the TigerGraph-Spark connector documentation <a href="https://docs.tigergraph.com/tigergraph-server/current/data-loading/spark-connection-via-jdbc-driver">here</a>.</p><p><a href="https://docs.tigergraph.com/tigergraph-server/current/data-loading/spark-connection-via-jdbc-driver">Spark Connection Via JDBC Driver - TigerGraph Server</a></p><p>Finally, check out the introduction to Spark tutorials <a href="https://www.tutorialspoint.com/apache_spark/apache_spark_introduction.htm">here</a>.</p><p><a href="https://www.tutorialspoint.com/apache_spark/apache_spark_introduction.htm">Apache Spark - Introduction</a></p><p>From here, you can continue to explore pySpark and TigerGraph to create more complex projects. For example, integrating Spark’s MLlib and TigerGraph’s Graph Data Science Algorithms to detect fraudulent transactions could be an awesome way to couple both software’s strengths.</p><p>Good luck exploring and building projects! If you have any questions or simply want to chat with other developers or show off some of your projects, feel free to join the TigerGraph <a href="https://community.tigergraph.com/">Discourse</a> and <a href="http://discord.gg/tigergraph">Discord</a>!</p><p><a href="https://community.tigergraph.com/">TigerGraph</a></p><p>Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p>Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c3396835bc2" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/an-introduction-to-pyspark-and-tigergraph-9c3396835bc2">An Introduction to pySpark and TigerGraph</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Spark and TigerGraph]]></title>
            <link>https://medium.datadriveninvestor.com/an-introduction-to-spark-and-tigergraph-88b07bb9f66b?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b07bb9f66b</guid>
            <category><![CDATA[fraud-detection]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Sat, 02 Jul 2022 04:56:34 GMT</pubDate>
            <atom:updated>2022-07-22T04:26:30.079Z</atom:updated>
            <content:encoded><![CDATA[<h4>Interacting with TigerGraph’s AMLSim Fraud Detection Graph in Spark</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*emilzl7J7EiuGEWt.jpg" /><figcaption><a href="https://pixabay.com/photos/bright-celebration-dark-fire-1853624/">Image from Pixabay</a></figcaption></figure><h3>Introduction</h3><p>Apache Spark is a data processing software known for its ability to process large datasets and distribute data processing tasks among multiple computers. TigerGraph is an enterprise-scale graph database. Together, the two can be used to manipulate and analyse big data to make big discoveries.</p><p>This tutorial will walk through the basics of getting started with both Spark and TigerGraph and using TigerGraph’s JDBC driver to connect the two.</p><h4>Tools</h4><ul><li><a href="https://www.scala-lang.org/">Scala</a> (v2.12.15) → Scala will be the primary language of the code in this blog.</li><li><a href="https://www.java.com/en/">Java</a> (v16.0.1) → This should already be installed on the computer. Java will be used to process the driver.</li><li><a href="https://www.scala-sbt.org/">Sbt</a> (v1.6.2) → Sbt is the software to build Scala files.</li><li><a href="https://info.tigergraph.com/enterprise-free">TigerGraph On-Premise</a> (v3.6.0) → TigerGraph on-premise will be used to run and host the database.</li><li><a href="https://github.com/tigergraph/ecosys/tree/master/tools/etl/tg-jdbc-driver">TigerGraph JDBC Driver</a> (v1.3.0) → This will be used to connect Spark with TigerGraph.</li><li><a href="https://spark.apache.org/">Apache Spark</a> (v3.2.1) → The primary data processing software used.</li><li><a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a> (v4.2.0.5815) → Docker will be used to run TigerGraph on-premise.</li></ul><h4>Code</h4><p>The full code for this project can be found <a href="https://github.com/GenericP3rson/TigerGraph_Spark_AML">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGraph_Spark_AML">GitHub - GenericP3rson/TigerGraph_Spark_AML: How to Use Spark with TigerGraph&#39;s AML Sim Fraud Graph</a></p><h4>Outline</h4><ol><li>Installation</li><li>Create the AML Sim Graph</li><li>Create the Project</li><li>Interact with the Graph with Spark!</li><li>Resources and Next Steps</li></ol><h3>Part I: Installation</h3><h4>Spark</h4><p>To start off, we will download Spark using brew, a software that can be used on Linux and Mac OS.</p><pre>brew install apache-spark</pre><p>Spark can be used with a number of languages, including Scala which will be used in this blog.</p><pre>brew install scala</pre><p>Finally, to package and execute the scala code, we will use sbt.</p><pre>brew install sbt</pre><p>To verify Spark and Scala were downloaded properly, open the Spark shell with:</p><pre>spark-shell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLH6CB23byrKPrwTfAeeHQ.png" /><figcaption>The welcome page of Spark’s shell</figcaption></figure><p>If the shell runs without any errors, Spark is successfully downloaded!</p><h4>JDBC Driver</h4><p>Download the latest JDBC driver from <a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">Maven</a>.</p><p><a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">Maven Central Repository Search</a></p><p>At the time of publication, the most recent driver is 1.3.0, so that will be used for this blog. Hold on to the tigergraph-jdbc-driver-1.3.0.jar file downloaded; we will use it when creating the repository.</p><h4>TigerGraph On-Premise</h4><p>TigerGraph can be downloaded via Docker. The full instructions to download it can be found <a href="https://docs.tigergraph.com/tigergraph-server/current/getting-started/docker">here</a>.</p><p><a href="https://docs.tigergraph.com/tigergraph-server/current/getting-started/docker">Get Started with Docker - TigerGraph Server</a></p><p>In summary, start Docker on your computer (by <a href="https://docs.docker.com/get-docker/">downloading the Desktop app</a> and running the application). Next, create a folder on your machine to hold the Docker data.</p><pre>mkdir data <br>chmod 777 data</pre><p>Finally, run the TigerGraph Docker image.</p><pre>docker run -d -p 14022:22 -p 9000:9000 -p 14240:14240 --name tigergraph --ulimit nofile=1000000:1000000 -v ~/data:/home/tigergraph/mydata -t docker.tigergraph.com/tigergraph:latest</pre><p>To enter the TigerGraph shell, you can ssh into the solution.</p><pre>ssh -p 14022 tigergraph@localhost</pre><p>At the password prompt, enter tigergraph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGTCrp4Pfb3MFpa0GBcFDg.png" /><figcaption>TigerGraph Welcome Message</figcaption></figure><p>Perfect! Your TigerGraph box is ready to load a graph!</p><h3>Part II: Create the AML Sim Graph</h3><h4>Set Up</h4><p>To begin, run gadmin start all. This will start all TigerGraph services.</p><pre>gadmin start all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODBhU7QnlVa1Kj_zUqbeLQ.png" /><figcaption>gadmin start all</figcaption></figure><p>The graph this tutorial will load is the <a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab">AML Sim Graph</a>. To start off, clone the repository.</p><p><a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab">GitHub - TigerGraph-DevLabs/AMLSim_Python_Lab</a></p><pre>git clone <a href="https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab.git">https://github.com/TigerGraph-DevLabs/AMLSim_Python_Lab.git</a></pre><pre>cd AMLSim_Python_Lab</pre><p>This repository contains GSQL files of the documents to create the graph.</p><h4>Schema</h4><p>To build the schema, run schema.gsql.</p><pre>gsql db_scripts/schema/schema.gsql</pre><p>This will create the AMLSim graph.</p><h4>Loading Jobs</h4><p>Next, to load the data, run the three loading files.</p><pre>cd db_scripts/load</pre><pre>gsql load_job_accounts.gsql<br>gsql load_job_alerts.gsql<br>gsql load_job_transactions.gsql</pre><pre>cd ../..</pre><p>This will load the CSV data in the data folder to the graph.</p><h4>Install Queries</h4><p>Finally, install queries to the graph database. This tutorial will only walk through an example of running one query, but you may install as many as you would like.</p><pre>gsql db_scripts/query/selectAccountTx.gsql</pre><h4>Exploring in GraphStudio</h4><p>To view the AMLSim graph visually, you can open <a href="http://localhost:14240/">http://localhost:14240/</a> to view GraphStudio. There, you can access the schema, view the stats of the loaded data, and run queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8MzpK6FQmkJw8UR_w898Q.png" /><figcaption>Data loading page in GraphStudio</figcaption></figure><h3>Part III: Create the Project</h3><h4>Folder Structure</h4><p>With the graph created and running, you can create a local folder on your device to interact with TigerGraph via Spark. Scala Spark projects have a specific folder structure, as depicted below.</p><pre>src/<br>  main/<br>    scala/<br>      Main.scala<br>build.sbt<br>tigergraph-jdbc-driver-1.3.0.jar</pre><blockquote>Note: tigergraph-jdbc-driver-1.3.0.jar is the JDBC file created in Part I. The version and naming convention could have changed; once again, you can download the updated file <a href="https://search.maven.org/artifact/com.tigergraph/tigergraph-jdbc-driver">here</a>.</blockquote><p>The rest of the programmatic files and folders will be created automatically.</p><h4>build.sbt</h4><p>build.sbt contains general information about the project, specifically the name/version and the dependencies. For example, my build.sbt file was formatted like so:</p><pre>name := &quot;TigerGraph Spark Sample Project&quot;</pre><pre>version := &quot;1.0&quot;</pre><pre>scalaVersion := &quot;2.12.15&quot;</pre><pre>libraryDependencies += &quot;org.apache.spark&quot; %% &quot;spark-sql&quot; % &quot;3.3.0&quot;</pre><h4>Main.scala Format</h4><p>The next step will walk through the entirety of building the connector. This section, however, has the overall structure of the code in Main.scala.</p><pre>import org.apache.spark.sql.SparkSession</pre><pre>object Main {</pre><pre>  def main(args: Array[String]) {</pre><pre>    val spark = SparkSession.builder.appName(&quot;TigerGraph Application&quot;).getOrCreate()</pre><pre>    // Code goes here!</pre><pre>  }</pre><pre>}</pre><p>This imports SparkSession and creates one, initialising the value of spark, a variable we will use throughout the functions. All the future functions will be where the // Code goes here! comment is located.</p><h4>Running the Code</h4><p>Running the code has two parts: packaging and executing. To package, use the sbt library from before.</p><pre>sbt package</pre><p>Next, for executing the code, run spark-submit, passing parameters of the class of the file (Main for the above code snippet) and the location of the TigerGraph JDBC jar file.</p><pre>spark-submit --class &quot;Main&quot; --jars tigergraph-jdbc-driver-1.3.0.jar target/scala-2.12/tigergraph-spark-sample-project_2.12-1.0.jar</pre><h3>Part IV: Interact with the Graph with Spark!</h3><p>Finally, with everything set up, we can enter the fun part: interacting with the AML Sim graph with Spark.</p><h4>Read Vertices</h4><p>To start, let’s read 1,000 of the Transaction vertices with Spark.</p><pre>val jdbcDF1 = spark.read.format(&quot;jdbc&quot;).options(</pre><pre>Map(</pre><pre>&quot;driver&quot; -&gt; &quot;com.tigergraph.jdbc.Driver&quot;,</pre><pre>&quot;url&quot; -&gt; &quot;jdbc:tg:http://127.0.0.1:14240&quot;,</pre><pre>&quot;username&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;password&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;graph&quot; -&gt; &quot;AMLSim&quot;, // graphname</pre><pre>&quot;dbtable&quot; -&gt; &quot;vertex Transaction&quot;, // vertex type</pre><pre>&quot;limit&quot; -&gt; &quot;1000&quot;, // max number of vertices</pre><pre>&quot;debug&quot; -&gt; &quot;0&quot;)).load()</pre><pre>jdbcDF1.show()</pre><p>The parameters of spark.read are fairly intuitive: the code is reading from the jdbc driver (passed via the jar file when the code is executed). The URL is the endpoint, and the username, password, and graph are graph details and credentials. Finally, the dbtable contains the vertex type (Transaction) and limit is the maximum number of vertices to show.</p><p>Running this displays the top twenty Transaction vertices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZgPcDbzFtojVU07g6GBVsA.png" /><figcaption>Output of get vertices</figcaption></figure><h4>Read Edges</h4><p>The function to read edges is similar to the function to read vertices with only a few changes.</p><pre>val jdbcDF2 = spark.read.format(&quot;jdbc&quot;).options(</pre><pre>Map(</pre><pre>&quot;driver&quot; -&gt; &quot;com.tigergraph.jdbc.Driver&quot;,</pre><pre>&quot;url&quot; -&gt; &quot;jdbc:tg:http://127.0.0.1:14240&quot;,</pre><pre>&quot;username&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;password&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;graph&quot; -&gt; &quot;AMLSim&quot;, // graphname</pre><pre>&quot;dbtable&quot; -&gt; &quot;edge RECEIVE_TRANSACTION&quot;, // edge type</pre><pre>&quot;limit&quot; -&gt; &quot;10&quot;, // max number of edges</pre><pre>&quot;source&quot; -&gt; &quot;9934&quot;, // id of the source vertex of edge</pre><pre>&quot;debug&quot; -&gt; &quot;0&quot;)).load()</pre><pre>jdbcDF2.show()</pre><p>The initial parameters are the same. The dtable is edge followed by the edge type. Similarly, there is a limit to the number of edges. Finally, the source is the ID of the source vertex of the edges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*7Q3rfO9x4Te6cgGLz_6yNw.png" /><figcaption>Output of get edges</figcaption></figure><p>When run, there is only one edge with the source of id 9934.</p><h4>Run Query</h4><p>Finally, we will run the query selectAccountTx to grab all the transactions from a certain account. Once again, the syntax is similar to the others.</p><pre>val jdbcDF3 = spark.read.format(&quot;jdbc&quot;).options(</pre><pre>Map(</pre><pre>&quot;driver&quot; -&gt; &quot;com.tigergraph.jdbc.Driver&quot;,</pre><pre>&quot;url&quot; -&gt; &quot;jdbc:tg:http://127.0.0.1:14240&quot;,</pre><pre>&quot;username&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;password&quot; -&gt; &quot;tigergraph&quot;,</pre><pre>&quot;graph&quot; -&gt; &quot;AMLSim&quot;, // graph name</pre><pre>&quot;dbtable&quot; -&gt; &quot;query selectAccountTx(acct=9934)&quot;, // query name &amp; parameters</pre><pre>&quot;debug&quot; -&gt; &quot;0&quot;)).load()</pre><pre>jdbcDF3.show()</pre><p>The only difference is dbtable has query and specifies everything—the query name and parameters—in the string. In the example, we are retrieving the account with an ID of 9934.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*npLdc2kI-7Ssz_1MQQ5cVQ.png" /><figcaption>Output of running a query</figcaption></figure><p>Notice that in the query logic itself, it looks at multiple edge types, unlike the sample code for getting the singular edge type.</p><h3>Part V: Resources and Next Steps</h3><p>Congrats on finishing this tutorial! Find the full code for the project <a href="https://github.com/GenericP3rson/TigerGraph_Spark_AML">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGraph_Spark_AML">GitHub - GenericP3rson/TigerGraph_Spark_AML: How to Use Spark with TigerGraph&#39;s AML Sim Fraud Graph</a></p><p>This tutorial is a simple example of how to connect TigerGraph with Spark. Future projects can delve deeper into Spark functionalities to create cool projects or expand on the usage of the graph database.</p><p>The full documentation for TigerGraph and Spark can be found <a href="https://docs.tigergraph.com/tigergraph-server/current/data-loading/spark-connection-via-jdbc-driver">here</a>.</p><p><a href="https://docs.tigergraph.com/tigergraph-server/current/data-loading/spark-connection-via-jdbc-driver">Spark Connection Via JDBC Driver - TigerGraph Server</a></p><p>Finally, if you have any questions or want to join or share a project, feel free to join the <a href="https://community.tigergraph.com/">community forum</a> or <a href="https://discord.gg/tigergraph">Discord</a>!</p><p>Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p>Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b07bb9f66b" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/an-introduction-to-spark-and-tigergraph-88b07bb9f66b">An Introduction to Spark and TigerGraph</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microblog: Customising Python Streamlit Dashboards with Custom Themes and More!]]></title>
            <link>https://blog.devgenius.io/microblog-customising-python-streamlit-dashboards-with-custom-themes-and-more-f09084d23ae7?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/f09084d23ae7</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[dashboard]]></category>
            <category><![CDATA[fonts]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Wed, 15 Jun 2022 04:46:38 GMT</pubDate>
            <atom:updated>2022-06-15T07:16:42.931Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Quick Guide on Creating Streamlit Themes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*P0EAbhuwtv7KRPQQ.jpg" /><figcaption><a href="https://pixabay.com/photos/watercolor-colour-art-paint-brush-3445376/">Image from Pixabay</a></figcaption></figure><h3>Introduction</h3><p>While working with Streamlit dashboard to quickly and easily model data (look for a blog coming soon!), I decided to branch out of the standard Streamlit elements to spice my Python dashboard with some custom designs. Streamlit offers this with their themes feature, but with some custom HTML, you can morph the themes even more to your liking. If you are also interested in adding some custom pizzazz to your Streamlit dashboard, check out this blog!</p><h3>Creating a Global Streamlit Theme</h3><p>To create <a href="https://docs.streamlit.io/library/advanced-features/theming">a global custom Streamlit them</a>e, you will need to modify the configuration file at ~/.streamlit, so on Mac or Linux, navigate to your home directory then .streamlit.</p><pre>cd ~/.streamlit</pre><p>Next, search for the config.toml file.</p><pre>find config.toml</pre><p>If the file is not present, create one! Running streamlit config show will return the configuration options; assign this value to the config.toml.</p><pre>streamlit config show &gt; config.toml </pre><blockquote>Want a quick cheatsheet to Linux commands? Check out <a href="https://shreya-chaudhary.medium.com/linux-prerequisites-for-cybersecurity-beginners-8d8614588612">this blog</a>!</blockquote><p>Now you can edit the file using your favourite text editor. Under the [theme] tag, you can alter the primary, background, secondary background, and text colours and font type (from the three options). If you only want to change part of a base model, you can also specify a base—either light or dark.</p><pre>[theme]</pre><pre>base=&quot;light&quot;<br>primaryColor=&quot;#FF0000&quot;<br>backgroundColor=&quot;#FFFFFF&quot;<br>secondaryBackgroundColor=&quot;#999999&quot;<br>textColor=&quot;#000000&quot;<br>font=&quot;serif&quot;</pre><p>To find what exactly each element changes, check out <a href="https://docs.streamlit.io/library/advanced-features/theming">the docs</a>! Save the document and run your application, and you’ll find that your application is now running with your new custom theme!</p><h3>More Customisation?</h3><p>To add even more customisation—including custom fonts—you can use custom CSS and HTML. To leverage the custom elements, simply add the parameter allow_unsafe_html = True to the st.write function.</p><blockquote>Why is it unsafe? This is Streamlit’s way of letting users know that a malicious third-party <a href="https://discuss.streamlit.io/t/why-is-using-html-unsafe/4863/2">could inject code into the dashboard</a>.</blockquote><p>For example, to use a custom font, you can copy and paste the CSS from your favourite <a href="https://fonts.google.com/">Google fonts</a> and add it to the top of the dashboard.</p><pre>st.write(&quot;&quot;&quot;</pre><pre>&lt;style&gt;</pre><pre>@import url(https://medium.com/&#39;https://fonts.googleapis.com/css2?family=Fascinate&#39;);</pre><pre>html, body, [class*=&quot;css&quot;]  {<br>   font-family: &#39;Fascinate&#39;, cursive;<br>}</pre><pre>&lt;/style&gt;</pre><pre>&quot;&quot;&quot;, unsafe_allow_html=True)</pre><p>This will change the entire dashboard to use the Fascinate font.</p><p>You can also integrate CSS with the Streamlit dashboard to customise font colour. One of the limitations of the theme options in Streamlit is that it requires almost all text to be one colour. However, with a sprinkle of CSS, you can change the text colour in areas for example with a darker secondary background.</p><pre>st.write(&#39;&lt;p style = &quot;color:red&quot;&gt;Roses are red&lt;/p&gt;&lt;p style = &quot;color:blue&quot;&gt;Violets are blue!&lt;/p&gt;&#39;, unsafe_allow_html=True)</pre><p>Here’s the result of our exploration of semi-absurd further customisation!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*nGDC7_XT8TPrumSdnKGEbg.png" /><figcaption>Results of the Exploration</figcaption></figure><h3>Resources</h3><p>Congrats on finishing the blog! Armed with this power, you can now build and create custom Streamlit themes and go beyond the basic custom themes to create a dashboard fitting for your tastes!</p><p>I would strongly recommend checking out the Streamlit documentation with more details on building custom themes with Streamlit.</p><p><a href="https://docs.streamlit.io/library/advanced-features/theming">Theming - Streamlit Docs</a></p><p>Furthermore, if you are a Python developer interested in exploring a bit of CSS to spruce up your dashboard, w3schools is an awesome and free site to learn CSS to create the greatest dashboard.</p><p><a href="https://www.w3schools.com/css/">W3Schools.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f09084d23ae7" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/microblog-customising-python-streamlit-dashboards-with-custom-themes-and-more-f09084d23ae7">Microblog: Customising Python Streamlit Dashboards with Custom Themes and More!</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linking Wikipedia Articles in a Knowledge Graph with TigerGraph, BeautifulSoup, and Yake]]></title>
            <link>https://medium.datadriveninvestor.com/linking-wikipedia-articles-in-a-knowledge-graph-with-tigergraph-beautifulsoup-and-yake-52dd3261a86d?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/52dd3261a86d</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[keyword-extraction]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[yake]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Tue, 14 Jun 2022 04:50:34 GMT</pubDate>
            <atom:updated>2022-07-23T06:43:43.211Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Step-by-Step Guide to Building a TigerGraph Wikipedia Graph</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*glDpY7-sRwW5kdQV.jpg" /><figcaption>Image from <a href="https://pixabay.com/photos/news-newsletter-newspaper-1591767/">Pixabay</a></figcaption></figure><h3>Objective</h3><p>In this blog, you will learn how to create a Wikipedia TigerGraph Graph using tools and skills including webscraping and keyword extraction to collect and connect data. After creating this Wikipedia Graph, you can leverage the power of the graph to build cool applications on top of it, such as a search or algorithms to become the greatest WikiSpeedRacer.</p><h4>Tools</h4><ul><li><a href="https://tgcloud.io/">TigerGraph Cloud</a>: Place to host TigerGraph solutions</li><li><a href="https://docs.tigergraph.com/pytigergraph/current/intro/">pyTigerGraph</a>: Library to interact with TigerGraph solution in Python</li><li><a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">BeautifulSoup</a>: Library for working with HTML files</li><li><a href="https://liaad.github.io/yake/">Yake!</a>: Unsupervised keyword extractor</li></ul><h4>Agenda</h4><ul><li>Prerequisite: Set up a TigerGraph Cloud Solution</li><li>Step I: Create the Schema</li><li>Step II: Load the Data</li><li>Step III: Write Queries!</li><li>Resources, Next Steps, and More!</li></ul><h3>Prerequisite: Set up a TigerGraph Cloud Solution</h3><p>To begin, you will need to create a new solution on <a href="https://tgcloud.io/">TigerGraph Cloud</a>. Check out <a href="https://docs.tigergraph.com/cloud/start/getting-started">this link</a> for a thorough walk-through of how to do so. To start this blog, I’ll walk you through a high-level overview of creating a solution.</p><p><a href="https://docs.tigergraph.com/cloud/start/getting-started">Getting Started - TigerGraph Cloud</a></p><p>First, navigate to <a href="https://tgcloud.io/">https://tgcloud.io/</a>, select the “My Solutions” tab, and finally press the blue “Create Solution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_nXI5EgDwefw8aG2WZ-Zqg.png" /><figcaption>Navigate to the “My Solutions” tab then select “Create Solution”</figcaption></figure><p>On the first page, select the blank option. This will spin up an empty solution on which we can add the WikiGraph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SU4272zghlsxrJw3BiO9kg.png" /><figcaption>Select “Blank”</figcaption></figure><p>Leave the second page as the default; this will essentially spin up a free TigerGraph Cloud instance. On the third page, customise the details and credentials of your graph appropriately, keeping note of the options you decide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p8zlEb_iIYJYdMog" /><figcaption>Configure your graph details</figcaption></figure><p>On the fourth step, verify everything looks good. Finally, press submit and wait a few minutes till the solution status is “Ready”!</p><h3>Step I: Create the Schema</h3><p>The first step to creating a graph is to create its schema. The schema for this particular graph will be relatively simple: a Doc vertex will connect to other Doc vertices via a LINKS_TO edge and will connect to an Entity edge via a DOC_ENTITY edge. Both the LINKS_TO and DOC_ENTITY edges will have weights, and the Doc vertex will also contain information including the first paragraph of the Wikipedia article, the name of the article, and the link to the article itself.</p><p>This blog will walk through creating the schema using <a href="https://docs.tigergraph.com/pytigergraph/current/intro/">pyTigerGraph</a>. To start, import pyTigerGraph (specifically pyTG GDS, as we will import GDS algorithms later in the blog).</p><pre>pip install pyTigerGraph[gds]</pre><pre>import pyTigerGraph as tg</pre><p>Next, create a connection with the solution you just created.</p><pre>conn = tg.TigerGraphConnection(host = &quot;https://SUBDOMAIN.i.tgcloud.io/&quot;, password = &quot;PASSWORD&quot;)</pre><p>For the example in prerequisites, the connection would be:</p><pre>conn = tg.TigerGraphConnection(host = &quot;https://wikigraph.i.tgcloud.io/&quot;, password = &quot;tigergraph&quot;)</pre><p>Fantastic! Now, using pyTigerGraph’s <a href="https://docs.tigergraph.com/pytigergraph/current/core-functions/gsql">GSQL interface</a>, create the schema as previously described.</p><pre>conn.gsql(&#39;&#39;&#39;</pre><pre>USE GLOBAL</pre><pre>CREATE VERTEX Doc(PRIMARY_ID id STRING, title STRING, content STRING) WITH PRIMARY_ID_AS_ATTRIBUTE = &quot;true&quot;<br>CREATE VERTEX Entity(PRIMARY_ID entity STRING) WITH PRIMARY_ID_AS_ATTRIBUTE = &quot;true&quot;</pre><pre>CREATE DIRECTED EDGE LINKS_TO(FROM Doc, TO Doc, weight DOUBLE)<br>CREATE UNDIRECTED EDGE DOC_ENTITY(FROM Doc, TO Entity, weight DOUBLE)</pre><pre>CREATE GRAPH WikiGraph(Doc, Entity, LINKS_TO, DOC_ENTITY)</pre><pre>&#39;&#39;&#39;)</pre><p>Finally, once the code is successfully executed, edit the credentials to be specific to the WikiGraph just created.</p><pre>conn.graphname = &quot;WikiGraph&quot;<br>conn.apiToken = conn.getToken(conn.createSecret())</pre><h3>Step II: Load the Data</h3><p>Loading the data will consist of three sections: scraping, keyword extraction, and upserting. The entire load job will be a recursive function crawling through Wikipedia to grab and upsert the articles.</p><h4>Scraping</h4><p>BeautifulSoup and Requests will work together to scrape Wikipedia and extract the text from the HTML tags.</p><p>To start, use requests to get the contents of a link—for example, <a href="https://en.wikipedia.org/wiki/Graph_database">https://en.wikipedia.org/wiki/Graph_database</a>.</p><pre>import requests</pre><pre>response = requests.get(url = <a href="https://en.wikipedia.org/wiki/Graph_database">https://en.wikipedia.org/wiki/Graph_database</a>)</pre><p>Next, run this data through BeautifulSoup’s HTML parser.</p><pre>from bs4 import BeautifulSoup</pre><pre>soup = BeautifulSoup(response.content, &#39;html.parser&#39;)</pre><p>Perfect! We can now grab text by tags. For example, to grab the content of the first paragraph, we can use .find(&#39;p&#39;) then run .get_text().</p><pre>first_paragraph = soup.find(&#39;p&#39;).get_text()</pre><p>To find links, we can use .find(&#39;a&#39;).</p><pre>links = soup.find(&#39;a&#39;)</pre><p>Fantastic! We have all the tools we need to scrape through the Wikipedia website.</p><h4>Keyword Extraction</h4><p>While there are multiple keyword extraction libraries—some of the most notable being SpaCy and NLTK—I opted to use Yake!. From some sample tests, from the data I was targetted, Yake! was able to quickly and fairly accurately extract keywords with a specific weight, better than other packages like multi-rake. Depending on the data you plan to extract, however, this can vary, so I would recommend exploring a few packages—or training your own algorithm—to find what will best extract keywords.</p><p>To start, import Yake!.</p><pre>pip install yake</pre><p>The Yake! syntax is fairly straightforward: create a new keyword extractor then extract keywords. Here is an example of using it on the first_paragraph:</p><pre>kw_extractor = yake.KeywordExtractor()</pre><pre>keywords = kw_extractor.extract_keywords(first_paragraph)</pre><p>The keywords variable will return the keywords extracted plus a score (with values closer to 0 being better). Note that yake.KeywordExtractor() has a few parameters it takes in to help personalise keyword extraction. Notably, by default, its n=3, or the maximum length of phrases. I found that an n=2 is more optimal for linking documents; however, n=3 works fantastically as well.</p><h4>Upserting Data</h4><p>Finally, we can upsert all of this data into our schema. For this, I programmed some light data cleansing to clean the links and text, and I used a Counter to generate a weight for LINKS_TO: the ratio of the number of times a certain link appears to the total number of links on the webpage. Altogether, I wrapped this into a recursive function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0b93e44f16d6e26a9186d99f323d49a/href">https://medium.com/media/b0b93e44f16d6e26a9186d99f323d49a/href</a></iframe><p>Fantastic! With this function running, your Wikipedia graph will start coming to life!</p><h3>Step III: Write Queries!</h3><p>This schema allows for loads of different queries for different use cases. Expect several more articles to be released using these queries—which I will link to on publication—but, for now, let’s use pyTigerGraph to download and install some queries.</p><pre>f = conn.gds.featurizer()</pre><pre>f.installAlgorithm(&quot;tg_pagerank_wt&quot;)<br>f.installAlgorithm(&quot;tg_article_rank&quot;)</pre><p>These two queries—weighted PageRank and ArticleRank—fall under centrality graph algorithms and can help determine which Doc is the most influential.</p><h3>Resources, Next Steps, and More!</h3><p>Congrats! You officially built the WikiGraph! To find the complete notebook, reference the Colab here:</p><p><a href="https://colab.research.google.com/drive/1DzJORbDQBisEKDUTBRGff-9jZOaO-Zrq?usp=sharing">Google Colaboratory</a></p><p>In addition, check out the full repository with an export:</p><p><a href="https://github.com/GenericP3rson/WikiGraph">GitHub - GenericP3rson/WikiGraph: TigerGraph Wikipedia Sample Graph</a></p><p>As alluded to in the queries section, the main way to expand on this project is to begin querying the graph and building cool sample projects on top of it! Personally, I used it to create a search, so be on the lookout for blogs on that soon!</p><p>Throughout your TigerGraph adventures, if you have any questions or want to share out your project, join the Discord and Discourse!</p><ul><li><a href="https://discord.gg/tigergraph/">Discord | Your Place to Talk and Hang Out</a></li><li><a href="https://community.tigergraph.com/">TigerGraph</a></li></ul><p>Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p>Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52dd3261a86d" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/linking-wikipedia-articles-in-a-knowledge-graph-with-tigergraph-beautifulsoup-and-yake-52dd3261a86d">Linking Wikipedia Articles in a Knowledge Graph with TigerGraph, BeautifulSoup, and Yake</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Graph-Powered CLI with Cobra and TigerGo]]></title>
            <link>https://medium.datadriveninvestor.com/building-a-graph-powered-cli-with-cobra-and-tigergo-f89f3bc08546?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/f89f3bc08546</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[movie-recommendation]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[cobra]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Mon, 06 Jun 2022 04:19:05 GMT</pubDate>
            <atom:updated>2022-07-23T09:44:19.388Z</atom:updated>
            <content:encoded><![CDATA[<h4>Create a Graph-Powered Movie Recommendation Command Line Interface (CLI) in Golang using Cobra and TigerGo</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*w55whn_uNlbm4glF.jpg" /><figcaption><a href="https://pixabay.com/photos/warm-and-cozy-popcorn-coffee-1975215/">Image from Pixabay</a></figcaption></figure><h3>Introduction</h3><p>Command-Line Interfaces (CLIs) offer a text-based method of interacting with programs, and many companies use CLIs built with Golang—specifically with Cobra—including Kubernetes, Hugo, and Github. In this blog, you will learn how to leverage this library to create a CLI to interact with a graph database, specifically a movie recommendations graph database.</p><h4>Tools Used</h4><ul><li><a href="https://github.com/spf13/cobra">Cobra</a></li><li><a href="https://github.com/GenericP3rson/TigerGo">TigerGo (v0.0.5)</a></li></ul><h3>Pre-Requisite: Create the TigerGraph Movie Recommendation Starter Kit</h3><p>To start, spin up a Movie Recommendation Starter Kit on TigerGraph Cloud. (If you have the starter kit spun up, the data loaded, and the queries installed, then you may proceed to Part I. If not, follow this pre-requisite section to get started!) First, create an account at <a href="https://tgcloud.io/">https://tgcloud.io/</a>, navigate to the “My Solutions” tab, and press the blue “Create New Solution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRZ1gue_zyp-USbbtgqsbQ.png" /></figure><p>On the first page, scroll through the starter kits then select “Recommendation Engine (Movie Recommendation).” Press next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fpMb_S5ld_0ZtzmiSLaBkw.png" /></figure><p>On the second page, you do not need to change anything. This will simply configure a free TigerGraph solution. On the third page, configure the solution settings to fit your solution’s needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_pBPAD5vaN3DrZRi" /></figure><p>Review that everything looks good in the fourth step, then press “Submit”! This will redirect you to the “My Solutions” tab. Wait till the status of the new solution says “Ready,” then press the four boxes (the “Applications” button) under “Actions” and select “GraphStudio” from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05RvhOChq5SjcdCawVMoJQ.png" /></figure><p>This will open GraphStudio. In the GUI, click “Global View” then select “MyGraph” from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wo2oFx-FCs0sDCLx2y1zrQ.png" /></figure><p>First, you will need to load in all the data. To do so, navigate to the “Load Data” tab then press the play button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4mDiCsC-3ojaPBMhIe4uJg.png" /></figure><p>Finally, you will need to install all the queries. Navigate to the “Write Queries” tab then press the “Install All” button (the box with an arrow).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsj0yS1uE1KzRBvKoUcYUQ.png" /></figure><p>Perfect! Once everything is complete, your solution is ready to interact with via the CLI.</p><h3>Part I: Set Up the Go Project</h3><h4>Step I: Initialise a New Project</h4><p>To start, create a new Go project on your machine. Create a new folder then run:</p><pre>go mod init PROJECT_LOCATION</pre><p>Replace PROJECT_LOCATION with the location of your project (for example, if your project will be on Github, it could look like go mod init github.com/GenericP3rson/TigerGoCobraExample).</p><pre>go mod init github.com/GenericP3rson/TigerGoCobraExample</pre><blockquote>Note: From here on out, replace all of the PROJECT_LOCATION variables mentioned in this blog with your project location.</blockquote><h4>Step II: Create main.go</h4><p>Next, touch main.go to create the main Go file. Inside of it, add the following contents to execute all other commands:</p><pre>package main</pre><pre>import &quot;PROJECT_LOCATION/cmd&quot;</pre><pre>func main() {<br>   cmd.Execute()<br>}</pre><p>Perfect! Now we can build out the commands themselves in a cmd package.</p><h4>Step III: Create the Project Directory</h4><p>All of the commands for the CLI will go into the cmd folder. Create a cmd folder and a root.go file to add the code for the commands themselves. Overall, the structure of the project should look like the following:</p><pre>go.mod<br>main.go</pre><pre>cmd/ <br>   root.go</pre><h4>Step IV: Import Packages</h4><p>To start, go get the Cobra and TigerGo libraries.</p><pre>go get -u github.com/spf13/cobra<br>go get -u github.com/GenericP3rson/TigerGo</pre><blockquote>Note: The rest of the code from here on out is in root.go.</blockquote><p>Then declare the package (cmd) and import the libraries, TigerGo, Cobra, and fmt.</p><pre>package cmd</pre><pre>import (<br>   &quot;fmt&quot;<br>   &quot;github.com/spf13/cobra&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><h4>Step V: Start the Basics of the Command</h4><p>First, create the root command. This provides basic information on how to use the CLI with both a short and long description and the prefix for the commands. Execute this command using the Execute function.</p><pre>var rootCmd = &amp;cobra.Command{<br>   Use:   &quot;TigerGoCobraExample&quot;,<br>   Short: &quot;Interact with MovieRec via the CLI&quot;,<br>   Long: `This CLI library is a sample for interacting with TigerGraph via a CLI. It uses TigerGo and Cobra and uses the Movie Recommendation Starter Kit`,<br>}</pre><pre>// Executes the root command.<br>func Execute() error {<br>   return rootCmd.Execute()<br>}</pre><h4>Step VI: Create a TigerGraph Connection</h4><p>Next, create a connection to the TigerGraph solution to interact with it using TigerGo’s TigerGraphConnection feature. In the init function, generate a token.</p><pre>var conn = TigerGo.TigerGraphConnection{<br>   Token:     &quot;&quot;,<br>   Host:      &quot;https://SUBDOMAIN.i.tgcloud.io&quot;,<br>   GraphName: &quot;MyGraph&quot;,<br>   Username:  &quot;tigergraph&quot;,<br>   Password:  &quot;PASSWORD&quot;,<br>}</pre><pre>func init() {<br>   conn.Token, _ = conn.GetToken() // Add Token<br>}</pre><blockquote>Note: Replace SUBDOMAIN and PASSWORD with the subdomain and password you set when creating your solution.</blockquote><h3>Part II: Create the Commands in the Go File</h3><h4>Echo</h4><p>From here on out, we will need to add commands for the CLI. Let’s start with testing the echo endpoint. The command will be echo. It will run the Echo() function, and if there are no errors, it will print the result.</p><pre>var echo = &amp;cobra.Command{ // Test if the connection is okay using echo!<br>   Use:   &quot;echo&quot;,<br>   Short: &quot;Test TigerGraph Connection&quot;,<br>   Long:  `Testing TigerGraph connection by calling the echo endpoint`,<br>   Run: func(cmd *cobra.Command, args []string) {<br>      res, err := conn.Echo() // Run echo command</pre><pre>      if err == nil {<br>         fmt.Print(res)<br>         fmt.Println(&quot;Success!&quot;)<br>      } else {<br>         fmt.Println(err.Error())<br>         fmt.Println(&quot;Uh oh! There&#39;s an error!&quot;)<br>      }<br>   },<br>}</pre><h4>AddUser and AddMovie: Upserting a Vertices</h4><p>Next, we’ll add commands for upserting vertices, specifically the person and movie vertices. With these commands, we can use the args []string to extract parameters from the CLI request. For addUser, there is a single parameter required, the userid. Grab the first value of args, args[0], then pass that in the UpsertVertex function.</p><pre>var addUser = &amp;cobra.Command{<br>   Use:   &quot;addUser&quot;,<br>   Short: &quot;Create a new user&quot;,<br>   Long:  `Upsert a new person vertex; parameters is userid`,<br>   Run: func(cmd *cobra.Command, args []string) {<br>      userid := args[0] // Grab the first argument<br>      res, err := conn.UpsertVertex(&quot;person&quot;, userid, map[string]interface{}{&quot;id&quot;: userid}) // Upsert vertex</pre><pre>      if err == nil {<br>         fmt.Print(res)<br>         fmt.Println(&quot;Success!&quot;)<br>      } else {<br>         fmt.Println(err.Error())<br>         fmt.Println(&quot;Uh oh! There&#39;s an error!&quot;)<br>      }<br>   },<br>}</pre><p>The addMovie will also upsert vertices in a similar fashion. In this case, the command will take three arguments: movieid (args[0]), moviename (args[1]), and genres (args[2]). Then, similarly, the vertices are upserted and results are printed.</p><pre>var addMovie = &amp;cobra.Command{<br>   Use:   &quot;addMovie&quot;,<br>   Short: &quot;Adds a new movie&quot;,<br>   Long:  `Upsert a new movie vertex; parameters are movieid, movie title, and genres`,<br>   Run: func(cmd *cobra.Command, args []string) {<br>      movieid := args[0]<br>      moviename := args[1]<br>      genres := args[2]<br>      res, err := conn.UpsertVertex(&quot;movie&quot;, movieid, map[string]interface{}{&quot;title&quot;: moviename, &quot;genres&quot;: genres})</pre><pre>      if err == nil {<br>         fmt.Print(res)<br>         fmt.Println(&quot;Success!&quot;)<br>      } else {<br>         fmt.Println(err.Error())<br>         fmt.Println(&quot;Uh oh! There&#39;s an error!&quot;)<br>      }<br>   },<br>}</pre><h4>Rate: Upserting an Edge</h4><p>To add a rating, we need to upsert an edge. Once again, pull the different sections from args and use it to upsert the edge.</p><pre>var rate = &amp;cobra.Command{<br>   Use:   &quot;rate&quot;,<br>   Short: &quot;Create a new rating&quot;,<br>   Long:  `Upsert a rating edge; parameters are userid, movieid, and rating`,<br>   Run: func(cmd *cobra.Command, args []string) {<br>      userid := args[0]<br>      movieid := args[1]<br>      rating := args[2]<br>      res, err := conn.UpsertEdge(&quot;person&quot;, userid, &quot;rate&quot;, &quot;movie&quot;, movieid, map[string]interface{}{&quot;rating&quot;: rating})</pre><pre>      if err == nil {<br>         fmt.Print(res)<br>         fmt.Println(&quot;Success!&quot;)<br>      } else {<br>         fmt.Println(err.Error())<br>         fmt.Println(&quot;Uh oh! There&#39;s an error!&quot;)<br>      }<br>   },<br>}</pre><h4>RecMovies: Running a Query</h4><p>Finally, to recommend movies, we will use the installed query RecommendMovies. For this particular function, we will only take one parameter, the userid of the person to recommend movies for. The query has a total of three parameters; however, I decided to pre-set k1 (the number of similar users found) and k2 (the number of movie recommendations).</p><pre>var recMovies = &amp;cobra.Command{<br>   Use:   &quot;recMovies&quot;,<br>   Short: &quot;Recommend a movie&quot;,<br>   Long:  `Run the RecommendMovie query; parameters is userid`,<br>   Run: func(cmd *cobra.Command, args []string) {<br>      userid := args[0]<br>      res, err := conn.RunInstalledQuery(&quot;RecommendMovies&quot;, map[string]interface{}{&quot;p&quot;: map[string]string{&quot;id&quot;: userid, &quot;type&quot;: &quot;person&quot;}, &quot;k1&quot;: 100, &quot;k2&quot;: 10})</pre><pre>      if err == nil {<br>         fmt.Print(res)<br>         fmt.Println(&quot;Success!&quot;)<br>      } else {<br>         fmt.Println(err.Error())<br>         fmt.Println(&quot;Uh oh! There&#39;s an error!&quot;)<br>      }<br>   },<br>}</pre><h3>Part III: Touch-Ups and Run</h3><h4>Step I: Add Commands to the Root</h4><p>To use the commands created in the previous section, they must be added to the init() function through rootCmd.AddCommand(COMMAND_NAME).</p><pre>func init() {</pre><pre>   conn.Token, _ = conn.GetToken() // Add Token</pre><pre>   // Add all commands to the root<br>   rootCmd.AddCommand(echo)<br>   rootCmd.AddCommand(addUser)<br>   rootCmd.AddCommand(addMovie)<br>   rootCmd.AddCommand(recMovies)<br>   rootCmd.AddCommand(rate)</pre><pre>}</pre><h4>Step II: Add Go to the Path</h4><p>Everything should be ready to compile. To start, add Go to your machine’s path.</p><pre>export PATH=&quot;~/go/bin:$PATH&quot;</pre><h4>Step III: Install the Project</h4><p>Next, install the project.</p><pre>go install</pre><p>Now you should be ready to interact with the CLI! You can get started by querying the help function.</p><pre>TigerGoCobraExample help</pre><p>This will result in a list of the commands created and the descriptions!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlQccRkmF65QanhEKQc7_Q.png" /><figcaption>Result of the help function</figcaption></figure><p>Fantastic! You can now use and interact with your CLI!</p><h3>Next Steps</h3><p>Congrats on building a graph-powered CLI! You can find the full code for this project <a href="https://github.com/GenericP3rson/TigerGoCobraExample">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGoCobraExample">GitHub - GenericP3rson/TigerGoCobraExample</a></p><p>Some next steps include parsing the results and adding more functionalities for different use cases. In addition, Cobra is often coupled with Viper to easily create flags, so you can add flags to the CLI by leveraging both libraries.</p><p>Finally, if you would like to build a graph-powered CLI or talk to other graph developers, I would recommend joining the TigerGraph Discord to learn graph and share your projects.</p><p><a href="https://discord.gg/tigergraph">Join the TigerGraph Discord Server!</a></p><p>Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p>Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f89f3bc08546" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/building-a-graph-powered-cli-with-cobra-and-tigergo-f89f3bc08546">Building a Graph-Powered CLI with Cobra and TigerGo</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TigerGraph Microblog: Installing Graph Algorithms in Python]]></title>
            <link>https://shreya-chaudhary.medium.com/tigergraph-microblog-installing-graph-algorithms-in-python-4ae79cf6bf7d?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae79cf6bf7d</guid>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[pagerank]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[graph-data-science]]></category>
            <category><![CDATA[tigergraph]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Sun, 05 Jun 2022 04:30:02 GMT</pubDate>
            <atom:updated>2022-06-05T04:32:17.215Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using pyTigerGraph’s Graph Data Science Functions with the COVID-19 Patient Starter Kit</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*6XxaP3UGsQKVZ6Od.jpg" /><figcaption><a href="https://pixabay.com/illustrations/fractal-recursive-geometry-dynamic-1119594/">Image from Pixabay</a></figcaption></figure><h3>Introduction</h3><h4>Objective</h4><p>In this blog, you will learn how to install graph algorithms to your TigerGraph solution. Specifically, the blog will use the example of installing PageRank with the COVID-19 starter kit.</p><h4>Tools Used</h4><ul><li><a href="https://tgcloud.io/">TigerGraph Cloud</a></li><li><a href="https://docs.tigergraph.com/pytigergraph/current/intro/">pyTigerGraph</a> (with <a href="https://docs.tigergraph.com/pytigergraph/current/gds/">GDS functions</a>)</li></ul><h3>Prerequisite: Create the COVID-19 Starter Kit on TigerGraph Cloud</h3><p>Before creating graph algorithms, start by loading the COVID-19 starter kit. Create an account on <a href="https://tgcloud.io/">https://tgcloud.io/</a>, navigate to the “My Solutions” tab, then press the blue “Create Solution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DzCK5ua_aoJ_nwD6M43YOQ.png" /></figure><p>On the first, select the COVID-19 starter kit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKib7dt6gfyQfQxbrsApRQ.png" /></figure><p>Don’t change anything on the second page; this will simply set up a free TigerGraph solution. On the third page, customise your solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y19M1UaedoVhiTtsVbFfGw.png" /></figure><p>Finally, verify that everything looks good on the final page then press submit. Wait till the status of your solution is green (Ready), then open GraphStudio by pressing the “Applications” button and selecting GraphStudio from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwKJwZc-OG7ZMOtOTusw5w.png" /></figure><p>In GraphStudio, navigate to the COVID-19 graph by clicking “Global View” then selecting “MyGraph” from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-dlpcqyt_xEAzdXbOt-Log.png" /></figure><p>Finally, load the data by navigating to the “Load Data” tab and then pressing the play button in the top left corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGNmkHSVZ0N_WaKZDKh6ng.png" /></figure><p>Once all of your data is loaded, the solution is ready and you can start running algorithms using pyTigerGraph.</p><h3>Installing and Running PageRank with pyTigerGraph</h3><p>To start, import pyTigerGraph with GDS to access the Graph Data Science functionalities.</p><pre>pip install pyTigerGraph[gds]</pre><p>Next, connect to the TigerGraph solution you just created.</p><pre>import pyTigerGraph as tg</pre><pre>conn = tg.TigerGraphConnection(host = &quot;https://SUBDOMAIN.i.tgcloud.io/&quot;, graphname = &quot;MyGraph&quot;, username = &quot;tigergraph&quot;, password = &quot;PASSWORD&quot;)<br>conn.apiToken = conn.getToken(conn.createSecret())</pre><blockquote>Note: Modify SUBDOMAIN and PASSWORD to the subdomain and password set while creating the solution. MyGraph and tigergraph are the default graph name and username, respectively; modify them if needed.</blockquote><p>You can create a new <a href="https://docs.tigergraph.com/pytigergraph/current/gds/featurizer">featurizer</a>.</p><pre>f = conn.gds.featurizer()</pre><p>The featurizer has a few functions, including <a href="https://docs.tigergraph.com/pytigergraph/current/gds/featurizer#_listalgorithms">listing</a> and <a href="https://docs.tigergraph.com/pytigergraph/current/gds/featurizer#_installalgorithm">installing algorithms</a>. You can view the list of algorithms with the following command:</p><pre>f.listAlgorithms()</pre><p>In this example, we will install the unweighted Pagerank algorithm. You can do so with the installAlgorithm command, passing a parameter of tg_pagerank.</p><pre>f.installAlgorithm(&#39;tg_pagerank&#39;)</pre><p>This may take several minutes to install. Once it is ready, you can run it using conn.runInstalledQuery. While there are several parameters for Pagerank, I just passed the default parameters, vertex and edge type.</p><pre>conn.runInstalledQuery(&quot;tg_pagerank&quot;, params = {&quot;v_type&quot;: &quot;Patient&quot;, &quot;e_type&quot;: &quot;INFECTED_BY&quot;})</pre><p>Perfect! With that, you can now leverage TigerGraph graph algorithms with your solution!</p><h3>Resources and Next Steps</h3><p>Congrats! You can now leverage the power of graph algorithms in your solution! Check out the interactive Colab version of this blog:</p><p><a href="https://colab.research.google.com/drive/1BheXvNrWtQYC00zSwgngae0gLmuXO8nn?usp=sharing">Google Colaboratory</a></p><p>For more in-depth tutorials and samples, check out the GitHub repository.</p><p><a href="https://github.com/TigerGraph-DevLabs/mlworkbench-docs/blob/main/tutorials/basics/2_feature_engineering.ipynb">mlworkbench-docs/2_feature_engineering.ipynb at main · TigerGraph-DevLabs/mlworkbench-docs</a></p><p>Finally, this blog is merely scratching the surface of the awesome graph data science capabilities of pyTigerGraph. To learn about more features, like loading and splitting data and more, check out the pyTigerGraph GDS documentation!</p><p><a href="https://docs.tigergraph.com/pytigergraph/current/gds/">GDS Functions - pyTigerGraph</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae79cf6bf7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leveraging a TigerGraph Graph Database with a Web Server in Go for Hackathon Registrations]]></title>
            <link>https://medium.com/geekculture/leveraging-a-tigergraph-graph-database-with-a-web-server-in-go-for-hackathon-registrations-f640de0d2fd2?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/f640de0d2fd2</guid>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[gin-gonic]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Sun, 29 May 2022 13:27:14 GMT</pubDate>
            <atom:updated>2022-05-31T06:27:23.008Z</atom:updated>
            <content:encoded><![CDATA[<h4>Creating a Web Server in Golang Using TigerGo and Gin Gonic to Help Hackathon Competitors Find Teammates</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*ChLF1yjMB26fLOhH.png" /><figcaption>Image from <a href="https://pixabay.com/illustrations/lightbulb-artificial-intelligence-5442769/">Pixabay</a></figcaption></figure><h3>Introduction</h3><p>Amidst the awesome experiences I have had, I am a community leader at Major League Hacks. I enjoy participating in hackathons and I even had the awesome opportunity to host the Texas branch of the Local Hack Day in 2020. One of the potentially difficult but most fun aspects of hackathons is finding teammates that use the same frameworks and have similar interests. So why not leverage the power of graph—specifically TigerGraph—to help hackathon competitors find teammates?</p><p>This project will be using the new TigerGraph Go wrapper, TigerGo, with a popular Go webserver package, Gin Gonic, to create a graph-powered webserver to create a hackathon partner-finding application.</p><h4>Tools Used</h4><ul><li><a href="https://genericp3rson.github.io/TigerGo/">TigerGo</a>: A TigerGraph wrapper (created by me!) for Golang</li><li><a href="https://tgcloud.io/">TigerGraph Cloud</a>: A platform to create and host TigerGraph graph databases</li><li><a href="https://github.com/gin-gonic/gin">Gin Gonic</a>: A popular Golang library to create webservers</li></ul><h3>Part I: Create a Graph</h3><h4>Step I: Create a New Solution</h4><p>First, create a new blank solution on TigerGraph Cloud. To do so, navigate to <a href="https://tgcloud.io/">https://tgcloud.io/</a> and create an account if you do not already have one. Next, navigate to the “My Solutions” tab and press the blue “Create Solution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riG0GaPUNKsncK0JY3xbIA.png" /><figcaption>Press “My Solutions” then “Create Solution”</figcaption></figure><p>On the first page, press the “Blank” option then press next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dyl2vKsH2TnWcClP5MknGA.png" /><figcaption>Select “Blank v3.5.3” and press next</figcaption></figure><p>Do not change anything on the second page; this will set up a free TigerGraph solution. On the third page, configure the options as you would like.</p><blockquote>Note: Keep note of the password and subdomain of your solution! Furthermore, the subdomain is unique to other solutions at the time, so you may not be able to use the subdomain in this example.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZgEtZukVMAnhH3bJt8IMw.png" /><figcaption>Configure the solution</figcaption></figure><p>Verify that everything looks good on the final page then press submit. Next wait for a few minutes till the solution status is a green dot that says “Ready.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*H2AZw_KK_VY_KXw6fLgEPg.png" /><figcaption>Wait till the status is ready.</figcaption></figure><h4>Step II: Open GraphStudio and Import the Solution</h4><p>Once the solution is ready, open GraphStudio by clicking “GraphStudio” from the dropdown of the four squares (with the hover text of “Applications”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*Mzg_Rx6d--EjiWVhS3_ABg.png" /><figcaption>Click GraphStudio from the applications dropdown</figcaption></figure><blockquote>Note: Next, I will show you how to import my solution directly. If you would rather set up the solution yourself, skip this step but follow the rest. If you would like to import the solution immediately, finish this step, install the query, then jump to Part II.</blockquote><p>In GraphStudio, click the “Import an Existing Studio” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LrhIvns0kjcUUwIS8mZzzQ.png" /><figcaption>Click “Import an Existing Solution”</figcaption></figure><p>You can find the solution to import <a href="https://github.com/GenericP3rson/TigerGoGinExample/blob/master/HackGraph.tar.gz">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGoGinExample/blob/master/HackGraph.tar.gz">TigerGoGinExample/HackGraph.tar.gz at master · GenericP3rson/TigerGoGinExample</a></p><h4>Step III: Create a New Graph and Schema</h4><p>On the left-hand panel, click “Global View” to open a dropdown. In the dropdown, click “New Graph.” In my case, I will create a graph called “HackGraph.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*eb0-8kPbrESmQW6xHK4XXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWKgNrh56RHFsUJH4Ijs6A.png" /><figcaption>Create a new graph called “HackGraph”</figcaption></figure><p>Next, press “Design Schema.” Add vertices using the plus sign then create edges. For a step-by-step tutorial on how to create and design schemas using TigerGraph Cloud, check out <a href="https://www.youtube.com/watch?v=qay0GJJ28W8">this video</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSag34-S_D2TeOcNk4PWrg.png" /><figcaption>Graph Schema in GraphStudio</figcaption></figure><p>For reference, this would be the script equivalent of the graph schema.</p><pre>CREATE VERTEX Language(PRIMARY_ID language STRING) WITH PRIMARY_ID_AS_ATTRIBUTE=&quot;true&quot;<br>CREATE VERTEX User(PRIMARY_ID user STRING) WITH PRIMARY_ID_AS_ATTRIBUTE=&quot;true&quot;<br>CREATE VERTEX Interest(PRIMARY_ID interest STRING) WITH PRIMARY_ID_AS_ATTRIBUTE=&quot;true&quot;</pre><pre>CREATE UNDIRECTED EDGE USER_LANGUAGE(FROM User, TO Language, experience STRING)<br>CREATE UNDIRECTED EDGE USER_INTEREST(FROM User, TO Interest)</pre><p>Once you have created your schema, press the publish button!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*bbomFffNyRuiEvVepZlqQA.png" /><figcaption>Press the up arrow to publish your schema</figcaption></figure><p>Congrats, you have created your first schema!</p><h4>Step IV: Write a Query</h4><p>Next, you need to create the query to actually suggest teammates. Navigate to the “My Queries” tab. Create a new query (which I called “suggestTeammates”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pzcRQl1TGbMk-L5ffWz3pA.png" /><figcaption>Create a new queries</figcaption></figure><p>If you want to learn about GSQL, check out the <a href="https://docs.tigergraph.com/gsql-ref/current/tutorials/gsql-101/">GSQL 101 documentation</a>. For this, I created a basic query using accumulators. For all of the users sharing a vertex with the user, they receive 1 on the similarity accumulator. In this case, interest and language vertices have the weighting; however, this can be adjusted to give one more or less.</p><pre>CREATE QUERY suggestTeammates(VERTEX&lt;User&gt; username) FOR GRAPH HackGraph SYNTAX v2 { <br>  <br>  SumAccum&lt;INT&gt; @similarity;<br>  <br>  Seed = {username};<br>  <br>  Res1 = SELECT u FROM Seed:s - (USER_INTEREST:e1) - Interest:i - (USER_INTEREST:e2) - User:u<br>        WHERE u.user != username.user<br>        ACCUM u.@similarity += 1;<br>  <br>  Res2 = SELECT u FROM Seed:s - (USER_LANGUAGE:e1) - Language:l - (USER_LANGUAGE:e2) - User:u<br>        WHERE u.user != username.user AND e1.experience == e2.experience<br>        ACCUM u.@similarity += 1;<br>  <br>  Users = {User.*};<br>  <br>  Res = SELECT u FROM Users:u<br>        WHERE u.user != username.user<br>        ORDER BY u.@similarity DESC<br>        LIMIT 5;<br>  <br>  PRINT Res;<br>  <br>}</pre><p>Finally, install the query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*66lu-YdQTnuimoFGvz1XHw.png" /><figcaption>Install the query with the up arrow.</figcaption></figure><p>The solution is ready now! You can now create the Go project.</p><h3>Part II: Create and Configure a New Golang Project</h3><h4>Step I: Go Get Packages</h4><p>To start off, initialise a new Golang project.</p><pre>go mod init test/gin</pre><p>Next, import gin.</p><pre>go get -u github.com/gin-gonic/gin</pre><blockquote>Note: You MUST grab the package with this. Sometimes when running go mod tidy, it would throw an error when running the code.</blockquote><p>Finally, import TigerGo.</p><pre>go get github.com/GenericP3rson/TigerGo</pre><p>Perfect! Everything should be set library-wise.</p><h4>Step II: Connect to the TigerGraph Solution</h4><p>Start by creating a file to house the code. For example, I’ll create index.go. Next, add <a href="https://genericp3rson.github.io/TigerGo/">the quickstart code for TigerGo</a> to the file.</p><pre>package main </pre><pre>import(<br>   &quot;fmt&quot; // fmt for printing stuff out<br>   &quot;github.com/GenericP3rson/TigerGo&quot; // TigerGo<br>)</pre><pre>func main() {<br>   conn := TigerGo.TigerGraphConnection{<br>      Token: &quot;TOKEN&quot;, <br>      Host: &quot;https://SUBDOMAIN.i.tgcloud.io&quot;,<br>      GraphName: &quot;GRAPHNAME&quot;,<br>      Username: &quot;tigergraph&quot;,<br>      Password: &quot;PASSWORD&quot;<br>   }<br>}</pre><p>If you do not already have a token, leave the field blank and generate one with:</p><pre>fmt.Println(conn.GetToken())</pre><p>I would recommend copying the token and password to a separate document and then calling it from the main document.</p><p>token.go</p><pre>package main</pre><pre>func token() string {<br>   return &quot;TOKEN_JUST_GENERATED&quot;<br>}</pre><pre>func password() string {<br>   return &quot;PASSWORD&quot;<br>}</pre><p>index.go</p><pre>import(<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><pre>func main() {<br>   conn := TigerGo.TigerGraphConnection{<br>      Token: token(), <br>      Host: &quot;https://SUBDOMAIN.i.tgcloud.io&quot;,<br>      GraphName: &quot;GRAPHNAME&quot;,<br>      Username: &quot;tigergraph&quot;,<br>      Password: password()<br>   }<br>}</pre><p>Fantastic! Test the connection by running conn.Echo().</p><pre>go run .</pre><p>If all is good, you’re ready to go!</p><h4>Step III: Create a Gin Server</h4><p>Now that we can connect to our solution, we can create a basic Gin server, starting with an /echo endpoint.</p><pre>package main</pre><pre>import (<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>   &quot;github.com/gin-gonic/gin&quot;<br>   &quot;net/http&quot;<br>)</pre><pre>func main() {<br>   <br>   conn := TigerGo.TigerGraphConnection{<br>      Token: token(),<br>      Host: &quot;https://SUBDOMAIN.i.tgcloud.io&quot;,<br>      GraphName: &quot;HackGraph&quot;,<br>      Username:  &quot;tigergraph&quot;,<br>      Password:  password(),<br>   }</pre><pre>   r := gin.Default()</pre><pre>   r.GET(&quot;/echo&quot;, func(c *gin.Context) {<br>      c.JSON(http.StatusOK, gin.H{<br>         &quot;message&quot;: conn.Echo(),<br>      })<br>   })</pre><pre>   r.Run(&quot;:8080&quot;)</pre><pre>}</pre><p>This runs a GET request at the /echo endpoint. It will return a JSON object of &quot;message&quot;: conn.Echo() (which will be &quot;message&quot;: &quot;Hello GSQL&quot;). Run the files.</p><pre>go run .</pre><p>You can ensure everything is working by heading over to <a href="http://0.0.0.0:8080/echo/">http://0.0.0.0:8080/echo/</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*G1hXgwyrS6oKDscRVb4SGg.png" /><figcaption>Hello GSQL in Brower</figcaption></figure><p>Perfect! Once that’s ready, let’s start building out the endpoints for the example!</p><h3>Part III: Create the Endpoints</h3><p>For this project, I’ll create four endpoints: /join, /add-lang, /add-interest, and /suggest-teammates.</p><h4>Join</h4><p>When a user joins, we will create a POST request to the server with the parameters of user.</p><pre>r.POST(&quot;/join&quot;, func(c *gin.Context) {</pre><pre>   usr := c.Query(&quot;user&quot;)<br>   fmt.Println(conn.UpsertVertex(&quot;User&quot;, usr, map[string]string{&quot;user&quot;: usr}))</pre><pre>})</pre><p>To verify the endpoint works, create a POST request in curl.</p><pre>curl -X POST http://0.0.0.0:8080/join?user=Username</pre><p>When running this command, a new Username vertex will be upserted to the database.</p><h4>Add Interest</h4><p>The /add-interest endpoint will function similarly. This time it will upsert two vertices, User and Interest, and upsert an edge to connect the two.</p><pre>r.POST(&quot;/add-interest&quot;, func(c *gin.Context) {</pre><pre>   usr := c.Query(&quot;user&quot;)<br>   interest := c.Query(&quot;interest&quot;)</pre><pre>   fmt.Println(conn.UpsertVertex(&quot;User&quot;, usr, map[string]string{&quot;user&quot;: usr}))</pre><pre>   fmt.Println(conn.UpsertVertex(&quot;Interest&quot;, interest, map[string]string{&quot;interest&quot;: interest}))</pre><pre>   fmt.Println(conn.UpsertEdge(&quot;User&quot;, usr, &quot;USER_INTEREST&quot;, &quot;Interest&quot;, interest, nil))</pre><pre>})</pre><p>The POST request will then input two parameters: user and interest.</p><pre>curl -X POST &quot;http://0.0.0.0:8080/add-interest?user=Username&amp;interest=Graph&quot;</pre><p>Great! This creates a new Graph vertex and connects it to the Username vertex previously created.</p><h4>Add Language</h4><p>The final POST request the API will make is the /add-lang request. This will take in three parameters: the user, language, and experience for the edge attribute.</p><pre>r.POST(&quot;/add-lang&quot;, func(c *gin.Context) {</pre><pre>   usr := c.Query(&quot;user&quot;)<br>   lang := c.Query(&quot;lang&quot;)<br>   exp := c.Query(&quot;experience&quot;)</pre><pre>   fmt.Println(conn.UpsertVertex(&quot;User&quot;, usr, map[string]string{&quot;user&quot;: usr}))</pre><pre>   fmt.Println(conn.UpsertVertex(&quot;Language&quot;, lang, map[string]string{&quot;language&quot;: lang}))</pre><pre>   fmt.Println(conn.UpsertEdge(&quot;User&quot;, usr, &quot;USER_LANGUAGE&quot;, &quot;Language&quot;, lang, map[string]string{&quot;experience&quot;: exp}))</pre><pre>})</pre><p>Once again, query this endpoint using curl.</p><pre>curl -X POST &quot;http://0.0.0.0:8080/add-lang?user=Username&amp;lang=Go&amp;experience=beginner&quot;</pre><h4>Suggest Teammates</h4><p>Lastly, we can run a GET request to run the query we wrote in the first step!</p><pre>r.GET(&quot;/suggest-teammates&quot;, func(c *gin.Context) {</pre><pre>   usr := c.Query(&quot;user&quot;)</pre><pre>   c.JSON(http.StatusOK, gin.H{<br>      &quot;results&quot;: conn.RunInstalledQuery(&quot;suggestTeammates&quot;, map[string]string{&quot;username&quot;: usr}),<br>   })</pre><pre>})</pre><p>Test out the endpoint with curl.</p><pre>curl -X GET http://0.0.0.0:8080/suggest-teammates?user=Username</pre><h3>Part IV: Next Steps and Resources</h3><p>Congrats! You have now created a web server in Go querying TigerGraph! Check out the full code <a href="https://github.com/GenericP3rson/TigerGoGinExample">here</a>.</p><p><a href="https://github.com/GenericP3rson/TigerGoGinExample">GitHub - GenericP3rson/TigerGoGinExample</a></p><p>Next, you will want to build a website or something else to use the endpoints you created. Additionally, you can add more endpoints to query for more details to make a more complex teammate suggestion algorithm.</p><p>If you want to have any questions or would like to work on other cool TigerGraph projects, feel free to join the TigerGraph Discord!</p><p><a href="https://discord.gg/tigergraph">Join the TigerGraph Discord Server!</a></p><blockquote>Note: All images, unless otherwise noted, were created by the author.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f640de0d2fd2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/leveraging-a-tigergraph-graph-database-with-a-web-server-in-go-for-hackathon-registrations-f640de0d2fd2">Leveraging a TigerGraph Graph Database with a Web Server in Go for Hackathon Registrations</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Repl.it Template]]></title>
            <link>https://blog.devgenius.io/how-to-create-a-repl-it-template-d94d88fd6f5d?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/d94d88fd6f5d</guid>
            <category><![CDATA[repl]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[template]]></category>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Wed, 25 May 2022 04:25:37 GMT</pubDate>
            <atom:updated>2022-05-25T07:11:24.225Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Step-by-Step Guide to Creating a “Hello World” pyTigerGraph Template on Repl.it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*zhQ8oVG7o49QZUTU.jpg" /><figcaption>Image from <a href="https://pixabay.com/illustrations/idea-empty-paper-pen-light-bulb-1876659/">Pixabay</a></figcaption></figure><h3>Introduction</h3><p><a href="https://replit.com/">Repl.it</a> is an awesome online IDE which is typically my go-to for simultaneous collaborative programming. Amidst its various features, Repl.it offers templates, code a user can select when creating a new program. Previously, only certain users could create templates, but now anyone can create them! This blog will walk through how to create your very first Repl.it template with the example of a pyTigerGraph “hello world” template.</p><h3>Tutorial</h3><h4>Create a New Repl</h4><p>To get started, create a <a href="https://replit.com/">Repl.it account</a>. Once you are logged in, press the “Create” button to create a new Repl.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*mzNEVm9x9Xzo4aNhuLJ7yg.png" /><figcaption>Create a New Repl</figcaption></figure><p>Since I will be using Python for the template, I select Python for the template and then named it pyTigerGraphHelloWorld.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXWopZDM57Ncwe64YOnJkg.png" /><figcaption>Select a Template Type and Name the Repl</figcaption></figure><h4>Create the Template</h4><p>Next, edit and create the template! I wrote <a href="https://replit.com/@GenericP3rson/pyTigerGraphHelloWorld#README.md">a long README.md file</a> and some simple pyTigerGraph code.</p><pre>import pyTigerGraph as tg</pre><pre>conn = tg.TigerGraphConnection(host = &quot;<a href="https://subdomain.i.tgcloud.io/">https://SUBDOMAIN.i.tgcloud.io/</a>&quot;, graphname = &quot;GRAPHNAME&quot;) # Adjust based on graph. For example in README, the connection would be: conn = tg.TigerGraphConnection(host = &quot;<a href="https://replit-template.i.tgcloud.io/">https://replit-template.i.tgcloud.io/</a>&quot;, graphname = &quot;MyGraph&quot;)</pre><pre>print(conn.echo()) # Hello GSQL</pre><pre>conn.apiToken = conn.getToken(conn.createSecret()) # Creates a token</pre><pre>print(conn.gsql(&#39;&#39;&#39;LS&#39;&#39;&#39;)) # First GSQL interaction!</pre><p>Note that I did have to import pyTigerGraph. To ensure the library is automatically uploaded for the user, add it to the pyproject.toml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kpH16eH25FFb8yT0qvSdvw.png" /><figcaption>Add pyTigerGraph as a Dependency</figcaption></figure><h4>Publish!</h4><p>When you are content with the entire Repl, press the name of the Repl. This will bring a box with information about the Repl. Add a description if you have not already. When you are satisfied with everything, press the “Publish” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*EKYPLpy0Tbq5S0pSoL3Lrg.png" /><figcaption>Add a Description and Press “Publish”</figcaption></figure><p>You will next have to go through several steps to finalise your Repl. The first tab is just the name and description, so you shouldn’t have to change anything. Press “Next.”</p><p>On the second tab, create tags to help users find your Repl. If none of the tags match your needs, you can create a new one!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfoiDiovcsA8-GUxZiwZ7Q.png" /><figcaption>Add tags!</figcaption></figure><p>On the icon tab, upload an image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDrqKtjMEr7lMcpA1L1QhQ.png" /><figcaption>Upload an icon image</figcaption></figure><p>The cover page will be the landing page for your Repl. Either add a photo or select a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_s4xYMiybTDT7QtAU6Mcw.png" /><figcaption>Add a cover photo or choose a file</figcaption></figure><p>Finally, on the last page, check the option to publish your Repl as a template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HAB66bKDxWYV1_sUCx7GGA.png" /><figcaption>Publish the file as a template!</figcaption></figure><p>Finally, press the “Publish to Community” button, and with that, you are complete! Congrats on creating your first Repl template!</p><h3>Conclusions</h3><p>Overall, the process of publishing Repl code to become templates was fairly straightforward and relatively simple. I am generally elated that anyone can create templates, and it’s awesome to be able to give back to the Repl community.</p><p>One final note is Repl has officially launched a template jam to encourage everyone to create templates. Repl has also recently released Nix, allowing templates to configure with any language. If you enjoyed this blog on creating templates, I would recommend trying out their template challenge!</p><p><a href="https://blog.replit.com/template-jam">Template Jam 2022</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d94d88fd6f5d" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/how-to-create-a-repl-it-template-d94d88fd6f5d">How to Create a Repl.it Template</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Prerequisites for Cybersecurity Beginners]]></title>
            <link>https://medium.com/geekculture/linux-prerequisites-for-cybersecurity-beginners-8d8614588612?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d8614588612</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Tue, 24 May 2022 03:30:38 GMT</pubDate>
            <atom:updated>2022-05-24T06:33:59.160Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Summary and Cheat Sheet of Introductory Linux Commands</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*BE-sOMdZP-EA3fUy.jpg" /><figcaption>Image from <a href="https://pixabay.com/photos/matrix-data-network-software-code-4493783/">Pixabay</a></figcaption></figure><h3>Overview</h3><p>Recently, I started exploring the wonderful world of cybersecurity. After exploring a few learning resources, I settled on <a href="https://tryhackme.com/">TryHackMe</a>, a cybersecurity training platform.</p><p><a href="https://tryhackme.com/">Learn Cyber Security | TryHackMe Cyber Training</a></p><p>As a complete beginner, I started with their beginner tracks, studying theory and fundamentals. In this blog, I will share an overview of the more practical Linux Fundamentals skills from the course.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0OSI5AQrsqiUCpYOn76yQ.png" /><figcaption>Image by Author, a guide to all of the commands discussed in this blog</figcaption></figure><h3>Part I: The Basics</h3><h4>Basic Commands</h4><p>To start, there are two “hello world” commands for Linux. The first is echo which will print a value. For example, to print hello world, one would write:</p><pre>echo hello world</pre><p>Next, whoami returns the username of the user.</p><pre>whoami</pre><h4>Filesystem</h4><p>If you have used a terminal before, you will be more or less familiar with most of these commands. In a terminal, you can access and manipulate every file on your system. The basics of Linux are cd which changes the directory and ls that lists all the files in a directory. (Think of a directory essentially as a folder.)</p><pre>cd FOLDER_NAME</pre><pre>ls</pre><p>Next, to view the contents of a file, use cat (which stands for “concatenate”).</p><pre>cat FILE_NAME</pre><h4>Search for and in Files</h4><p>To find a file, use the find tool.</p><pre>find -name FILE</pre><p>Something handy is that find can use the * wildcard which will stand in for any value. For example, if you want to find all of the files which are txt files, you can use the command:</p><pre>find -name *.txt</pre><p>Next, to look at the contents inside a file, you can use grep.</p><pre>grep PHRASE FILE</pre><p>For example, if I wanted to search for a certain IP address in a log example.log, I would type in:</p><pre>grep INSERT_THE_IP_ADDRESS_HERE example.log</pre><h4>Operators</h4><p>Operators can be used on top of commands to achieve certain objectives. For example, &amp; can be used to run a command in the background. This can be especially useful if the command will take a long time.</p><pre>cp big_file big_file_copy &amp;</pre><p>Next, &amp;&amp; will run two commands at once. For example, to enter and read the commands of a folder, one can use:</p><pre>cd Folder &amp;&amp; ls Folder</pre><p>&gt; assigns an output to something. For example, if I wanted to create a file with echo, say with the words “Cybersec is Epic!”, I could write:</p><pre>echo Cybersec is Epic! &gt; epic.txt</pre><p>Finally, &gt;&gt; is similar to &gt; but it instead adds it to the file. For example, if I wanted to add to epic.txt, I could use &gt;&gt;:</p><pre>echo Infosec is Epic! &gt;&gt; epic.txt</pre><h3>Part II: Navigating Linux</h3><h4>SSH</h4><p>SSH is one of the most important parts of Linux for cybersec! With this, you can connect to different machines. For example, in TryHackMe, you will need to connect to one machine from another frequently. To do this, you need to know the user’s (1) IP address, (2) username, and (3) password. To connect, type:</p><pre>ssh USERNAME@IP_ADDRESS</pre><blockquote>Note: Replace USERNAME and IP_ADDRESS with the actual username and IP address.</blockquote><p>In the prompts, you will be asked to confirm to continue. Type “yes.” Next, you will be prompted to type the password. If everything is correct, you will get connected to the other machine and can execute commands on it!</p><h4>Expanded Commands</h4><p>Most commands have extra abilities which can be unlocked via flags. For example, when viewing the contents of a directory, ls excludes any file that starts with .. But, with the --all or -a flag, it displays all of the files, including those with .:</p><pre>ls -a</pre><p>To find a full list of the flags of a command, you can check out its manual or man via the terminal.</p><pre>man ls</pre><h4>Filesystem: Management</h4><p>Like how you can create, remove, and copy files in Google Drive or Microsoft Word, you can do the same thing via your terminal! To create a folder, you need to make a directory or mkdir. For example:</p><pre>mkdir NewFolder</pre><p>Enter the folder via cd.</p><pre>cd NewFolder</pre><p>Next, in the folder, you can create a new file with touch.</p><pre>touch NewFile</pre><p>With the file, you can copy it with cp.</p><pre>cp NewFile NewFileCopy</pre><p>You can also move it with mv. Let’s do this by creating a new folder and then moving the NewFileCopy to the folder.</p><pre>mkdir NewerFolder &amp;&amp; mv NewFileCopy NewerFolder/NewFileCopy</pre><p>mv is pretty cool since it can also be used to rename a file. For example, if I wanted to rename NewFile to OldFile, I could write:</p><pre>mv NewFile OldFile</pre><p>Finally, you can determine the filetype of a file with file. For example, let’s add content to OldFile and then look at its file type.</p><pre>echo Some Content! &gt; OldFile &amp;&amp; file OldFile</pre><h4>Switching Users</h4><p>Sometimes, you will need to switch between users. You can do this via su.</p><pre>su OTHERUSER</pre><p>You will then be prompted to enter the other user’s password. Additionally, to enter the other user’s home directory, add the flag -l:</p><pre>su -l OTHERUSER</pre><h3>Part III: Navigating Linux</h3><h4>Text Editors</h4><p>Similar to Visual Studio Code or Sublime, the terminal has a few built-in text editors, including nano and vim.</p><p>nano is the more straightforward and simple text editor. To use it, type nano FILENAME then follow the command list on the bottom to make the changes.</p><pre>nano FILENAME</pre><p>vim is slightly more complex. In short, to use it, type i to edit (“insert”) text. To exit and save, press the escape key then type wq!.</p><pre>vim FILENAME</pre><h4>Grabbing Files</h4><p>To download files from a URL—including the computer’s URL—you can use wget or curl.</p><pre>wget URL</pre><p>To securely copy files between two computers, you can use scp.</p><pre>scp SOURCE DESTINATION</pre><p>Finally, you can host web servers on the terminal with which you can retrieve files. To create a web server, simply run:</p><pre>python3 -m http.server</pre><h4>Processes</h4><p>Programs running on your computer are called processes. To view all of them, use ps.</p><pre>ps</pre><p>A column of the result will have the PID, or process ID. You can use this to manage the processes. For example, to stop a process, use the kill command.</p><pre>kill PID_OF_PROCESS</pre><p>Another set of helpful commands to use are systemctl. For example, to start, stop, enable, or disable apache2, you can use:</p><pre>systemctl start apache2</pre><pre>systemctl stop apache2</pre><pre>systemctl enable apache2</pre><pre>systemctl disable apache2</pre><p>Finally, as opposed to &amp; having a command execute in the background, to bring a command in the foreground, use fg.</p><pre>fg JOB_ID</pre><blockquote>Note: The job ID is printed when you run the command in the background.</blockquote><h4>Cron</h4><p>To schedule and repeat tasks, you can use cron. To see all tasks regularly running, run crontab -e.</p><pre>crontab -e</pre><p>Cron jobs contain six values: minute, hour, day of the month, month, day of the week, and the job itself. To make something run regularly, you can replace the value with an *. The first value can also be replaced with events like @reboot running when the system is rebooting.</p><h4>Libraries</h4><p>The awesome part of Linux is everything is open-source. To install and remove libraries, you can use apt.</p><pre>apt update</pre><pre>apt install LIBRARY</pre><pre>apt remove LIBRARY</pre><h3>Part IV: Conclusions and Resources</h3><p>That wraps up my overview of basic Linux commands for cybersecurity! If you are interested in delving more into the field, I would recommend the TryHackMe modules. This entire blog was based heavily on their Linux Fundamentals module. Along with the practical Linux and Windows skills, I have been enjoying the theory they provide to truly understand how systems work to be able to penetrate them.</p><p><a href="https://tryhackme.com/">Learn Cyber Security | TryHackMe Cyber Training</a></p><p>I have also been trying to explore capture the flag and have been using <a href="https://play.picoctf.org/">Pico CTF</a>. Finally, to recap, this is the complete list of all the commands:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0OSI5AQrsqiUCpYOn76yQ.png" /><figcaption>Image by Author, a guide to all of the commands discussed in this blog</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d8614588612" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/linux-prerequisites-for-cybersecurity-beginners-8d8614588612">Linux Prerequisites for Cybersecurity Beginners</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Using TigerGraph with Go: Exploring COVID-19 Patient Cases]]></title>
            <link>https://medium.com/data-science/an-introduction-to-using-tigergraph-with-go-exploring-covid-19-patient-cases-f2c0e45849e4?source=rss-9d61d58508ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c0e45849e4</guid>
            <category><![CDATA[tigergraph]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Shreya Chaudhary]]></dc:creator>
            <pubDate>Mon, 23 May 2022 04:06:20 GMT</pubDate>
            <atom:updated>2022-05-24T14:53:58.572Z</atom:updated>
            <content:encoded><![CDATA[<h4>Querying a Graph Database Using TigerGraph and Golang Both Through the TigerGraph REST Endpoints and TigerGo</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*uDLy5dmFtVrAExKH.jpg" /><figcaption>Image from <a href="https://pixabay.com/illustrations/nature-reserve-environment-6734180/">Pixabay</a></figcaption></figure><h3>Overview</h3><h4>Introduction</h4><p>Recently, I learned the basics of Go (Golang) and decided to build a TigerGraph Go package called TigerGo with my newfound knowledge. In this blog, I will walk through the basics of using the new library and how to create query a TigerGraph graph database with Go.</p><h4>Tools</h4><ul><li><a href="https://github.com/GenericP3rson/TigerGo">TigerGo</a> (v0.0.2): A new TigerGraph Go wrapper created today to interact with a TigerGraph graph database with Go.</li><li><a href="https://tgcloud.io/">TigerGraph Cloud</a>: Create and host a TigerGraph solution for free</li><li><a href="https://go.dev/">Go</a>: A language created by Google.</li></ul><h3>Part I: Create and Prepare a TigerGraph Solution</h3><h4>Step I: Create a Solution</h4><p>To start, create a TigerGraph solution on <a href="https://tgcloud.io/">TG Cloud</a>. There, navigate to the “My Solutions” tab then press the blue “Create Solution” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2fXaliou6Dom9Xxm.png" /><figcaption>Choose “My Solutions” then press “Create Solution”</figcaption></figure><p>On the first page, select any of the starter kits. For this example, I will be using the COVID-19 Analysis Starter Kit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KSTIylNyZhanryxZ.png" /><figcaption>Select a starter kit</figcaption></figure><p>Leave the second page as is; this will set up a free TigerGraph instance. On the third page, configure the solution appropriately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W70scp7TbxipyPLk.png" /><figcaption>Configure the settings appropriately</figcaption></figure><blockquote>Note: Keep note of your subdomain and inital password!</blockquote><p>Finally, on the last page, verify all the information is correct then press “Submit”! You will have to give the solution a few minutes to start up.</p><h4>Step II: Load the Data</h4><p>Once the solution is up and running, launch GraphStudio by clicking the “Applications” button and then “GraphStudio” from the dropdown. You may need to log in once it is launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hGFtgotobzgiBNooRWjV_Q.png" /><figcaption>Open GraphStudio</figcaption></figure><p>In GraphStudio, click into “MyGraph” in the top left corner, navigate to the Load Data, then press the play button to load all of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*M8HsgFK6VUmfGkUFWlaKig.png" /><figcaption>Load all the Data</figcaption></figure><p>Perfect! With that, you are ready to interact with the solution in Go!</p><h3>Part II: Create a Go Project and Import TigerGo</h3><h4>Step I: Import the Package</h4><p>With the information created, you will next want to create a new Go project and then import the TigerGo package. First, create a new Go project:</p><pre>mkdir GoProject &amp;&amp; cd GoProject</pre><pre>go mod init GoProject</pre><p>Next, create a main file for the code and import the library, github.com/GenericP3rson/TigerGo.</p><pre>package main</pre><pre>import(<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><pre>func main() {</pre><pre>   // Main code will be here</pre><pre>}</pre><blockquote>Note: When using Visual Studio Code, the above code will automatically delete the imports because they are not used.</blockquote><p>You can then import the library in two ways. You can either manually get the package with:</p><pre>go get github.com/GenericP3rson/TigerGo</pre><p>Alternatively, you can have the go mod automatically import it with:</p><pre>go mod tidy</pre><blockquote>Note: TigerGo is in its experimental phase, and will experience development after this blog. However, the general syntax should remain the same, mirroring <a href="https://docs.tigergraph.com/pytigergraph/current/intro/">pyTigerGraph</a>.</blockquote><h4>Step II: Create the Connection</h4><p>First, start out by creating a TigerGraphConnection. This will require the username (which defaults to “tigergraph”) and password of your solution, the graph name, and your host. This also requires a token, but you can leave it empty, create a token calling GetToken, then fill in the token.</p><pre>package main</pre><pre>import(<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><pre>func main() {</pre><pre>   conn := TigerGo.TigerGraphConnection{</pre><pre>      Token: &quot;&quot;, // Leaving it empty for now<br>      Host: &quot;https://SUBDOMAIN.i.tgcloud.io&quot;,<br>      GraphName: &quot;GRAPHNAME&quot;,<br>      Username: &quot;tigergraph&quot;,<br>      Password: &quot;PASSWORD&quot;</pre><pre>   }</pre><pre>   fmt.Println(conn.GetToken())</pre><pre>}</pre><p>For my example, the code will look like this, with the password redacted:</p><pre>package main</pre><pre>import(<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><pre>func main() {</pre><pre>   conn := TigerGo.TigerGraphConnection{</pre><pre>      Token: &quot;&quot;, // Leaving it empty for now<br>      Host: &quot;https://golang.i.tgcloud.io&quot;,<br>      GraphName: &quot;MyGraph&quot;,<br>      Username: &quot;tigergraph&quot;,<br>      Password: &quot;PASSWORD&quot;</pre><pre>   }</pre><pre>   fmt.Println(conn.GetToken())</pre><pre>}</pre><p>Once a token is generated, replace it under token, as it is necessary for all the other functions to work.</p><pre>package main</pre><pre>import(<br>   &quot;fmt&quot;<br>   &quot;github.com/GenericP3rson/TigerGo&quot;<br>)</pre><pre>func main() {</pre><pre>   conn := TigerGo.TigerGraphConnection{</pre><pre>      Token: &quot;TOKEN&quot;,<br>      Host: &quot;https://golang.i.tgcloud.io&quot;,<br>      GraphName: &quot;MyGraph&quot;,<br>      Username: &quot;tigergraph&quot;,<br>      Password: &quot;PASSWORD&quot;</pre><pre>   }</pre><pre>}</pre><p>Perfect! With this, you are now ready to start running commands.</p><h3>Part III: Commands</h3><h4>Vertex Commands</h4><p>There are several TigerGo functions for retrieving and manipulating vertices. For instance, with TigerGo, you can get all vertices of a certain type. For example, if you wanted to grab all the Patient vertices, you can do so with:</p><pre>conn.GetVertices(&quot;Patient&quot;)</pre><p>The REST equivalent queries the /graph/{graph_name}/vertices endpoint.</p><pre>client := &amp;http.Client{ Timeout: time.Second * 10, }  </pre><pre>req, err := http.NewRequest(&quot;GET&quot;, fmt.Sprintf(&quot;%s:9000/graph/%s/vertices/%s&quot;, HOST, GRAPHNAME, vertex_type), nil) </pre><pre>if err != nil { return err.Error() }</pre><pre>req.Header.Set(&quot;Authorization&quot;, &quot;Bearer &quot;+TOKEN) <br>response, err := client.Do(req)</pre><pre>if err != nil { return err.Error() }</pre><h4>Edge Commands</h4><p>Similarly, TigerGo provides functions involving edges. For example, say I wanted to see how a patient interacted with their surrounding. To do so, I can grab all the edges connected to the patient.</p><pre>conn.GetEdges(&quot;Patient&quot;, &quot;SOME_PATIENT_ID&quot;)</pre><p>The REST equivalent will make a request to the /graph/{graph_name}/edges endpoint.</p><pre>client := &amp;http.Client{ Timeout: time.Second * 10, }</pre><pre>req, err := http.NewRequest(&quot;GET&quot;, fmt.Sprintf(&quot;GET&quot;, fmt.Sprintf(&quot;%s:9000/graph/%s/edges/%s/%s/_&quot;, HOST, GRAPHNAME, source_vertex, source_vertex_id), nil)</pre><pre>if err != nil { return err.Error() }</pre><pre>req.Header.Set(&quot;Authorization&quot;, &quot;Bearer &quot;+TOKEN) <br>response, err := client.Do(req)</pre><pre>if err != nil { return err.Error() }</pre><h4>Query Commands</h4><p>Finally, using the TigerGo package, you can run installed queries. The COVID-19 starter kit comes with many pre-installed queries. For example, let’s run ageDistribution, a query that returns the age distribution of the patients.</p><blockquote>Note: Make sure ageDistribution is installed before running the query.</blockquote><pre>conn.RunInstalledQuery(&quot;ageDistribution&quot;)</pre><p>The REST API version sends a GET request to /graph/{graph_name}/{query_name}.</p><pre>client := &amp;http.Client{ Timeout: time.Second * 10, }</pre><pre>req, err := http.NewRequest(&quot;GET&quot;, fmt.Sprintf(&quot;%s:9000/query/%s/%s&quot;, conn.Host, conn.GraphName, queryName), nil)</pre><pre>if err != nil { return err.Error() }</pre><pre>req.Header.Set(&quot;Authorization&quot;, &quot;Bearer &quot;+TOKEN) <br>response, err := client.Do(req)</pre><pre>if err != nil { return err.Error() }</pre><h3>Part IV: Conclusions, Resources, and Next Steps!</h3><p>And that’s a quick introduction to TigerGo! Want to make a contribution? Feel free to make a pull request to the <a href="https://github.com/GenericP3rson/TigerGo">repo</a>!</p><p><a href="https://github.com/GenericP3rson/TigerGo">GitHub - GenericP3rson/TigerGo</a></p><p>Interested in Go? I previously wrote a blog about getting into Go and creating a package that you can check out!</p><p><a href="https://shreya-chaudhary.medium.com/creating-and-deploying-your-first-go-package-eae220905745">Creating and Deploying your First Go Package</a></p><p>Interested in creating your own TigerGraph wrapper? Check out the full documentation of the official endpoints <a href="https://docs.tigergraph.com/tigergraph-server/current/api/built-in-endpoints">here</a>.</p><p><a href="https://docs.tigergraph.com/tigergraph-server/current/api/built-in-endpoints">Built-in Endpoints - TigerGraph Server</a></p><p>Finally, if you have any questions or would like to chat with TigerGraph developers while developing projects, join <a href="https://discord.gg/DMHabbX3BA">the Discord</a>!</p><p><a href="https://discord.gg/DMHabbX3BA">Join the TigerGraph Discord Server!</a></p><blockquote>Note: All images, unless otherwise indicated, were created by the author.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c0e45849e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/an-introduction-to-using-tigergraph-with-go-exploring-covid-19-patient-cases-f2c0e45849e4">An Introduction to Using TigerGraph with Go: Exploring COVID-19 Patient Cases</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>