コード例 #1
0
ファイル: event.py プロジェクト: hoanuchiha98/Graph_Database
def update_event(events, key):
    event = NodeObject("Event")
    event.name = key
    event.full_name = events.get("full_name")
    print(event.full_name)
    event.image = events.get("image")
    event.object_id = events.get("object_id")
    event.weight = events.get("weight")
    type1 = events.get("type")
    event.location = events.get("location")
    event.keywords = events.get("keywords")
    # print(event.keywords)
    graph = neo4j_connect()
    graph.nodes.match("Event")
    graph.merge(event)
    graph.push(event)
    graph.run(
        "MATCH(n:Event)-[r]->(p:Event_Category) detach delete r, p return p")
    if type1 not in ('', None):
        transaction = graph.begin()
        event_type = Node("event_category", name=type1)
        event_type.__primarylabel__ = "Event_Category"
        event_type.__primarykey__ = type1
        transaction.create(event_type)
        rels_event = Relationship(event.__node__, "BELONG TYPE OF EVENT",
                                  event_type)
        transaction.create(rels_event)
        transaction.commit()
        transaction.finished()

    return event.__node__
コード例 #2
0
ファイル: party.py プロジェクト: hoanuchiha98/Graph_Database
def create_party(partys):
    party = NodeObject("Party")
    party.name = partys.get('name')
    print(party.name)
    party.full_name = partys.get("full_name")
    print(party.full_name)
    party.image = partys.get("image")
    party.object_id = partys.get("object_id")
    party.weight = partys.get("weight")
    party.keywords = party.get("keywords")
    # print(party.keywords)
    graph = neo4j_connect()
    graph.create(party)
    graph.push(party)
    return party.__node__
コード例 #3
0
ファイル: person.py プロジェクト: hoanuchiha98/Graph_Database
def create_person(persons):
    person = NodeObject("Person")
    person.name = persons.get('name')
    print(person.name)
    person.full_name = persons.get("full_name")
    print(person.full_name)
    person.image = persons.get("image")
    person.object_id = persons.get("object_id")
    person.weight = persons.get("weight")
    person.type = persons.get("type")
    person.keywords = persons.get("keywords")
    # print(person.keywords)
    graph = neo4j_connect()
    graph.create(person)
    graph.push(person)
    return person.__node__
コード例 #4
0
def create_personel_group(personel_groups):
    personel_group = NodeObject("Personel_Group")
    personel_group.name = personel_groups.get('name')
    print(personel_group.name)
    personel_group.full_name = personel_groups.get("full_name")
    print(personel_group.full_name)
    personel_group.image = personel_groups.get("image")
    personel_group.object_id = personel_groups.get("object_id")
    personel_group.weight = personel_groups.get("weight")
    personel_group.keywords = personel_groups.get("keywords")
    # print(personel_group.keywords)
    graph = neo4j_connect()
    graph.create(personel_group)
    graph.push(personel_group)
    return personel_group.__node__
コード例 #5
0
def create_country(countrys):
    country = NodeObject("Country")
    country.name = countrys.get('name')
    print(country.name)
    country.full_name = countrys.get("full_name")
    print(country.full_name)
    country.image = countrys.get("image")
    country.object_id = countrys.get("object_id")
    country.weight = countrys.get("weight")
    country.keywords = countrys.get("keywords")
    print(countrys.get("keywords"))
    graph = neo4j_connect()
    graph.create(country)
    graph.push(country)
    return country.__node__
コード例 #6
0
def update_country(countrys, key):
    country = NodeObject("Country")
    country.name = key
    print(country.name)
    country.full_name = countrys.get("full_name")
    print(country.full_name)
    country.image = countrys.get("image")
    country.object_id = countrys.get("object_id")
    country.weight = countrys.get("weight")
    country.keywords = countrys.get("keywords")
    graph = neo4j_connect()
    graph.nodes.match("Country")
    graph.merge(country)
    graph.push(country)
    return country.__node__
