打赏

Neo4j沙盒实验申请过程步骤(图文详解)

 

 

 

  不多说,直接上干货!

 

 

参考博客  

http://blog.csdn.net/u012318074/article/details/72793632    (对此表示感谢)

 

 

 

 

 

 

 

前期博客

  我暂时是将Neo4j图数据库安装在Ubuntu14.04下和Ubuntu16.04下。

Ubuntu16.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

Ubuntu14.04下Neo4j图数据库官网安装部署步骤(图文详解)(博主推荐)

 

 

 

  Neo4j 官方提供的沙盒申请使用过程,内容较为简单,但沙盒里面的内容对于初学者非常有用。

 

 

 

 

 

 

沙盒实验注册

  打开 Neo4j 官方沙盒实验页面:https://neo4j.com/sandbox-v2/ 。点击右上角的“Login”。

 

 

 

 

 

 

   在弹出的界面中输入邮箱和密码进行注册,进入注册邮箱 。

 

 

 

 

 

 

 

 

 

 

 

 

  然后,大家到你所注册的邮箱去。

 

 

  点击

 

 

 

 

 

 

 

  至此,沙盒实验完成注册了。

 

 

 

 

 

选择沙盒

  在页面中选择一个沙盒作为实验 。

    可以看到,沙盒实验团队提供了很多个模块供我们选择。对此表示感谢!大家可以有兴趣的,多去尝试。

  我这里,因为时间有限,仅此先以我需要的是“Network and IT Management”,点击“Launch Sandbox”

 

 

 

 

   过一会儿页面中间会出现“Network and IT Management”的信息 ,同时,页面所罗列给我们的,会少了一个。

 

 

 

   其实,需要一段时间,自动会连接进入。

 

 

 

 

   大家,可以尝试点击“Details/Data Model/Code/Advanced”查看相关信息。

 

   

 

 

Get Started

Get Started with your Neo4j Sandbox

  1、Visit the Neo4j Browser. You'll automatically be authenticated. A tutorial will guide you through the datamodel and example data, while teaching you how property graphs work in real-world use cases.

  2、Start building your application backed by Neo4j. Write your own code, in PHP, Java, JavaScript, Python, or one of any number of other languages, using templates provided.

     3、Download Neo4j to your own computer, or start a long-living Neo4j instance in the cloud on AWS or other hosting platforms.

 

 

 

 

 

 

Details

 

 

Neo4j Browser: https://10-0-1-12-33213.neo4jsandbox.com/

Direct Neo4j HTTP: http://52.91.125.132:33213/browser/

Username: neo4j
Password: differences-docks-strains

IP Address: 52.91.125.132
HTTP Port: 33213

 

 

 

 

 

 Data Model

 

 

 

 

 

 

 

 Code

 

 

 

 

 

  php语言

<?php
/**
 * To install Neo4j-PHP-Client, we use Composer
 *
 * $ curl -sS https://getcomposer.org/installer | php
 * $ php composer.phar require graphaware/neo4j-php-client
 *
 */

require __DIR__.'/vendor/autoload.php';

use GraphAware\Neo4j\Client\ClientBuilder;

// change to your hostname, port, username, password
$neo4j_url = "bolt://neo4j:differences-docks-strains@52.91.125.132:33212";

// setup connection
$client = ClientBuilder::create()
    ->addConnection('default', $neo4j_url)
    ->build();

$cypher_query = <<<EOQ
MATCH (n)
RETURN id(n) AS id
LIMIT 10
EOQ;

$params = [];
$result = $client->run($cypher_query, $params);

foreach ($result->records() as $record) {
  echo $record->get('id') . PHP_EOL;
}

 

 

 

 

 

 

  python语言

# pip install neo4j-driver

from neo4j.v1 import GraphDatabase, basic_auth

driver = GraphDatabase.driver(
    "bolt://52.91.125.132:33212", 
    auth=basic_auth("neo4j", "differences-docks-strains"))
session = driver.session()

cypher_query = '''
MATCH (n)
RETURN id(n) AS id
LIMIT 10
'''

results = session.run(cypher_query,
  parameters={})

for record in results:
  print(record['id'])

 

 

 

 

 

  java语言

// Download Java Driver: http://search.maven.org/#artifactdetails|org.neo4j.driver|neo4j-java-driver|1.0.0|jar

import org.neo4j.driver.v1.*;
import static org.neo4j.driver.v1.Values.parameters;

import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;

public class BlankSandbox {

    public static void main(String...args) {
        Config noSSL = Config.build().withEncryptionLevel(Config.EncryptionLevel.NONE).toConfig();
        Driver driver = GraphDatabase.driver("bolt://52.91.125.132:33212",AuthTokens.basic("neo4j","differences-docks-strains"),noSSL); // <password>
        try (Session session = driver.session()) {
            String cypherQuery =
                "MATCH (n) " + 
                "RETURN id(n) AS id";
            StatementResult result = session.run(cypherQuery, parameters());
            while (result.hasNext()) {
                System.out.println(result.next().get("id"));
            }
        }
    }
}

 

 

 

 

 

  js语言

// npm install --save neo4j-driver
var neo4j = require('neo4j-driver').v1;
var driver = neo4j.driver('bolt://52.91.125.132:33212', neo4j.auth.basic('neo4j', 'differences-docks-strains'));

var query = 
  "MATCH (n) \
   RETURN ID(n) as id \
   LIMIT $limit";

var params = {"limit": 10};

var session = driver.session();

session.run(query, params)
  .then(function(result) {
    result.records.forEach(function(record) {
        console.log(record.get('id'));
    })
  })
  .catch(function(error) {
    console.log(error);
  });

 

 

 

 

  Advanced

 

 

 

 

 

 

 

 

 

 

进入 web 界面

  这里直接点击“Get Started”中第一项的“Neo4j Browser”进入web界面 

 

   需要一段时间,点击你的浏览器下方的accpet。

https://10-0-1-12-33218.neo4jsandbox.com/browser/

 

 

   第一次数据完全加载完成需要一段时间

 

 

 

 

 

 

   大家可以多去点点,初步了解认识下

 

 

 

 

   其他的,不多赘述。

 

posted @ 2017-06-03 10:08  大数据和AI躺过的坑  阅读(1514)  评论(0编辑  收藏  举报