Database Reference
In-Depth Information
Figure 5-5. Final set of NEXT status updates
If any of the unique constraints were necessary only for the purposes of the import, then you could run a
command such as DROP CONSTRAINT ON (s:Status) ASSERT s.statusId IS UNIQUE to remove the constraint.
finally, you could also run MATCH (s) WHERE s:Status REMOVE s.statusId to remove the property from the node.
In this application, we'd likely keep them, because they could be used for quick lookups.
Tip
Adding User Favorites
The last step in the process is loading a CSV that contains a list of the userIds and statusIds that denote a “favorite”
status update. In the concept application being created, the “favorite” feature allows users to favorite their own status
updates as well as others within the network. Listing 5-13 shows the LOAD CSV command that will create the favorites
per User.
Listing 5-13. Adding Favorite Status Updates
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM " http://www.graphstory.com/practicalneo4j-book/code/chapter5/csv/
favorite.csv " AS csvLine
MATCH (u1:User { userId: toInt(csvLine.userId)} ),(s1:Status { statusId: toInt(csvLine.statusId)} )
CREATE (u1)-[:FAVORITE]->(s1)
After running the LOAD CSV command for favorites, run MATCH (a)-[:`FAVORITE`]->(b) RETURN a,b LIMIT 5
to see a small sample. The result should look like the one in Figure 5-6 .
 
 
Search WWH ::




Custom Search