濮阳杆衣贸易有限公司

主頁(yè) > 知識(shí)庫(kù) > neo4j安裝配置入門(mén)教程

neo4j安裝配置入門(mén)教程

熱門(mén)標(biāo)簽:南昌呼叫中心外呼系統(tǒng)哪家好 ai電話電話機(jī)器人 河北便宜電銷機(jī)器人軟件 怎么申請(qǐng)400熱線電話 泗洪正規(guī)電話機(jī)器人找哪家 湖南保險(xiǎn)智能外呼系統(tǒng)產(chǎn)品介紹 怎么去開(kāi)發(fā)一個(gè)電銷機(jī)器人 小程序智能電話機(jī)器人 簡(jiǎn)單的智能語(yǔ)音電銷機(jī)器人

注:網(wǎng)上找了許多教程,發(fā)現(xiàn)都不太適合0基礎(chǔ)的用戶,所以就自己寫(xiě)了一下。
推薦使用1.x版本,經(jīng)測(cè)試2.3.3大量函數(shù)被遺棄。

安裝啟動(dòng)

  • 官網(wǎng)下載tar包
  • 解壓,進(jìn)入bin下,運(yùn)行./neo4j
  • 在url中打開(kāi)localhost:7474即可使用

配置

數(shù)據(jù)庫(kù)的location設(shè)置。
conf/neo4j-server.properties中第14行org.neo4j.serve.database.location=進(jìn)行修改

使用

1.web可視化neo4j的工具是webadmin,打開(kāi)方式:url中打開(kāi)local/webadmin,即可使用
注:代碼修改數(shù)據(jù)庫(kù),似乎需要每次重啟neo4j才能在webadmin中顯示,也有可能是數(shù)據(jù)同步慢
2.簡(jiǎn)單實(shí)例(java操作neo4j)

package neo4j;

import java.io.File;
import java.io.IOException;

import javax.management.relation.Relation;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.io.fs.FileUtils;

public class test {


 public enum RelTypes implements RelationshipType{
  KNOWS
 }

 private static void registerShutdownHook( final GraphDatabaseService graphDb )
 {
  // Registers a shutdown hook for the Neo4j instance so that it
  // shuts down nicely when the VM exits (even if you "Ctrl-C" the
  // running example before it's completed)
  /*為了確保neo4j數(shù)據(jù)庫(kù)的正確關(guān)閉,我們可以添加一個(gè)關(guān)閉鉤子方法
   * registerShutdownHook。這個(gè)方法的意思就是在jvm中增加一個(gè)關(guān)閉的
   * 鉤子,當(dāng)jvm關(guān)閉的時(shí)候,會(huì)執(zhí)行系統(tǒng)中已經(jīng)設(shè)置的所有通過(guò)方法
   * addShutdownHook添加的鉤子,當(dāng)系統(tǒng)執(zhí)行完這些鉤子后,jvm才會(huì)關(guān)閉。
   * 所以這些鉤子可以在jvm關(guān)閉的時(shí)候進(jìn)行內(nèi)存清理、對(duì)象銷毀等操作。*/
  Runtime.getRuntime().addShutdownHook( new Thread()
  {
   @Override
   public void run()
   {
    graphDb.shutdown();
   }
  } );
 }

 public static void main(String[] args) throws IOException {

  FileUtils.deleteRecursively( new File( "db" ) ); 
  GraphDatabaseService graphdb=new GraphDatabaseFactory().newEmbeddedDatabase("db");
  Relationship relationship;
  Transaction tx=graphdb.beginTx();
  try{
   Node node1=graphdb.createNode();
   Node node2=graphdb.createNode();

   node1.setProperty("message", "Hello");
   node2.setProperty("message", "World");

   relationship = node1.createRelationshipTo(node2, RelTypes.KNOWS);
   relationship.setProperty("message", "brave neo4j");


   tx.success();
   System.out.println("successfully");
  }
  finally{
   tx.finish();
  }
  registerShutdownHook(graphdb);
 }

}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • Window下Neo4j安裝圖文教程
  • 在Python中使用Neo4j數(shù)據(jù)庫(kù)的教程

標(biāo)簽:威海 江蘇 柳州 淮安 景德鎮(zhèn) 瀘州 荊門(mén) 那曲

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《neo4j安裝配置入門(mén)教程》,本文關(guān)鍵詞  neo4j,安裝,配置,入門(mén)教程,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《neo4j安裝配置入門(mén)教程》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于neo4j安裝配置入門(mén)教程的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    尉氏县| 阜城县| 城固县| 白朗县| 澜沧| 宁晋县| 大新县| 乐亭县| 鄂尔多斯市| 屯昌县| 宜都市| 恩平市| 甘孜| 星子县| 贺兰县| 通海县| 宁武县| 扬州市| 乐昌市| 六盘水市| 广安市| 南通市| 曲周县| 大庆市| 广平县| 汝城县| 繁昌县| 镇安县| 宁晋县| 讷河市| 高淳县| 台南市| 奉节县| 栾城县| 新巴尔虎左旗| 泽普县| 靖边县| 日喀则市| 三门峡市| 和林格尔县| 牙克石市|