.append( targetTemplateStepName ).append( ": " ).append( targetTemplateStepAttr.getAttributeKey() ); verboseProperties.add( mappingKey ); stepVertex.setProperty( mappingKey, mapping.toString() ); stepVertex.setProperty( DictionaryConst.PROPERTY_VERBOSE_DETAILS, StringUtils.join( verboseProperties, "," ) );
/** * Set the execution duration for the change. * * @param duration */ private void setDuration(long duration) { vertex.setProperty("duration", duration); }
Vertex vPerson = graph.addVertex("class:Mysubclass"); vPerson.setProperty("firstName", "John"); vPerson.setProperty("lastName", "Smith"); vPerson.setProperty("<Person property>", "<value>"); vPerson.setProperty("<Person property>", "<value>"); graph.commit();
tx1 = g.newTransaction(); Vertex user_ver = tx1.addVertexWithLabel("user"); user_ver.setProperty("userid",entityPK); //Adding other properties for vertex tx1.commit();
@Override public void initCommunityProperty() { int communityCounter = 0; for (Vertex v : titanGraph.getVertices()) { v.setProperty(NODE_COMMUNITY, communityCounter); v.setProperty(COMMUNITY, communityCounter); communityCounter++; } }
@Override public void annotate(Vertex vertex, Map<String, Object> context) { for(Entry<String, Object> entry: context.entrySet()) { vertex.setProperty(entry.getKey(), entry.getValue()); } } };
@Override public void run(TitanTransaction tx) { Vertex u = tx.getVertex(vids[pos++]); u.setProperty("uid",5); } });
@Override public void run(TitanTransaction tx) { Vertex u = tx.getVertex(vids[0]); u.setProperty("name","v"+random.nextInt(10)); } });
@Override public Vertex createEntity( TypeMetadataSet<EntityTypeMetadata<TitanVertexMetadata>> types, Set<String> discriminators, Map<PrimitivePropertyMethodMetadata<TitanPropertyMetadata>, Object> exampleEntity) { Vertex vertex = titanGraph.addVertex(null); for (String discriminator : discriminators) { vertex.setProperty(TitanStoreSession.XO_DISCRIMINATORS_PROPERTY + discriminator, discriminator); } return vertex; }
@Override public void moveNode(int nodeCommunity, int toCommunity) { Iterable<Vertex> fromIter = titanGraph.getVertices(NODE_COMMUNITY, nodeCommunity); for (Vertex vertex : fromIter) { vertex.setProperty(COMMUNITY, toCommunity); } }
private void fixName(Vertex schemaVertex) { String name = schemaVertex.getProperty("name"); if (!isEmpty(name)) { name = name.replaceAll("-", "_"); schemaVertex.setProperty("name", name); } }
public void execute(final Vertex vertex, final GraphMemory graphMemory) { final Map<Particle, Long> oldParticles = graphMemory.isInitialIteration() ? this.startParticles : (Map<Particle, Long>) vertex.getProperty(PARTICLES); final Map<Particle, Long> newParticles = new HashMap<Particle, Long>(); for (final Map.Entry<Particle, Long> entry : oldParticles.entrySet()) { entry.getKey().execute(vertex, graphMemory, entry.getValue(), newParticles); } vertex.setProperty(PARTICLES, newParticles); }
private void init() { try { this.graph.getVertices("class", ""); } catch (IllegalArgumentException e) { Vertex v = this.graph.addVertex(null); v.setProperty("class", ""); } }
public void execute(final Vertex vertex, final GraphMemory graphMemory) { if (graphMemory.isInitialIteration()) { vertex.setProperty(COUNTS, 1l); } else { final VertexQueryBuilder query = this.queries.get((graphMemory.getIteration() - 1) % this.queries.size()); long newCount = 0l; for (final Vertex adjacent : query.build(vertex).vertices()) { newCount = newCount + (Long) adjacent.getProperty(COUNTS); } vertex.setProperty(COUNTS, newCount); } }
public void execute(final Vertex vertex, final GraphMemory graphMemory) { if (graphMemory.isInitialIteration()) { vertex.setProperty(PAGE_RANK, 1.0d / this.vertexCountAsDouble); vertex.setProperty(EDGE_COUNT, (double) this.outgoingQuery.build(vertex).count()); } else { double newPageRank = 0.0d; for (final Vertex adjacent : this.incomingQuery.build(vertex).vertices()) { newPageRank += (Double) adjacent.getProperty(PAGE_RANK) / (Double) adjacent.getProperty(EDGE_COUNT); } vertex.setProperty(PAGE_RANK, (this.alpha * newPageRank) + ((1.0d - this.alpha) / this.vertexCountAsDouble)); } }
@Override public synchronized long nextId(String farmID, ItemIdType itemIdType, int n) { Vertex farmVertex = findVertexByURI(getPartitionRW(farmID), farmID); Long curVal = farmVertex.<Long>getProperty(SEQUENCE_PREFIX + itemIdType.name()); long nextVal = (curVal == null ? 0l : curVal.longValue()) + n; farmVertex.setProperty(SEQUENCE_PREFIX + itemIdType.name(), nextVal); commit(); LOGGER.log(Level.FINEST, "nextId({0}, {1}, {2}) -> {3}", new Object[]{farmID, itemIdType.name(), n, nextVal}); System.err.println("nextId(" + farmID + ", " + itemIdType.name() + ", " + n + ") -> " + nextVal); return nextVal; }
@Test public void collectionsAreReturned() { TinkerGraph graph = new TinkerGraph(); Vertex v = graph.addVertex(1); assertThat(TinkerGraphUtil.getProperties(v, "foo", String.class), is(empty())); v.setProperty("foo", "bar"); assertThat(TinkerGraphUtil.getProperties(v, "foo", String.class), contains("bar")); v.setProperty("foo", newHashSet("bar", "baz")); assertThat(TinkerGraphUtil.getProperties(v, "foo", String.class), containsInAnyOrder("bar", "baz")); v.setProperty("foo", new String[] {"bar", "baz"}); assertThat(TinkerGraphUtil.getProperties(v, "foo", String.class), containsInAnyOrder("bar", "baz")); }
@Test public void testJointIndexRetrieval() { graph.makeKey("name").dataType(String.class).indexed(Vertex.class).make(); graph.makeKey("color").dataType(String.class).indexed(Vertex.class).make(); Vertex v = graph.addVertex(null); v.setProperty("name", "ilya"); v.setProperty("color", "blue"); graph.commit(); assertEquals(1, Iterables.size(graph.query().has("name", "ilya").vertices())); assertEquals(1, Iterables.size(graph.query().has("name", "ilya").has("color", "blue").vertices())); }
@Test public void properties_areCopied() { Vertex v1 = graph.addVertex(1L); v1.setProperty("foo", "bar"); Vertex v2 = graph.addVertex(2L); TinkerGraphUtil.copyProperties(v1, v2); assertThat((String)v2.getProperty("foo"), is("bar")); }
@SuppressWarnings("unchecked") @Test public void arrayProperties_areCopied() { Vertex v1 = graph.addVertex(1L); v1.setProperty("foo", new String[] {"bar", "baz"}); Vertex v2 = graph.addVertex(2L); TinkerGraphUtil.copyProperties(v1, v2); assertThat((List<String>)v2.getProperty("foo"), contains("bar", "baz")); }