Exemplo n.º 1
0
def addMovieFieldReationship(movieNode, fieldString, fieldNodeIdList):

    for fieldNodeId in fieldNodeIdList:
        matcher = NodeMatcher(graph)
        x = matcher.get(int(fieldNodeId))

        rel = Relationship(movieNode, 'movie' + fieldString, x)
        graph.create(rel)
Exemplo n.º 2
0
def addUserFieldReationship(userNode, fieldString, fieldNodeIdList):

    for fieldNodeId in fieldNodeIdList:
        matcher = NodeMatcher(graph)
        x = matcher.get(int(fieldNodeId))

        rel = Relationship(userNode, fieldString + 'Preference', x)
        graph.create(rel)
Exemplo n.º 3
0
 def get(self, id):
     matcher = NodeMatcher(self.cli.graph)
     return matcher.get(id)
Exemplo n.º 4
0
from py2neo import Graph, NodeMatcher
import uuid

graph = Graph(password="******")
matcher = NodeMatcher(graph)
txn = graph.begin()

nodes = graph.run(
    "MATCH (n) WHERE NOT n:Placeholder WITH COUNT(n) AS nodes RETURN nodes"
).data()[0]['nodes']
for i in range(nodes):
    node = matcher.get(i)
    if node is not None and node['id'] is None:
        node['id'] = str(uuid.uuid4())
        graph.push(node)

txn.commit()
Exemplo n.º 5
0
 def getEntityRelationbyEntity(self, value):
     matcher = NodeMatcher(self.graph)
     answer = matcher.get(
         "MATCH (entity1) - [rel] -> (entity2)  WHERE entity1.title = \"" +
         value + "\" RETURN rel,entity2")
     return answer
Exemplo n.º 6
0
 def find_by_id(id):
     matcher = NodeMatcher(graph)
     return matcher.get(int(id))