Database Reference
In-Depth Information
.Return(() => Return.As<MappedProductUserTag>("{ title: p.title , " +
"users: collect(u.username), tags: collect(distinct t.wordPhrase) }"))
.Results.ToList();
}else{
mappedProductUserTags = _graphClient.Cypher
.Match(" (p:Product)-[:HAS]->(t)<-[:USES]-(u:User) ")
.Return(() => Return.As<MappedProductUserTag>("{ title: p.title , " +
"users: collect(u.username), tags: collect(distinct t.wordPhrase) }"))
.Results.ToList();
}
return mappedProductUserTags;
}
Either query will return a list of MappedProductUserTag ViewModel objects, as shown in Listing 7-44.
Listing 7-44. The View Mode Object— MappedProductUserTag
public class MappedProductUserTag
{
public string title {get; set;}
public List<string> users { get; set; }
public List<string> tags { get; set; }
}
Location Graph Model
This section explores the location graph model and a few of the operations that typically accompany it. In particular, it
looks at the following:
The spatial plugin
Filtering on location
Products based on location
The example will demonstrate how to add a console to enable you to connect products to locations in an ad hoc
manner.
Location Entity
The Location entity provides a way to store geopoints for stores and each of the stores have various products in stock
(Listing 7-45). Because the Location entity does not require any START-based queries, the NodeReference is excluded
as a property.
Listing 7-45. The Location Object
public class Location
{
public long nodeId { get; set; }
public string locationId {get;set;}
public string name { get; set; }
public string address { get; set; }
 
Search WWH ::




Custom Search