Reviews

Example 1

Find number of Reviews per star:

SELECT 
  Stars, count(*) as Count 
FROM HasReview 
GROUP BY Stars 
ORDER BY Count DESC

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

Example 2

Find all reviewed Services:

MATCH {class: Services, as: s}-HasReview->{class: Reviews, as: r} 
RETURN $pathelements

In the Graph Editor included in Studio, using the query above, this is the obtained graph:

Example 3

Find all reviewed Services and the Customer who made the review:

MATCH {class: Services, as: s}-HasReview->{class: Reviews, as: r}<-MadeReview-{class: Customers, as: c} 
RETURN $pathelements

In the Graph Editor included in Studio, using the query above, this is the obtained graph:

Example 4

Find the numbers of reviews per Service:

SELECT 
  @rid as Service_RID,
  Name as Service_Name,
  Type as Service_Type,
  out("HasReview").size() AS ReviewNumbers 
FROM `Services` 
ORDER BY ReviewNumbers DESC

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

Example 5

Find the 3 Hotels that have most reviews:

SELECT 
  @rid as Hotel_RID,
  Name as Hotel_Name,
  Type as Hotel_Type,
  out("HasReview").size() AS ReviewNumbers 
FROM `Hotels` 
ORDER BY ReviewNumbers DESC 
LIMIT 3

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

In a similar way:

Find the 3 Restaurants that have most reviews:

SELECT
  @rid as Restaurant_RID,
  Name as Restaurants_Name,
  Type as Restaurants_Type,
  out("HasReview").size() AS ReviewNumbers 
FROM `Restaurants` 
ORDER BY ReviewNumbers DESC 
LIMIT 3

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

In a polymorphic way:

Find the 3 Services (Hotels + Restaurants) that have most reviews:

SELECT 
  @rid as Service_RID,
  Name as Service_Name,
  Type as Service_Type,
  out("HasReview").size() AS ReviewNumbers 
FROM `Services` 
ORDER BY ReviewNumbers DESC 
LIMIT 3

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

Example 6

Find the 3 Customers who made more reviews:

SELECT 
  OrderedId as CustomerId,
  out("MadeReview").size() AS ReviewNumbers 
FROM `Customers` 
ORDER BY ReviewNumbers DESC 
LIMIT 3

In the Browse Tab of Studio, using the query above, this is the obtained list of records:

results matching ""

    No results matching ""