-1

我正在使用以下代码创建neo4j图表。它适用于名称或字符串。我可以为 URL exp 创建关系吗:www.examples.com/1 喜欢www.examples.com/2

from neo4jrestclient.client import GraphDatabase

db = GraphDatabase("http://localhost:7474", username="neo4j", password="admin")

# Create some nodes with labels
user = db.labels.create("User")
u1 = db.nodes.create(name="Marco")
user.add(u1)
u2 = db.nodes.create(name="Daniela")
user.add(u2)

beer = db.labels.create("Beer")
b1 = db.nodes.create(name="Punk IPA")
b2 = db.nodes.create(name="Hoegaarden Rosee")
# You can associate a label with many nodes in one go
beer.add(b1, b2)
# User-likes->Beer relationships
u1.relationships.create("likes", b1)
u1.relationships.create("likes", b2)
u2.relationships.create("likes", b1)
# Bi-directional relationship?
u1.relationships.create("friends", u2)
4

1 回答 1

0

您仅限于以下类型:

Boolean
Integer
Float
String
List
Map

因此,您会将 URL 存储为字符串。

希望这可以帮助。

问候,汤姆

于 2017-08-06T10:47:01.040 回答