athi
athi

Reputation: 41

Neo4j url linking

I am using the following code to create neo4j graph. It's working fine with name or string. Can I create relationship for URLs exp: www.examples.com/1 likes 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)

Upvotes: -1

Views: 175

Answers (1)

Tom Geudens
Tom Geudens

Reputation: 2656

You are limited to the following types :

Boolean
Integer
Float
String
List
Map

So you would store a URL as a String.

Hope this helps.

Regards, Tom

Upvotes: 0

Related Questions