Database Reference
In-Depth Information
Next, the query will ask if the status update is somewhere the middle of the list, which is performed by
determining if the status update has incoming and outgoing NEXTPOST relationships. If the pattern is matched, then
connect the before and after status updates via NEXTPOST .
Regardless of the status update's location in the linked list, retrieve it and its relationships and then delete the
node along with all of its relationships.
To recap, if one of the relationship patterns matches, replace that pattern with the nodes on either side of the status
update in question. Once that has been performed, the node and its relationships can be removed from the graph.
Listing 8-33. Deleting a Status Update
// remove a status update
public static function deleteContent($username, $contentId) {
$queryString = " MATCH (u:User { username: {u} }), (c:Content { contentId: {contentId} }) " .
" WITH u,c " .
" MATCH (u)-[:CURRENTPOST]->(c)-[:NEXTPOST]->(nextPost) " .
" WHERE nextPost is not null " .
" CREATE UNIQUE (u)-[:CURRENTPOST]->(nextPost) " .
" WITH count(nextPost) as cnt " .
" MATCH (before)-[:NEXTPOST]->(c:Content { contentId: {contentId}})-[:NEXTPOST]->(after) " .
" WHERE before is not null AND after is not null " .
" CREATE UNIQUE (before)-[:NEXTPOST]->(after) " .
" WITH count(before) as cnt " .
" MATCH (c:Content { contentId: {contentId} })-[r]-() " .
" DELETE c, r";
$query = new Everyman\Neo4j\Cypher\Query(Neo4Client::client(), $queryString, array(
'u' => $username,
'contentId' => $contentId
));
$query->getResultSet();
}
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)
 
Search WWH ::




Custom Search