Database Reference
In-Depth Information
Interest Graph Model
This section looks at the interest graph and examines some basic ways it can be used to explicitly define a degree of
interest. The following topics are covered:
Adding filters for owned content
Adding filters for connected content
Analyzing connected content (count tags)
Interest in Aggregate
Inside the interest route of graphstory.py, we retrieve all of the user's tags and their friends' tags by calling,
respectively, the user_tags and tags__in_network methods found in the Tag class. This is displayed in Figure 9-12 in
the left-hand column.
Figure 9-12. Filtering the current user's content
The display code is located in {PROJECTROOT}/app/views/graphs/interest/index.html . The interest route
also uses two additional methods, which are shown in Listings 9-33 and 9-34. The get_following_content_with_tag
finds users being followed, accesses all of their content, and finds connected tags through the HAS relationship type.
The get_user_content_with_tag method is similar but is concerned only with content and, subsequently, tags
connected to the current user. As mentioned earlier, the methods return an array of content and tags, which supports
an autosuggest plugin in the view and requires both a label and name to be provided in order to execute. This
autosuggest feature is used in the status update form as well as some search forms found later in this chapter.
Listing 9-32. The interest Route
# show tags within the user's network (theirs and those being followed)
@route('/interest')
def interest():
# get the user's tags
userTags = Tag().user_tags(graph_db, request.get_cookie(graphstoryUserAuthKey))
 
Search WWH ::




Custom Search