On 26/10/17 05:52, Jeffrey Brown wrote:
I want to rewrite Digraphs with Text[1] to use an external Datalog server,
rather than the native Haskell module for graphs that it currently uses.
Jena looks like the best open-source choice.
Jena isn't really a Datalog server. It's provides an RDF server and the
ability to do some rule based inference over the RDF that you query.
Whether that's a close enough approximation to a Datalog server depends
on what you are doing.
I can run ./fuseki, visit
http://localhost:3030, upload data and manually query it. I want to do
those things over HTTP.
I have found a number of sources that describe Jena's RDF and Sparql APIs,
but nothing describing its web API. My rudimentary understanding of web
services is that there's some URL of the form "http://localhost:3030//
dataset/query?magic", where an appropriate value for "magic" would produce
the results of a query. Is that correct?
Yes, specifically:
http://localhost:3030/dataset/query?query={sparql query}
Jena implements the WC specs for the query and update protocols:
https://www.w3.org/TR/sparql11-protocol/
https://www.w3.org/TR/sparql11-update/
https://www.w3.org/TR/sparql11-http-rdf-update/
There are command line tools to help drive this with Jena (rquery,
rupdate etc) and fuseki (s-query, s-update etc).
How does one translate data entry (or removal) commands from Jena's RDF API
to Jena's Web RDF API?
> How does one translate queries from Jena's Sparql
> API to Jena's Web Sparql API?
If by RDF API you mean the Java API of Model/Resource/Property etc then
those are lower level things and don't map 1-1 to the web protocol.
If you want to work over the Web API then you create and issue SPARQL
Queries or SPARQL Updates or whole graph get/update/replace operations.
The Jena ARQ API provides tools to help with that and lets you to
construct and issue SPARQL queries against both local stores and remote
web accessible stores. See, for example:
https://jena.apache.org/documentation/query/sparql-remote.html
Last, the Jena documentation says that it contains two inference engines.
Is Datalog one of them and Sparql the other? I'm finding a lot of Jena
Sparql documentation, but no Jena Datalog documentation.
There's no full blown Datalog engine in Jena. It provides a pair of
in-memory rule engines. One forward chaining RETE style and one tabled
back chaining style. Both are sufficient for the use Jena makes of them
but e.g. the backward engine is not on the same scale as XSB and the
forward engine will not compare to commercial forward engines.
The API and rule syntax are described at:
https://jena.apache.org/documentation/inference/index.html
Sparql is not a different engine. But a query language.
With the rule engines you can configure a wrapper round some RDF data
and then query that through either the RDF API or Sparql. So they work
at different levels.
Dave
Many thanks.
[1] Digraphs with Text
<https://github.com/JeffreyBenjaminBrown/digraphs-with-text> is a simple
app that provides a generalization of the graph (relationships of arbitrary
arity, arbitrarily nested) and a language for input and queries that is
friendly to non-programmers.