Skip to content

Instantly share code, notes, and snippets.

@pstutz
Last active August 29, 2015 14:03
Show Gist options
  • Save pstutz/b2ee09d8ac0835fd7d16 to your computer and use it in GitHub Desktop.
Save pstutz/b2ee09d8ac0835fd7d16 to your computer and use it in GitHub Desktop.
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");
tr.addTriple("http://d", "http://b", "http://c");
tr.prepareExecution();
Iterator<Function1<String, String>> results = tr
.sparql("SELECT ?x, ?y WHERE { ?x <http://b> ?y }");
while (results.hasNext()) {
Function1<String, String> bindings = results.next();
String xBinding = bindings.apply("x");
String yBinding = bindings.apply("y");
System.out.println("Bindings: x = " + xBinding + " and y = " + yBinding);
}
tr.shutdown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment