diff --git a/cypher/src/docs/dev/ql/cookbook/graphity.txt b/cypher/src/docs/dev/ql/cookbook/graphity.txt new file mode 100644 index 000000000..682913260 --- /dev/null +++ b/cypher/src/docs/dev/ql/cookbook/graphity.txt @@ -0,0 +1,9 @@ +[[cypher-cookbook-graphity]] +== The Graphity activity stream model == + +:leveloffset: 2 + +include::find-activity-streams-in-a-network-without-scaling-penalty.txt[] + +include::cypher-graphity-graph.txt[] + diff --git a/cypher/src/docs/dev/ql/cookbook/index.txt b/cypher/src/docs/dev/ql/cookbook/index.txt index 147fd7800..6f208d1b0 100644 --- a/cypher/src/docs/dev/ql/cookbook/index.txt +++ b/cypher/src/docs/dev/ql/cookbook/index.txt @@ -53,5 +53,9 @@ include::similarity-complex.txt[] :leveloffset: 1 +include::graphity.txt[] + +:leveloffset: 1 + //include::activity-streams.txt[] diff --git a/cypher/src/test/scala/org/neo4j/cypher/docgen/cookbook/GraphityTest.scala b/cypher/src/test/scala/org/neo4j/cypher/docgen/cookbook/GraphityTest.scala index af521fbe4..d74c8f828 100644 --- a/cypher/src/test/scala/org/neo4j/cypher/docgen/cookbook/GraphityTest.scala +++ b/cypher/src/test/scala/org/neo4j/cypher/docgen/cookbook/GraphityTest.scala @@ -41,12 +41,18 @@ class GraphityTest extends DocumentingTestBase { def section = "cookbook" - @Test def peopleSimilarityTags() { + @Test def findActivityStreams() { testQuery( title = "Find Activity Streams in a network without scaling penalty", - text = """This is an approach put forward by Rene Pickard as http://www.rene-pickhardt.de/graphity-an-efficient-graph-model-for-retrieving-the-top-k-news-feeds-for-users-in-social-networks/[Graphity]. - In short, a linked list is created for every persons friends in the order that the last activities of these friends have occured. - To find the activity stream for a person, the friend just follow the linked list of the friend list, and retrieve the needed amount of activities form the respective activity list of the friends.""", + text = """This is an approach for scaling the retrieval of activity streams in a friend graph put forward by Rene Pickard as http://www.rene-pickhardt.de/graphity-an-efficient-graph-model-for-retrieving-the-top-k-news-feeds-for-users-in-social-networks/[Graphity]. + In short, a linked list is created for every persons friends in the order that the last activities of these friends have occured. When new activities occur for a friend, all the ordered friend lists that this friend is part of are reordered, + transfering computing load to the time of new event updates instead of activity stream reads. + +[TIP] + This approach of course makes excessive use of relationship types. Right now now the maximum amount of relationship types in Neo4j is 65.000 which needs + to be taken into consideration when designing a production system with this approach. + + To find the activity stream for a person, just follow the linked list of the friend list, and retrieve the needed amount of activities form the respective activity list of the friends.""", queryText = "START me=node:node_auto_index(name = \"Jane\") " + "MATCH p=me-[:jane_knows*]->friend, " + "friend-[:has]->status " +