Database Reference
In-Depth Information
Figure 11-12. Filtering the current user's content
Listing 11-40. TagImpl
public GraphStory tagsInMyNetwork (GraphStory graphStory) {
try {
graphStory.setTagsInNetwork (Lists.newLinkedList(
mappedContentTagRepository.tagsInNetwork (graphStory.getUser().getNodeId())));
graphStory.setUserTags (Lists.newLinkedList(
mappedContentTagRepository.userTags (graphStory.getUser().getNodeId())));
}
catch (Exception e) {
log.error(e);
}
return graphStory;
}
The tagsInMyNetwork method uses two methods inside MappedContentTagRepository , which is shown in
Listing 11-41. The tagsInNetwork finds users being followed, accesses all of their content, finds connected tags
through the HAS relationship type. Finally, the method returns an Iterable of MappedContentTag .
The userTags method is similar but is concerned only with content and, subsequently, tags connected to the
current user. Both methods limit the results to 30 items.
Listing 11-41. MappedContentTagRepository
public interface MappedContentTagRepository extends GraphRepository<MappedContentTag> {
@Query("START u=node({nodeId})" +
" MATCH u-[:FOLLOWS]->f " +
" WITH distinct f " +
" MATCH f-[:CURRENTPOST]-lp-[:NEXTPOST*0..]-c " +
Search WWH ::




Custom Search