Review the following data and answer the questions about how you would import it into Neo4j.
id |
title |
author |
publication_year |
genre |
rating |
still_in_print |
last_purchased |
19515 |
The Heights |
Anne Conrad |
2012 |
Comedy |
5 |
true |
2023/4/12 8:17:00 |
39913 |
Starship Ghost |
Michael Tyler |
1985 |
Science Fiction|Horror |
4.2 |
false |
2022/01/16 17:15:56 |
60980 |
The Death Proxy |
Tim Brown |
2002 |
Horror |
2.1 |
true |
2023/11/26 8:34:26 |
18793 |
Chocolate Timeline |
Mary R. Robb |
1924 |
Romance |
3.5 |
false |
2022/9/17 14:23:45 |
67162 |
Stories of Three |
Eleanor Link |
2022 |
Romance|Comedy |
2 |
true |
2023/03/12 16:01:23 |
25987 |
Route Down Below |
Tim Brown |
2006 |
Horror |
4.1 |
true |
2023/09/24 15:34:18 |
View the data as CSV
id,title,author,publication_year,genre,rating,still_in_print,last_purchased
19515,The Heights,Anne Conrad,2012,Comedy,5,true,2023/4/12 8:17:00
39913,Starship Ghost,Michael Tyler,1985,Science Fiction|Horror,4.2,false,2022/01/16 17:15:56
60980,The Death Proxy,Tim Brown,2002,Horror,2.1,true,2023/11/26 8:34:26
18793,Chocolate Timeline,Mary R. Robb,1924,Romance,3.5,false,2022/9/17 14:23:45
67162,Stories of Three,Eleanor Link,2022,Romance|Comedy,2,true,2023/03/12 16:01:23
25987,Route Down Below,Tim Brown,2006,Horror,4.1,true,2023/09/24 15:34:18Check Your Understanding
1. What cast function?
What function would you use to cast the id field?
-
✓
toInteger() -
❏
toLong() -
❏
int() -
❏
set()
Hint
The id field is a string and should be cast to an integer number.
Solution
The toInteger() function casts strings to an integer data type.
2. What data type?
What data type would you use for the last_purchased field?
-
❏
String -
❏
Float -
❏
Date -
✓
DateTime
Hint
The last_purchased field holds when the item was last purchased.
Solution
The last_purchased field should be cast as a DateTime because it holds a date and a time.
3. Setting additional labels
Complete the following Cypher statement to set an InPrint label to all nodes that have a still_in_print property value of true.
MATCH (n)
WHERE n.still_in_print = true
/*select:SET n:InPrint*/-
✓
SET n:InPrint -
❏
SET label = InPrint -
❏
n.InPrint = true -
❏
LABEL InPrint
Hint
The syntax to set a label on a node is SET x:Label.
Solution
You should use SET n:InPrint to set the InPrint label on the node.
4. Multi-value property?
Which field in the data should be split into a multi-value property?
-
❏
rating -
✓
genre -
❏
still_in_print -
❏
last_purchased
Hint
A multi-value property holds more than one value as a list.
Solution
The genre field can contain multiple values, so it should be a multi-value property.
Summary
In this quiz you checked your understanding of data types, setting labels and multi-value properties.