Graphics Reference
In-Depth Information
Reviewthelistagain,andnoticethattheDVDisnolongerincluded.So,how
many topics are left in the list? You could count them yourself, or just ask
Gremlin to do it, as shown here:
gremlin>
g.V('group','Book').has('title',CONTAINS,'Graph').count()
==>39
Sofar,the querieshave focused on narrowing down a list of topics,which are
represented in the graph as vertices. The list now has 39 topics in it, many
of which seem to be mathematical in nature. To narrow down the list even
further, you can add another criterion to look for “Visualization” in the title.
However,you may also want to see what there views are like for those topics.
Reviews, if you recall, are represented as edges pointing from the reviewer
to the product. The following query looks for topics on graph visualization
and outputs the rating of incoming review edges:
gremlin>
g.V('group','Book').has('title',CONTAINS,'Graph').has('title',
CONTAINS,'Visualization').inE('review').rating
==>1
==>4
==>3
==>5
The output of the query is a list of review ratings. A list of titles with reviews
would be more useful. You can use the transform step to output multiple
fields for each result, and before doing so, you can use an order step to
sort them in order of most helpful to least helpful. Note that you must call
next() on inV , the vertex with the link incoming, because any traversable
property will return a pipeline rather than the object itself.
gremlin>
g.V('group','Book').has('title',CONTAINS,'Graph').has('title',
CONTAINS,'Visualization').inE('review').order{it.b.helpful
<=>
it.a.helpful}.transform{[it.inV.next().title,
it.rating,
Search WWH ::




Custom Search