Skip to content

Instantly share code, notes, and snippets.

View pstutz's full-sized avatar

Philip Stutz pstutz

  • Justement GmbH
  • Zurich, Switzerland
View GitHub Profile
@pstutz
pstutz / Node.scala
Created November 9, 2017 13:25
Generic Node
package org.opencypher.caps.impl.spark.physical
case class Pipeline[I <: Node[I], O <: Node[O]](
sequence: TreeTransformation[I, O]) {
def chain[A](t: TreeTransformation[O, A]): Pipeline[I, A] = {
}
}
@pstutz
pstutz / PropertyGraph.scala
Last active November 8, 2017 12:13
More powerful Graph API
trait PropertyGraph[R <: Records] {
def bind(p: Pattern): R
}
case class Pattern(
topology: Set[Connection] = Set.empty,
nodeConstraints: Map[Node, Set[NodeConstraint]] = Map.empty,
relConstraints: Map[Rel, Set[RelConstraint]] = Map.empty,
@pstutz
pstutz / zeppelin-notebook.json
Created October 17, 2017 14:04
CAPS Zeppelin Example Notebook
{
"paragraphs": [{
"text": "%md \n### This notebook shows how to get started with CAPS inside of Zeppelin.\n\nIn order to use this notebook, follow these steps:\n\n - Go to the Interpreter (`anonymous/username` -> `Interpreter`) settings in the top right\n - Find the `spark` interpreter and click on `edit` \n - In the `Dependencies` section, add the path to the CAPS jar file\n - Click on `save`",
"user": "anonymous",
"dateUpdated": "2017-10-17T15:02:02+0100",
"config": {
"colWidth": 12,
"enabled": true,
"results": {},
"editorSetting": {
@pstutz
pstutz / TripleRushTest
Last active August 29, 2015 14:03
Using the TripleRush Java API.
import scala.Function1;
import scala.collection.Iterator;
import com.signalcollect.triplerush.japi.TripleRush;
public class TripleRushTest {
public static void main(String[] args) {
TripleRush tr = new TripleRush();
tr.addTriple("http://a", "http://b", "http://c");
@pstutz
pstutz / RandomWalks.scala
Created April 10, 2012 06:55
RandomWalk Example Signal/Collect 1.1.2
import com.signalcollect._
import com.signalcollect.interfaces.MessageBus
import scala.util.Random
case class RandomWalker(idList: List[Any] = List(), maxLength: Int = 5) {
def extend(id: Any): Option[RandomWalker] = {
if (idList.size < maxLength) {
Some(RandomWalker(id :: idList, maxLength))
} else {
println("This walk has ended, idList = " + idList)