private Set<String> getIndexKeys(Class<? extends Element> titanClass) { return getGraph().getIndexedKeys(titanClass); }
private void createTripleIndices(final String tripleIndexes, TitanGraph titanGraph) { if (null == tripleIndexes) { throw new IllegalArgumentException("index list, if supplied, must be non-null"); } Set<String> u = new HashSet<String>(); String[] a = tripleIndexes.split(","); for (String s : a) { String pattern = s.trim(); if (pattern.length() > 0) { u.add(pattern); } } for (String key : u) { if (!titanGraph.getIndexedKeys(Edge.class).contains(key)) { titanGraph.createKeyIndex(key, Edge.class); } } }
private void createTripleIndices(final String tripleIndexes, TitanGraph titanGraph) { if (null == tripleIndexes) { throw new IllegalArgumentException("index list, if supplied, must be non-null"); } Set<String> u = new HashSet<String>(); String[] a = tripleIndexes.split(","); for (String s : a) { String pattern = s.trim(); if (pattern.length() > 0) { u.add(pattern); } } for (String key : u) { if (!titanGraph.getIndexedKeys(Edge.class).contains(key)) { titanGraph.createKeyIndex(key, Edge.class); } } }
/** * Initialise the handler using the graph passed as arguments. * * @param graph */ public TitanRDFHandler(TitanGraph graph, String indexes) { this.graph = new BatchGraph(graph); if (!graph.getIndexedKeys(Vertex.class).contains(VALUE)) { graph.createKeyIndex(VALUE, Vertex.class); } createTripleIndices(indexes, graph); namespaces = graph.addVertex(NAMESPACES_VERTEX_ID); }
/** * Initialise the handler using the graph passed as arguments. * * @param graph */ public TitanRDFHandler(TitanGraph graph, String indexes) { this.graph = new BatchGraph(graph); if (!graph.getIndexedKeys(Vertex.class).contains(VALUE)) { graph.createKeyIndex(VALUE, Vertex.class); } createTripleIndices(indexes, graph); namespaces = graph.addVertex(NAMESPACES_VERTEX_ID); }
private void createSchema() { final TitanManagement mgmt = titanGraph.getManagementSystem(); if (!titanGraph.getIndexedKeys(Vertex.class).contains(NODE_ID)) { final PropertyKey key = mgmt.makePropertyKey(NODE_ID).dataType(Integer.class).make(); mgmt.buildIndex(NODE_ID, Vertex.class).addKey(key).unique().buildCompositeIndex(); } if (!titanGraph.getIndexedKeys(Vertex.class).contains(COMMUNITY)) { final PropertyKey key = mgmt.makePropertyKey(COMMUNITY).dataType(Integer.class).make(); mgmt.buildIndex(COMMUNITY, Vertex.class).addKey(key).buildCompositeIndex(); } if (!titanGraph.getIndexedKeys(Vertex.class).contains(NODE_COMMUNITY)) { final PropertyKey key = mgmt.makePropertyKey(NODE_COMMUNITY).dataType(Integer.class).make(); mgmt.buildIndex(NODE_COMMUNITY, Vertex.class).addKey(key).buildCompositeIndex(); } if (mgmt.getEdgeLabel(SIMILAR) == null) { mgmt.makeEdgeLabel(SIMILAR).multiplicity(Multiplicity.MULTI).directed().make(); } mgmt.commit(); }