Exemplo n.º 1
0
 def test_create_node_with_mixed_property_types(self):
     node, = self.graph_db.create({"number": 13, "foo": "bar", "true": False, "fish": "chips"})
     self.assertEqual(4, len(node.get_properties()))
     self.assertEqual("chips", node["fish"])
     self.assertEqual("bar", node["foo"])
     self.assertEqual(13, node["number"])
     self.assertEqual(False, node["true"])
Exemplo n.º 2
0
 def test_create_node_with_mixed_property_types(self):
     node, = self.graph.create(
         {"number": 13, "foo": "bar", "true": False, "fish": "chips"}
     )
     assert len(node.get_properties()) == 4
     assert node["fish"] == "chips"
     assert node["foo"] == "bar"
     assert node["number"] == 13
     assert not node["true"]
Exemplo n.º 3
0
 def test_create_node_with_mixed_property_types(self):
     node, = self.graph.create({
         "number": 13,
         "foo": "bar",
         "true": False,
         "fish": "chips"
     })
     assert len(node.get_properties()) == 4
     assert node["fish"] == "chips"
     assert node["foo"] == "bar"
     assert node["number"] == 13
     assert not node["true"]
Exemplo n.º 4
0
 def test_create_node_with_mixed_property_types(self):
     node, = self.graph_db.create({
         "number": 13,
         "foo": "bar",
         "true": False,
         "fish": "chips"
     })
     self.assertEqual(4, len(node.get_properties()))
     self.assertEqual("chips", node["fish"])
     self.assertEqual("bar", node["foo"])
     self.assertEqual(13, node["number"])
     self.assertEqual(False, node["true"])
Exemplo n.º 5
0
def update_source_property(node):
    if not isinstance(node, gb.neo4j.Node):
        raise TypeError('The node argument must be an object of neo4j.Node class!')
    source = node.get_properties()['source']
    if 'RegulonDB' in source:
        pass
    elif isinstance(source, basestring):
        node.update_properties({'source': [source, 'RegulonDB']})
    elif isinstance(source, list):
        node.update_properties({'source': source.append('RegulonDB')})
    else:
        raise Exception('Unexpected source type!')
Exemplo n.º 6
0
 def deleteNodeByUuid(self, namespace,uuid):
     # TM: No clue why the statements below will not work.
     #query = neo4j.CypherQuery(self._neo_graph, \
     #	"MATCH (n {`{namespace1}:UUID` : \"{uuid1}\"}) RETURN n;")
     #node = query.execute_one(namespace1=namespace.strip(),uuid1 = uuid.strip())
   str = "MATCH (n:Entity {`"+namespace+":UUID` : \""+uuid+"\"}) RETURN n;"
   results = self._neo_graph.cypher.execute(str)  # Cristi: Should be here  execute_one ?
   if (results is not None):
     for r in results:
        print r
        node = r[0] 
        props = node.get_properties()
        print props
        requestId = node["provdb:RequestId"]
        self.deleteNodeByRequestid(namespace,requestId)
     return True
   else:
     return False
Exemplo n.º 7
0
 def test_has_correct_properties(self):
     assert [node.get_properties()
             for node in self.nodes] == self.flintstones
Exemplo n.º 8
0
 def test_has_correct_properties(self):
     self.assertEqual([
         node.get_properties()
         for node in self.nodes
     ], self.flintstones)
Exemplo n.º 9
0
 def test_has_correct_properties(self):
     assert [
         node.get_properties()
         for node in self.nodes
     ] == self.flintstones
Exemplo n.º 10
0
 def test_has_correct_properties(self):
     self.assertEqual([node.get_properties() for node in self.nodes],
                      self.flintstones)
Exemplo n.º 11
0
def get_nodename(node):
    node = node.get_properties()
    node = node.get('name')
    node = node.encode()
    return str(node)
Exemplo n.º 12
0
 def relationships(self, wid):
   """returns { word_self:count, word_related:count, word_related:count ... }"""
   node = self.node_for_word(wid)
   print node.get_properties(), node
Exemplo n.º 13
0
def been_processed(node):
    return node.get_properties().has_key('status')
Exemplo n.º 14
0
def get_nodename(node):
    node = node.get_properties()
    node = node.get('name')
    node = node.encode()
    return str(node)