Graphics Reference
In-Depth Information
rating =
graph.makeKey( 'rating' ).dataType(Integer. class ).make()
helpful =
graph.makeKey( 'helpful' ).dataType(Integer. class ).make()
specificity =
graph.makeKey( 'specificity' ).dataType(Float. class ).make()
Finally, declare the links themselves as labels, associating them with the
keys you just made. Products are linked if they are similar , and linked
to customers through review . Categories are linked to parent categories,
and from products by categorization . Commit the graph when all the
keys and labels have been defined.
graph.makeLabel( 'similar' ).make()
graph.makeLabel( 'review' ).sortKey(date).sortOrder(Order. DESC )
.signature(votes, rating, helpful).make()
graph.makeLabel( 'parent' ).manyToOne().make()
graph.makeLabel( 'categorization' ).sortKey(specificity).make()
graph.commit()
Now that you have defined properties of nodes and links, the database can
be populated from the GraphML file. Add the following final lines to the
script, save it, and exit.
reader = new GraphMLReader(graph)
reader.inputGraph( 'productdb.graphml' )
The script is now ready to be executed in a command-line shell from the
directory where you installed Titan. If you have a 64-bit operating system
and the memory available, it's a good idea to make use of the
JAVA_OPTIONS environment variable to grant more to the import process
you're about to run. Setting the options and running the script will look
something like this, depending on your operating system and location of the
files. Be prepared for it to take some time.
Search WWH ::




Custom Search