Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marko A. Rodriguez okram

🏠
Working from home
View GitHub Profile
View gist:1370596
package com.tinkerpop.gremlin.scala.transform
import com.tinkerpop.blueprints.pgm.Vertex
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
import com.tinkerpop.gremlin.test.UtilitiesTest
import com.tinkerpop.gremlin.scala._
import com.tinkerpop.pipes.branch.LoopPipe.LoopBundle
class PathStepTest extends com.tinkerpop.gremlin.test.transform.PathStepTest {
val g = TinkerGraphFactory.createTinkerGraph()
View gist:1371731
package com.cisco.hmp.graph.gui;
import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.Vertex;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
View gist:1371740
package com.cisco.hmp.graph.gui;
import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory;
import junit.framework.TestCase;
import java.util.Arrays;
/**
View gist:1445183
AuditGraph graph = new AuditGraph(new Neo4jGraph("/tmp/hmp")); // realize that you can do the graph stacking as in: new SchemaGraph(new AuditGraph(new Neo4jGraph("/tmp/hmp"))
graph.setUser("bim"); // this name is recorded with a representation (i.e. who created this representation?)
graph.inThePresentMoment(true); // our perspective is startTime:System.currentTimeMillis() and endTime:startTime+1
Vertex marko = graph.addVertex(null);
Vertex sumit = graph.addVertex(null);
graph.addEdge(null, marko, sumit, "knows");
assertTrue(count(graph.getVertices()) == 2)
View gist:2668575
public class ReadOnlyVertex extends ReadOnlyElement implements Vertex {
public ReadOnlyVertex(final Vertex rawVertex) {
super(rawVertex);
}
public Iterable<Edge> getInEdges(final String... labels) {
return new ReadOnlyEdgeIterable(((Vertex) this.rawElement).getInEdges(labels));
}
View gist:2695866
package com.tinkerpop.gremlin.pipes.filter;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.pipes.AbstractPipe;
import com.tinkerpop.pipes.filter.FilterPipe;
import com.tinkerpop.pipes.util.PipeHelper;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
View gist:2697271
package com.tinkerpop.blueprints;
/**
* A vertex maintains pointers to both a set of incoming and outgoing edges.
* The outgoing edges are those edges for which the vertex is the tail.
* The incoming edges are those edges for which the vertex is the head.
* Diagrammatically, ---inEdges---> vertex ---outEdges--->.
*
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Matthias Brocheler (http://matthiasb.com)
View gist:2697453
package com.tinkerpop.blueprints.impls.tg;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Query;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.DefaultQuery;
import com.tinkerpop.blueprints.util.MultiIterable;
import com.tinkerpop.blueprints.util.StringFactory;
import com.tinkerpop.blueprints.util.VerticesFromEdgesIterable;
View gist:2697481
package com.tinkerpop.blueprints.util;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import java.util.Iterator;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
View gist:2697842
/**
* A CloseableIterable which wraps a simple iterator.
*
* @author Joshua Shinavier (http://fortytwo.net)
*/
public class IteratorCloseableIterable<T> implements CloseableIterable<T> {
private final Iterator<T> iterator;
public IteratorCloseableIterable(Iterator<T> iterator) {
this.iterator = iterator;