Learning Neo4j 3.x(Second Edition)
上QQ阅读APP看书,第一时间看更新

Sandbox

The incredible team at Neo4j managed to offer an even easier opportunity to try Neo4j--the Sandbox. Right off Neo4j's own website, with a few clicks, you will be able to create your own server for free on a public cloud. Of course, there is a major limitation, which is that it will last seven days before it disappears. However, all the work you have done will not be in vain, as it is possible to download the content of your Sandbox. Sounds awesome, right?

Even more awesome is the ability to have a database with some data, even personalized data like your Twitter network (people and tweets).

At this date, other available datasets are as follows:

  • The connections around the Trump administration
  • Bills and votes from the US Congress
  • Movies, in order to generate recommendations

Of course, you may also get a blank Sandbox. You can follow these instructions:

  1. We will now create a Twitter-flavored Sandbox. This needs a Twitter account, which you hopefully already have.
  2. On the home page of Neo4j.org, click on the TRY NEO4J SANDBOX button:
Neo4j home page
  1. No download is required; however, a stable internet connection is advised:
Neo4j Sandbox creation start
  1. After we click on Start Now, as we are not logged in, this popup appears, inviting us to authenticate through a service of our choice:
Authentication popup
  1. We will choose to LOG IN with Twitter. This leads to another popup asking to allow Neo4j permission to consult our Twitter account. You will land on a page like this one:
Sandbox home page, authenticated
  1. Click on Launch Sandbox in the Twitter frame:
Sandbox home page, authenticated - Get Started
  1. After the creation of your first Sandbox, go to the Details tab, and middle-click on the Direct Neo4j HTTP link to open the Neo4j browser in a new tab:
Connection details
  1. A card is displayed; click on the right arrow on the right-hand of this card twice, so that you can see the Your mentions title:
Your Twitter mentions
  1. Then, click on the first block of code. This is Cypher code; we will get back to it later, but take a second to appreciate how readable it is. The effect of your click is to copy the code just preceding, in the prompt zone.
  2. Next, click on the arrow on the right of the prompt zone in order to execute this code. Congratulations, you have executed your first Cypher query!
  3. Now, some hacking (not really). Did you notice the LIMIT 10 at the end of the query? Just like in SQL, its use is to return a limited number of rows. Wait, rows! This is not rows, this is a graph. However, this graph can be displayed as a table if you click on the Text tab on the left-hand of the card. You will notice it has ten lines.

 

  1. Click on the same query again in blue frame, and before executing it, change the limit to 300. For me, it looks as follows:
My Twitter mentions, expanded
  1. As you can see, increasing the limit decreased the readability. Even if you move the nodes (drag them), it is not very human-friendly.
Note that because the browser is running inside your web browser, you cannot ask it to display thousands of nodes. You will get warnings indicating that not all nodes are displayed. What you see in the browser will likely always be a partial view of your data. Keep this in mind.