GraphDB的基本觀念


Node:()
節點,通常用小括號表示,括號內可以寫入label跟property,label可以有複數種。

{
  "identity": 0,
  "labels": [
    "Movie"
  ],
  "properties": {
    "tagline": "Welcome to the Real World",
    "title": "The Matrix",
    "released": 1999
  },
  "elementId": "4:122b11a5-5b2d-4631-aa50-12c1d300aa84:0"
}

relationship:–〔〕–
關係,通常用中括號及線段表示,線段可以具有方向性,括號內可以寫入type跟property,type只有一種。

{
  "identity": 0,
  "start": 3,
  "end": 0,
  "type": "ACTED_IN",
  "properties": {
    "roles": [
      "Morpheus"
    ]
  },
  "elementId": "5:122b11a5-5b2d-4631-aa50-12c1d300aa84:0",
  "startNodeElementId": "4:122b11a5-5b2d-4631-aa50-12c1d300aa84:3",
  "endNodeElementId": "4:122b11a5-5b2d-4631-aa50-12c1d300aa84:0"
}

語言類比:

  • Node:名詞
  • Edge:動詞、介詞
  • Properties of node:形容詞
  • Properties of edge:副詞

SQL資料型態類比:

  • Node:SQL資料庫中table的一筆資料,one row。
  • Property:SQL資料庫中,一筆資料的某項參數值,one column。
  • Leble:SQL資料庫中的某個table。
  • Type:
     多對多:描述關係的table
     多對一:foreign key

SQL語法類比:

SQL Cypher
SELECT return
INSERT create
UPDATE、SET set
DELETE detach、delete、remove
WHERE where、match
ORDER BY order by
LIMIT limit
##Neo4j ##GraphDB







你可能感興趣的文章

那些年不懂的JS - Scope 範疇

那些年不懂的JS - Scope 範疇

1338. Reduce Array Size to The Half

1338. Reduce Array Size to The Half

[筆記] Linux 基礎安裝與架站(基於 CentOS7.9.2009 示範)

[筆記] Linux 基礎安裝與架站(基於 CentOS7.9.2009 示範)






留言討論





2
2
2