Last active
August 29, 2015 14:03
-
-
Save pstutz/b2ee09d8ac0835fd7d16 to your computer and use it in GitHub Desktop.
Using the TripleRush Java API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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