You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jeffrey Brown <je...@gmail.com> on 2017/10/26 04:52:14 UTC
Using Fuseki over HTTP
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. 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?
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?
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.
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.
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>
Re: Using Fuseki over HTTP
Posted by Dave Reynolds <da...@gmail.com>.
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.
>
>
Re: Using Fuseki over HTTP
Posted by aj...@apache.org.
See comments in-line.
Jeffrey Brown wrote on 10/26/17 6:52 AM:
> 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. I can run ./fuseki, visit http://localhost:3030, upload data and manually query it. I want to do those things over HTTP.
If you are going to http://localhost:3030 to do those things, you already are doing them over HTTP, are you not? Or
perhaps I misunderstand your question?
> I have found a number of sources that describe Jena's RDF and Sparql APIs, but nothing describing its web API.
Jena has its own particular HTTP API for administration (e.g. adding and removing datasets) but for ordinary query,
update, etc. operations it implements the W3C Recommendations in those matters, e.g. SPARQL Query, SPARQL Update, Graph
Store, etc.
> 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?
More or less. See http://www.w3.org/TR/sparql11-protocol/ for specifics. Your "magic" token is just a SPARQL Query.
> 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?
Jena's "Web Sparql API" is just the W3C recommended SPARQL Protocol (see link above). There really isn't much
translation to be done. SPARQL Query (or Update) is SPARQL Query (or Update), in Java or over HTTP. In fact, using
Jena's RDF Connection component you needn't even differentiate in your code between local and HTTP-supported datasets:
https://jena.apache.org/documentation/rdfconnection .
> 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.
SPARQL Query is not really an inference engine, per se, although you can certainly use SPARQL queries to implement many
kinds of inference. With regard to Jena's abilities with inference, you'll want to start here:
https://jena.apache.org/documentation/inference
and particularly
https://jena.apache.org/documentation/inference/#rules
and
https://jena.apache.org/documentation/inference/#RULEbackward
Note "In fact, the rule language is essentially datalog rather than full prolog, whilst the functor syntax within rules
does allow some creation of nested data structures they are flat (not recursive) and so can be regarded a syntactic
sugar for datalog."
Hope this helps, and please come back with more questions!
---
A. Soroka
Research Computing : Office of the CIO : the Smithsonian Institution
> 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.
>
>