Graphics Reference
In-Depth Information
Next begin to define the schema for product nodes. Make a key that will
be used to distinguish all nodes by type, followed by keys for the specific
properties of products. When defining the productno key, add an index for
fastlookupbyproductnumber. Addanindex to title aswell,butthistime
use the Lucene index declared earlier in the properties file.
graph.makeKey( 'type' ).dataType(String. class ).make()
graph.makeKey( 'productno' ).dataType(String. class )
.indexed(Vertex. class ).unique().make()
graph.makeKey( 'title' ).dataType(String. class )
.indexed( 'search' , Vertex. class ).make()
graph.makeKey( 'salesrank' ).dataType(Integer. class ).make()
graph.makeKey( 'group' ).dataType(String. class ).make()
graph.makeKey( 'status' ).dataType(String. class ).make()
graph.makeKey( 'reviews' ).dataType(Integer. class ).make()
graph.makeKey( 'avgrating' ).dataType(Float. class ).make()
Now that the keys for products are defined, specify the keys for customer
and category nodes. Index all three for fast lookup by exact match.
graph.makeKey( 'customerno' ).dataType(String. class )
.indexed(Vertex. class ).unique().make()
graph.makeKey( 'categoryno' ).dataType(Integer. class )
.indexed(Vertex. class ).unique().make()
graph.makeKey( 'categoryname' ).dataType(String. class )
.indexed(Vertex. class ).make()
Next, define the property keys for links, starting with reviews and
categorizations. Reviews link customers to products, and categorizations
link products to categories. The specificity key is a value from 0 to 1
that reflects how specific the categorization was relative to others in the
category hierarchy for that product.
date =
graph.makeKey( 'date' ).dataType(Long. class ).make()
votes =
graph.makeKey( 'votes' ).dataType(Integer. class ).make()
Search WWH ::




Custom Search