Пример #1
0
def addConcernToUser(current, concern):
    title = concern.get('title')
    description = concern.get('description')
    user = __getUserByEmail(current)
    newConcern, = getGraph().create({"title" : title, "description" : description})
    __addConcernToIndex(title, newConcern)
    getGraph().create((user, "CREATES", newConcern))
Пример #2
0
def addConcernToUser(current, concern):
    title = concern.get('title')
    description = concern.get('description')
    user = __getUserByEmail(current)
    newConcern, = getGraph().create({
        "title": title,
        "description": description
    })
    __addConcernToIndex(title, newConcern)
    getGraph().create((user, "CREATES", newConcern))
Пример #3
0
def getContacts(email) :
    currentUser = __getUserByEmail(email)
    rels = list(getGraph().match(start_node=currentUser, rel_type="IS_FRIEND_OF"))
    contacts = []
    for rel in rels:
        contacts.append(rel.end_node.get_properties())
        #print getGraph().node(rel.end_node)
    return contacts
Пример #4
0
def getCommunities(email):
    currentUser = __getUserByEmail(email)
    rels = list(getGraph().match(start_node=currentUser, rel_type="BELONGS_TO"))
    communities = []
    for rel in rels:
        communities.append(rel.end_node.get_properties())
        #print (getGraph().node(rel.end_node))
    return communities
Пример #5
0
def getContacts(email):
    currentUser = __getUserByEmail(email)
    rels = list(getGraph().match(start_node=currentUser,
                                 rel_type="IS_FRIEND_OF"))
    contacts = []
    for rel in rels:
        contacts.append(rel.end_node.get_properties())
        #print (getGraph().node(rel.end_node))
    return contacts
Пример #6
0
def __newUser(userJson):
    email = userJson.get('email')
    newUser, = getGraph().create({
        "name": userJson.get('name'),
        "surname": userJson.get('surname'),
        "email": email,
        "country": userJson.get('country'),
        "city": userJson.get('city')
    })
    __addToUsersIndex(email, newUser)
Пример #7
0
def getAllConcerns(email):
    print ("getAllConcerns")
    currentUser = __getUserByEmail(email)
    rels = list(getGraph().match(start_node=currentUser, rel_type="CREATES"))
    concerns = []
    for rel in rels:
        currentConcern = rel.end_node.get_properties()
        currentConcern["id"] = rel.end_node._id
        concerns.append(currentConcern)
    return concerns
Пример #8
0
def getAllConcerns(email):
    print("getAllConcerns")
    currentUser = __getUserByEmail(email)
    rels = list(getGraph().match(start_node=currentUser, rel_type="CREATES"))
    concerns = []
    for rel in rels:
        currentConcern = rel.end_node.get_properties()
        currentConcern["id"] = rel.end_node._id
        concerns.append(currentConcern)
    return concerns
Пример #9
0
def addContactToUser(currentUser, newContact) :
    currentUser = __getUserByEmail(currentUser)
    newContact = __getUserByEmail(newContact)
    getGraph().create((currentUser, "IS_FRIEND_OF", newContact))
Пример #10
0
def deleteOneConcern(id):
    concern = getGraph().node(id)
    print(concern[0])
Пример #11
0
def getConcernsIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Concerns")
Пример #12
0
def __getCommunityIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Communities")
Пример #13
0
def __newCommunity(community):
    name = community.get('name')
    newCommunity = getGraph().create({"name" : name, "description" : community.get('description')})
    __addToCommunityIndex(name, newCommunity)
Пример #14
0
def addContactToUser(currentUser, newContact):
    currentUser = __getUserByEmail(currentUser)
    newContact = __getUserByEmail(newContact)
    getGraph().create((currentUser, "IS_FRIEND_OF", newContact))
Пример #15
0
def addCommunityToContact(name, email):
    userFound = __getUserByEmail(email)
    communityFound = __getCommunity(name)
    getGraph().create((userFound, "BELONGS_TO", communityFound))
Пример #16
0
def __addToUsersIndex(email, newUser) :
     getGraph().get_or_create_index(neo4j.Node, "Users").add("email", email, newUser)
Пример #17
0
def __addToUsersIndex(email, newUser):
    getGraph().get_or_create_index(neo4j.Node,
                                   "Users").add("email", email, newUser)
Пример #18
0
def __getUsersIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Users")
Пример #19
0
def __getUsersIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Users")
Пример #20
0
def __newUser(userJson):
    email = userJson.get('email')
    newUser, = getGraph().create({"name" : userJson.get('name'), "surname" : userJson.get('surname'), "email" : email, "country" : userJson.get('country'), "city" : userJson.get('city')})
    __addToUsersIndex(email, newUser)
Пример #21
0
def getConcernsIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Concerns")
Пример #22
0
def deleteOneConcern(id):
    concern = getGraph().node(id)
    print (concern[0])