Skip to content

Instantly share code, notes, and snippets.

BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("graph.unique-instance-id", UUID.randomUUID().toString());
conf.setProperty("schema.default", "none");
conf.setProperty("gremlin.newInstance", "com.thinkaurelius.titan.core.TitanFactory");
conf.setProperty("ids.block-size", 100);
conf.setProperty("storage.setup-wait", 60000);
GraphTraversalSource traversal = titanGraph.traversal();
long startSimilarQuery = System.currentTimeMillis();
List<Vertex> similars = traversal.V()
.has(USER_LABEL, USER_ID_PROPERTY, userId)
.outE(SIMILAR_RELATIONSHIP)
.order()
.by(new Comparator<Edge>() {
@Override
public int compare(Edge o1, Edge o2) {
graph.tx().rollback();
TitanManagement titanManagement = graph.openManagement();
titanManagement.makeVertexLabel(USER_LABEL).make();
titanManagement.makeEdgeLabel(LIKE_RELATIONSHIP).multiplicity(Multiplicity.MULTI).make();
titanManagement.makeEdgeLabel(DISLIKE_RELATIONSHIP).multiplicity(Multiplicity.MULTI).make();
titanManagement.makeEdgeLabel(BLOCK_RELATIONSHIP).multiplicity(Multiplicity.MULTI).make();
titanManagement.makeEdgeLabel(MATCH_RELATIONSHIP).multiplicity(Multiplicity.MULTI).make();
package ru.angrytit;
import com.google.common.collect.Lists;
import com.opencsv.CSVReader;
import com.thinkaurelius.titan.core.TitanGraph;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public TitanGraph graph() {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("storage.batch-loading", true);
conf.setProperty("schema.default", "none");
conf.setProperty("gremlin.graph", "com.thinkaurelius.titan.core.TitanFactory");
conf.setProperty("ids.block-size", 1000000);
conf.setProperty("storage.setup-wait", 60000);