program讲解 、辅导 Python/Java程序语言
Graph databases [30 marks]
Consider a simple application where walking treks are cycles (it ends where it starts) made up
of sections between two huts, each offering a number #beds of beds and, potentially, showers.
The sections have a distance in kilometers, and treks have a name and location.
Fig. 1. Property Graph
Questions:
1. Write down the formal property graph model (V, E, η, λ, ν) for the property graph in
Figure 1. [6 marks]
2. Write the following English language query in regular property graph logic:
Return the trek nodes that have 2 or 3 sections. [4 marks]
3. Write the following English language query in regular property graph logic:
Find all pairs of hut nodes, each having showers and at least 15 beds, and directly connected by a section. [4 marks]
4. Write the following English language query in regular property graph logic:
Return all trek nodes that have some section, each at most 25kms long and only connecting
huts with showers available. [4 marks]
5. Write down the queries from Questions 2, 3, and 4 in regular property graph algebra.
[12 marks]
2