Skip to content

Instantly share code, notes, and snippets.

View okram's full-sized avatar
🏠
Working from home

Marko A. Rodriguez okram

🏠
Working from home
View GitHub Profile
private void readPathElement(final FaunusPathElement element, Schema schema, final DataInput in) throws IOException {
readElement(element,schema,in);
//in.readBoolean();
element.pathEnabled = element.getConf().getBoolean(FaunusCompiler.PATH_ENABLED, false);
if (element.pathEnabled) {
element.paths = readElementPaths(in);
element.microVersion = (element instanceof FaunusVertex) ? new FaunusVertex.MicroVertex(element.id) : new FaunusEdge.MicroEdge(element.id);
} else
element.pathCounter = WritableUtils.readVLong(in);
}
# input graph parameters
faunus.graph.input.format=com.thinkaurelius.faunus.formats.titan.cassandra.TitanCassandraInputFormat
faunus.graph.input.titan.storage.backend=cassandrathrift
faunus.graph.input.titan.storage.hostname=localhost
faunus.graph.input.titan.storage.port=9160
faunus.graph.input.titan.storage.keyspace=titan
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner
# cassandra.input.split.size=512
# cassandra.thrift.framed.size_mb=49
# cassandra.thrift.message.max_size_mb=50
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<excludes>
<exclude>**/*CassandaOutputFormatTest.java</exclude>
</excludes>
</configuration>
</plugin>
public void testBulkEdgeDerivations() throws Exception {
TitanGraph g = generateTitanGraph();
bulkLoadGraphOfTheGods();
FaunusGraph f = generateFaunusGraph(TitanCassandraOutputFormat.class.getResourceAsStream("cassandra-cassandra.properties"));
new FaunusPipeline(f).V().as("x").out("father").out("father").linkIn("grandfather", "x").submit();
assertEquals(12, new GremlinPipeline(g).V().count());
assertEquals(18, new GremlinPipeline(g).E().count());
@okram
okram / gist:7977938
Last active December 31, 2015 11:09
if (this.trackState && faunusVertex.isLoaded()) {
final TitanVertex titanVertex = (TitanVertex) this.graph.getVertex(faunusVertex.getId());
for (final FaunusProperty property : faunusVertex.getPropertiesWithState()) {
if (property.isNew()) {
// TODO is this right?
titanVertex.addProperty(property.getName(), property.getValue());
context.getCounter(Counters.VERTEX_PROPERTIES_CREATED).increment(1l);
} else if (property.isDeleted()) {
// TODO: what if there are multiple properties of the same key?
titanVertex.removeProperty(property.getName());
// do all property deletions, then do all property additions (ensures proper order of operations)
for (final FaunusProperty faunusProperty : faunusEdge.getPropertiesWithState()) {
if (faunusProperty.isDeleted()) {
titanEdge.removeProperty(faunusProperty.getName());
context.getCounter(Counters.EDGE_PROPERTIES_DELETED).increment(1l);
}
}
for (final FaunusProperty faunusProperty : faunusEdge.getPropertiesWithState()) {
if (faunusProperty.isNew()) {
titanEdge.setProperty(faunusProperty.getName(), faunusProperty.getValue());
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<executions>
<execution>
<id>titan-cassandra-test</id>
<goals>
<goal>integration-test</goal>
</goals>
public interface Vertex extends Element {
static final String V = "v";
static final String L_BRACKET = "[";
static final String R_BRACKET = "]";
public default Set<String> getPropertyKeys() {
return this.getProperties().keySet();
}
public interface Extension {
public default Optional<Object[]> beforeAddVertex(Optional<Object[]> keyValues) {
return keyValues;
}
public default Optional<Vertex> afterAddVertex(Optional<Vertex> vertex) {
return vertex;
}
}
package com.tinkerpop.blueprints.extension;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.ElementHelper;
import java.util.Arrays;
import java.util.Optional;
/**