James Bond¶
Throughout the James Bond series of films and novels, Q Branch has given Bond a variety of vehicles with which to battle his enemies. Among the most noteworthy gadgets, Bond has been equipped with various vehicles that have numerous modifications to include elaborate weapons and anti-pursuit systems, alternative transportation modes, and various other functions.
One car in particular that has been linked to Mr. Bond’s collection is the Aston Martin DB5.

Creating the graph¶
This time no need to download the data-points from a csv-file.
The data can be copied
and pasted into
your Neo4j-browser.
Question 1¶
Now you got the graph database, populated with nodes, relationships, properties etc. You’d like to see an overview of how the whole database is connected, each relationship to each node, properties of a node etc. How can you describe the graph structure ?
Answer:
CALl db.schema.visualization()
which results in :

This is all about cars , bond girls, actors and directors.
Question 2¶
There are 3 node-types : People, Film and Vehicle. Can you find using cypher what the properties of these different node types is ?
Answer (for the Film node):
MATCH (n:Film)
UNWIND keys(n) as property
RETURN DISTINCT(property)
Question 3¶
Can you do the same for the relationships ?
Answer :
match ()-[r]-()
RETURN DISTINCT TYPE(r)
Question 4¶
Make a list of the top 5 James Bond movies based on their sales figures (box office) ?
Answer :
MATCH (a:Film) WITH a ORDER BY a.Box DESC
RETURN a.Name AS Name, a.Year AS Year, a.Box AS BoxOffice LIMIT 5
Question 5¶
Make a top-3 list of the actors that acted most in Bond movies taking the role of James Bond.
Answer :
MATCH (p:People)-[:AS_BOND_IN]->(m:Film)
RETURN p.Name AS Actor, count(p.Name) AS Nbr ORDER BY Nbr DESC LIMIT 3
Question 6¶
A Bond movie also involves the appearance of a co-star a.k.a “Bond Girl”. Which actress(es) have acted in more than one Bond movie ? List also the name of the movie, its year.
Answer :
MATCH (p:People)-[:IS_BOND_GIRL_IN]->(m:Film)
WITH p.Name as name , count(m) as nbr
MATCH (p:People {Name:name})-[:IS_BOND_GIRL_IN]->(m:Film)
WHERE nbr >1
RETURN name as Name,p.Role as Role,m.Name as Title , m.Year as Year
Question 7¶
Make a list of the different car brands used in the movies. As a result, list movies for each of the cars. Order the output by usage.
Answer :
MATCH (m:Film)-[:HAS_VEHICLE]->(v:Vehicle)
RETURN DISTINCT v.Brand AS Brand, count(v.Model) AS Models, collect(DISTINCT m.Name) AS Movies
ORDER BY count(v.Model) DESC
Question 7¶
Make a list of the Directors that have directed a James Bond movie more than once.
Answer :
MATCH (d:People)-[r:DIRECTOR_OF]->(f:Film)
WITH d.Name AS Director, count(r) AS Times
WHERE Times>1
RETURN Director , Times ORDER BY Times Desc
Last change: Oct 30, 2023