コード例 #7
0
def create_internaltional_group(internaltional_groups):
    internaltional_group = NodeObject("Internaltional_Group")
    internaltional_group.name = internaltional_groups.get('name')
    print(internaltional_group.name)
    internaltional_group.full_name = internaltional_groups.get("full_name")
    print(internaltional_group.full_name)
    internaltional_group.image = internaltional_groups.get("image")
    internaltional_group.object_id = internaltional_groups.get("object_id")
    internaltional_group.weight = internaltional_groups.get("weight")
    internaltional_group.keywords = internaltional_groups.get("keywords")
    # print(internaltional_group.keywords)
    graph = neo4j_connect()
    graph.create(internaltional_group)
    graph.push(internaltional_group)
    return internaltional_group.__node__
コード例 #8
0
def create_continent(continents):
    continent = NodeObject("Continent")
    continent.name = continents.get('name')
    print(continent.name)
    continent.full_name = continents.get("full_name")
    print(continent.full_name)
    continent.image = continents.get("image")
    continent.object_id = continents.get("object_id")
    continent.weight = continents.get("weight")
    continent.keywords = continents.get("keywords")
    # print(continent.keywords)
    graph = neo4j_connect()
    graph.create(continent)
    graph.push(continent)
    return continent.__node__
コード例 #9
0
def update_continent(continents, key):
    continent = NodeObject("Continent")
    continent.name = key
    print(continent.name)
    continent.full_name = continents.get("full_name")
    print(continent.full_name)
    continent.image = continents.get("image")
    continent.object_id = continents.get("object_id")
    continent.weight = continents.get("weight")
    continent.keywords = continents.get("keywords")
    graph = neo4j_connect()
    graph.nodes.match("Continent")
    graph.merge(continent)
    graph.push(continent)
    return continent.__node__
コード例 #10
0
def update_personel_group(personel_groups, key):
    personel_group = NodeObject("Personel_Group")
    personel_group.name = key
    print(personel_group.name)
    personel_group.full_name = personel_groups.get("full_name")
    print(personel_group.full_name)
    personel_group.image = personel_groups.get("image")
    personel_group.object_id = personel_groups.get("object_id")
    personel_group.weight = personel_groups.get("weight")
    personel_group.keywords = personel_groups.get("keywords")
    # print(personel_group.keywords)
    graph = neo4j_connect()
    graph.nodes.match("Personel_Group")
    graph.merge(personel_group)
    graph.push(personel_group)
    return personel_group.__node__
コード例 #11
0
ファイル: party.py プロジェクト: hoanuchiha98/Graph_Database
def update_party(partys, key):
    party = NodeObject("Party")
    party.name = key
    print(party.name)
    party.full_name = partys.get("full_name")
    print(party.full_name)
    party.image = partys.get("image")
    party.object_id = partys.get("object_id")
    party.weight = partys.get("weight")
    party.keywords = partys.get("keywords")
    # print(party.keywords)
    graph = neo4j_connect()
    graph.nodes.match("Party")
    graph.merge(party)
    graph.push(party)
    return party.__node__
コード例 #12
0
def update_internaltional_group(internaltional_groups, key):
    internaltional_group = NodeObject("Internaltional_Group")
    internaltional_group.name = key
    print(internaltional_group.name)
    internaltional_group.full_name = internaltional_groups.get("full_name")
    print(internaltional_group.full_name)
    internaltional_group.image = internaltional_groups.get("image")
    internaltional_group.object_id = internaltional_groups.get("object_id")
    internaltional_group.weight = internaltional_groups.get("weight")
    internaltional_group.keywords = internaltional_groups.get("keywords")
    # print(internaltional_group.keywords)
    graph = neo4j_connect()
    graph.nodes.match("Internaltional_Group")
    graph.merge(internaltional_group)
    graph.push(internaltional_group)
    return internaltional_group.__node__