University of Massachusetts Lowell Cypher Code Query Project
Task 1: Adding or Updating a Movie
Suppose we do not know if we have the movie Rocketman in our graph. If it is not in the graph, we want to set the createdAt property with the value of datetime(). The datetime() function returns the current date and time. If it is in the graph, we want to set the matchedAt property with the value of datetime(). In either case, we want to set the updatedAt property with the value of datetime().
Modify the Cypher code to use MERGE processing for the Movie node with the title Rocketman:
If the node already exists (
ON MATCH
SET clause):
Set the matchedAt property for the node referenced by m to datetime().
If the node does not exist (
ON CREATE
SET clause):
Set the createdAt property to datetime().
For either case:
Set the updatedAt property to datetime().
Execute your code twice to ensure that the the MERGE processing occurs. That is, the newly created node will have a createdAt property and the updated node will have a matchedAt property. In both cases, the node will have the updatedAt property set
THE QUERY NEEDS TO LOOK LIKE THIS IN Neo4J
MERGE (m:Movie {title: ‘Rocketman’})
// perform the ON MATCH setting of the matchedAt property
// perform the ON CREATE setting of the createdAt property
// set the updatedAt property
RETURN m
I actually have the query below! But there is some issue with the node. Please help me fix it!
MERGE (m:Movie {title: ‘Rocketman’})ON MATCH
SET m.matchedAT = datetime(),
m.updatedAt = datetime()
ON CREATE
SET m.createdAt = datetime(),
m.updatedAt = datetime()
RETURN m.title, m.createdAt,m.matchedAt, m.updatedAt
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Enjoy the free features we offer to everyone
-
Title page
Get a free title page formatted according to the specifics of your particular style.
-
Custom formatting
Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.
-
Bibliography page
Don’t pay extra for a list of references that perfectly fits your academic needs.
-
24/7 support assistance
Ask us a question anytime you need to—we don’t charge extra for supporting you!
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics