Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 9
0
def addContactToUser(currentUser, newContact) :
    currentUser = __getUserByEmail(currentUser)
    newContact = __getUserByEmail(newContact)
    getGraph().create((currentUser, "IS_FRIEND_OF", newContact))
Ejemplo n.º 10
0
def deleteOneConcern(id):
    concern = getGraph().node(id)
    print(concern[0])
Ejemplo n.º 11
0
def getConcernsIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Concerns")
Ejemplo n.º 12
0
def __getCommunityIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Communities")
Ejemplo n.º 13
0
def __newCommunity(community):
    name = community.get('name')
    newCommunity = getGraph().create({"name" : name, "description" : community.get('description')})
    __addToCommunityIndex(name, newCommunity)
Ejemplo n.º 14
0
def addContactToUser(currentUser, newContact):
    currentUser = __getUserByEmail(currentUser)
    newContact = __getUserByEmail(newContact)
    getGraph().create((currentUser, "IS_FRIEND_OF", newContact))
Ejemplo n.º 15
0
def addCommunityToContact(name, email):
    userFound = __getUserByEmail(email)
    communityFound = __getCommunity(name)
    getGraph().create((userFound, "BELONGS_TO", communityFound))
Ejemplo n.º 16
0
def __addToUsersIndex(email, newUser) :
     getGraph().get_or_create_index(neo4j.Node, "Users").add("email", email, newUser)
Ejemplo n.º 17
0
def __addToUsersIndex(email, newUser):
    getGraph().get_or_create_index(neo4j.Node,
                                   "Users").add("email", email, newUser)
Ejemplo n.º 18
0
def __getUsersIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Users")
Ejemplo n.º 19
0
def __getUsersIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Users")
Ejemplo n.º 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)
Ejemplo n.º 21
0
def getConcernsIndex():
    return getGraph().get_or_create_index(neo4j.Node, "Concerns")
Ejemplo n.º 22
0
def deleteOneConcern(id):
    concern = getGraph().node(id)
    print (concern[0])