diff --git a/doc/endpoints.md b/doc/endpoints.md index 31307b9a92f73fcd1203eb939c8ce0231b05b314..567e9020898e76ecba7b94c7ee5c21308ec6ea26 100644 --- a/doc/endpoints.md +++ b/doc/endpoints.md @@ -19,18 +19,45 @@ programming language or environment. SPARQL is inspired by SQL, a simple query that returns all triplets in the store looks like - SELECT * - WHERE { ?s ?p ?o } + SELECT * + WHERE { ?s ?p ?o } where `s`, `p` and `o` are query variables. The result of a query are valid substitutions for the query variables. In this case, the database would return a table of all triplets in the store sorted by subject `s`, predicate `p` and object `o`. -Of course, queries might return a lot of data. Importing just the -Isabelle exports [3] into GraphDB results in >200M triplets. This +Of course, queries might return a lot of data. Importing just the Isabelle exports [3] into GraphDB results in >200M triplets. This is solved with pagination techniques [4]. +RDF4J +----- + +RDF4J [5] is a Java API for interacting with triplet stores, implemented +based on a superset of SPARQL. GraphDB supports RDF4J, in fact it is the +recommended way of interacting with GraphDB repositories [6]. + +Instead of formulating textual queries, RDF4J allows developers to query +a repository by calling Java API methods. Above query that returns all triplets +in the store looks like + + connection.getStatements(null, null, null); + +in RDF4J. Method `getStatements(s, p, o)` returns all triplets that +have matching subject `s`, predicate `p` and object `o`. If any of +these arguments is `null`, it can be any value, i.e. it is a query +variable that is to be filled by the call to `getStatements`. + +Comparing SPARQL to RDF4J +------------------------- + +While plain SPARQL offers independence from the JVM, RDF4J is a +convenient interface that makes it easy to write applications with +problems like pagination already taken care of. + +Of course the interesting question for the task of building an ULO/RDF +endpoint is what works better for this particular application. + References ---------- @@ -41,3 +68,7 @@ References [3] https://gl.mathhub.info/Isabelle [4] https://stackoverflow.com/questions/27488403/paginating-sparql-results + +[5] https://rdf4j.org/ + +[6] http://graphdb.ontotext.com/documentation/free/using-graphdb-with-the-rdf4j-api.html