You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Kenneth Keefe <kj...@illinois.edu> on 2020/06/16 21:27:16 UTC

General Jena/Fuseki/TDB2 architecture questions

I am learning Apache Jena and looking for advice. Please correct me if I am
speaking incorrectly about these components and suggestions for additional
learning resources are VERY welcome.

I am developing a RESTful Java web application that uses Apache Jena as a
data store with custom inference rules. Basically, external applications
will send data to my application, my application will onboard the data,
have Jena do some inference with custom rules, and then provide inferred
data back to the external applications.

I've been very happy with a proof of concept that involves running Jena in
memory only, loading my ontology, adding triples through .addLiteral and
.addProperty calls on Resources. The inference is working well and I am
able to provide basic inferred data back through .listStatements calls.

The time has come to bring persistence and SPARQL into the mix. I'd like to
have a persistent triple store that my RESTful java web app can interface
with and I would also like to expose the nice Fuseki web interface for
power users and my own debugging purposes. From reading the documentation,
it seems like the way to do that is have Fuseki manage the TDB2 store and
both the Fuseki web app and my web app use a single Fuseki instance as the
single point of contact so that there is no problem with multi-threaded
access to the TDB2 store.

Here are some questions:

1. Can I use the Fuseki web application as the interface point for my web
application?

2. How should I connect my web application to the Fuseki instance? Should I
use RDFConnection or ARQ? Or do I need to use a RESTful client in my web
app to connect to Fuseki?

3. If I want to pull the Fuseki web application out in the future, is it a
significant challenge to switch over to Fuseki as a service? Any design
choices I should make to prepare for this potential direction?

Thanks in advance!

Ken

Re: General Jena/Fuseki/TDB2 architecture questions

Posted by "Bruno P. Kinoshita" <ki...@apache.org>.
I think it should be fine to use the UI that comes with Fuseki, and also have another UI. For the application I mentioned before, SKOSMOS, I use Jena Fuseki to load datasets, and run queries. But for the vocabulary management, I use the SKOSMOS UI (which is PHP, Twig templates, and JS/JQuery, sending queries via EasyRDF to the Fuseki services).

Bruno


On Wednesday, 17 June 2020, 3:16:25 pm NZST, Kenneth Keefe <kj...@illinois.edu> wrote: 





Thank you for the advice Bruno. My web application is a RESTful java web
service. So, I'm not trying to embed the Fuseki interface at all. The thing
is, I really like the Fuseki web app interface and several of my power
users are familiar with it. I expect that they will want to experiment with
various SPARQL queries using the Fuseki interface and then send me queries
that they would like me to expose in the RESTful web service. So, the trick
is really that I need both Fuseki and my application to interface with the
data in the same TDB2 store.

Is anyone else running two applications that need to interface with the
same TDB2? From the documentation, it seems like the solution is to have
Fuseki provide the SPARQL services. However, I'm unclear if the Fuseki web
app can provide its HTTP UI and provide a SPARQL service endpoint for my
web app.

Ken

On Tue, Jun 16, 2020 at 9:45 PM Bruno P. Kinoshita <ki...@apache.org> wrote:

> Hi Ken,
>
>
> I am probably not the best person to answer this, but hopefully others can
> comment/correct me if I'm wrong.
>
>
> >1. Can I use the Fuseki web application as the interface point for my web
> application?
>
>
> I think it depends how you are building your application. If you have
> portlets or iframes, and would like to simply embed it, it could work. If
> you your own applicatoin written in JS or Java, PHP, etc, probably you want
> to consume Fuseki services instead? So that you can customize security,
> RBAC, UI, etc.
>
>
>
> > 2. How should I connect my web application to the Fuseki instance?
> Should I use RDFConnection or ARQ? Or do I need to use a RESTful client in
> my web app to connect to Fuseki?
>
>
> Weirdly, I think I never connected to Jena via Web in Java. I used its API
> once, when ingesting some data into Impala/Hive, that needed to load
> ontologies. For that I used the Jena Model class, and the methods to create
> values/literals/etc, and add to the model (can't remember much about the
> code).
>
>
> But I think I have used EasyRDF in PHP (SKOSMOS is a PHP application that
> uses it, for instance) that sends queries to Jena web services.
>
>
> I also used rdflib which is Python, and is also able to send queries to an
> SPARQL endpoint. I think Jena has a client for SPARQL queries? If not it
> should be easy to find one.
>
>
> > 3. If I want to pull the Fuseki web application out in the future, is it
> a significant challenge to switch over to Fuseki as a service? Any design
> choices I should make to prepare for this potential direction?
>
>
> I think we were discussing something similar in the mailing list recently.
> I started working on an update of the Fuseki UI, which is shipped with Jena
> and available by default on http://localhost:3030. This updated version
> is being created with Vue.JS. It uses Axios to send HTTP requests to the
> Fuseki services. I think in the future we may have a standalone Fuseki Java
> web services module, and a separate UI-Javascript module. And maybe another
> module only with the UI for admin.
>
> When/If we have this set up, you may be able to re-use the admin module,
> for instance, if you'd like to include it in your application only
> available to certain users.
>
>
> When you visit Fuseki and choose a dataset, it should display some
> services for you. Like $datasetname/sparql, $datasetname/data,
> $datasetname/upload.
>
>
> Jena comes with a series of command line utilities that execute SPARQL
> over HTTP (https://jena.apache.org/documentation/fuseki2/soh.html). You
> should be able to look at the code and adapt it for your application.
>
>
> Hope that helps,
>
> Bruno
>
>
>
> On Wednesday, 17 June 2020, 9:28:02 am NZST, Kenneth Keefe <
> kjkeefe@illinois.edu> wrote:
>
>
>
>
>
> I am learning Apache Jena and looking for advice. Please correct me if I am
> speaking incorrectly about these components and suggestions for additional
> learning resources are VERY welcome.
>
> I am developing a RESTful Java web application that uses Apache Jena as a
> data store with custom inference rules. Basically, external applications
> will send data to my application, my application will onboard the data,
> have Jena do some inference with custom rules, and then provide inferred
> data back to the external applications.
>
> I've been very happy with a proof of concept that involves running Jena in
> memory only, loading my ontology, adding triples through .addLiteral and
> .addProperty calls on Resources. The inference is working well and I am
> able to provide basic inferred data back through .listStatements calls.
>
> The time has come to bring persistence and SPARQL into the mix. I'd like to
> have a persistent triple store that my RESTful java web app can interface
> with and I would also like to expose the nice Fuseki web interface for
> power users and my own debugging purposes. From reading the documentation,
> it seems like the way to do that is have Fuseki manage the TDB2 store and
> both the Fuseki web app and my web app use a single Fuseki instance as the
> single point of contact so that there is no problem with multi-threaded
> access to the TDB2 store.
>
> Here are some questions:
>
> 1. Can I use the Fuseki web application as the interface point for my web
> application?
>
> 2. How should I connect my web application to the Fuseki instance? Should I
> use RDFConnection or ARQ? Or do I need to use a RESTful client in my web
> app to connect to Fuseki?
>
> 3. If I want to pull the Fuseki web application out in the future, is it a
> significant challenge to switch over to Fuseki as a service? Any design
> choices I should make to prepare for this potential direction?
>
> Thanks in advance!
>
> Ken
>

Re: General Jena/Fuseki/TDB2 architecture questions

Posted by Kenneth Keefe <kj...@illinois.edu>.
Thank you for the advice Bruno. My web application is a RESTful java web
service. So, I'm not trying to embed the Fuseki interface at all. The thing
is, I really like the Fuseki web app interface and several of my power
users are familiar with it. I expect that they will want to experiment with
various SPARQL queries using the Fuseki interface and then send me queries
that they would like me to expose in the RESTful web service. So, the trick
is really that I need both Fuseki and my application to interface with the
data in the same TDB2 store.

Is anyone else running two applications that need to interface with the
same TDB2? From the documentation, it seems like the solution is to have
Fuseki provide the SPARQL services. However, I'm unclear if the Fuseki web
app can provide its HTTP UI and provide a SPARQL service endpoint for my
web app.

Ken

On Tue, Jun 16, 2020 at 9:45 PM Bruno P. Kinoshita <ki...@apache.org> wrote:

> Hi Ken,
>
>
> I am probably not the best person to answer this, but hopefully others can
> comment/correct me if I'm wrong.
>
>
> >1. Can I use the Fuseki web application as the interface point for my web
> application?
>
>
> I think it depends how you are building your application. If you have
> portlets or iframes, and would like to simply embed it, it could work. If
> you your own applicatoin written in JS or Java, PHP, etc, probably you want
> to consume Fuseki services instead? So that you can customize security,
> RBAC, UI, etc.
>
>
>
> > 2. How should I connect my web application to the Fuseki instance?
> Should I use RDFConnection or ARQ? Or do I need to use a RESTful client in
> my web app to connect to Fuseki?
>
>
> Weirdly, I think I never connected to Jena via Web in Java. I used its API
> once, when ingesting some data into Impala/Hive, that needed to load
> ontologies. For that I used the Jena Model class, and the methods to create
> values/literals/etc, and add to the model (can't remember much about the
> code).
>
>
> But I think I have used EasyRDF in PHP (SKOSMOS is a PHP application that
> uses it, for instance) that sends queries to Jena web services.
>
>
> I also used rdflib which is Python, and is also able to send queries to an
> SPARQL endpoint. I think Jena has a client for SPARQL queries? If not it
> should be easy to find one.
>
>
> > 3. If I want to pull the Fuseki web application out in the future, is it
> a significant challenge to switch over to Fuseki as a service? Any design
> choices I should make to prepare for this potential direction?
>
>
> I think we were discussing something similar in the mailing list recently.
> I started working on an update of the Fuseki UI, which is shipped with Jena
> and available by default on http://localhost:3030. This updated version
> is being created with Vue.JS. It uses Axios to send HTTP requests to the
> Fuseki services. I think in the future we may have a standalone Fuseki Java
> web services module, and a separate UI-Javascript module. And maybe another
> module only with the UI for admin.
>
> When/If we have this set up, you may be able to re-use the admin module,
> for instance, if you'd like to include it in your application only
> available to certain users.
>
>
> When you visit Fuseki and choose a dataset, it should display some
> services for you. Like $datasetname/sparql, $datasetname/data,
> $datasetname/upload.
>
>
> Jena comes with a series of command line utilities that execute SPARQL
> over HTTP (https://jena.apache.org/documentation/fuseki2/soh.html). You
> should be able to look at the code and adapt it for your application.
>
>
> Hope that helps,
>
> Bruno
>
>
>
> On Wednesday, 17 June 2020, 9:28:02 am NZST, Kenneth Keefe <
> kjkeefe@illinois.edu> wrote:
>
>
>
>
>
> I am learning Apache Jena and looking for advice. Please correct me if I am
> speaking incorrectly about these components and suggestions for additional
> learning resources are VERY welcome.
>
> I am developing a RESTful Java web application that uses Apache Jena as a
> data store with custom inference rules. Basically, external applications
> will send data to my application, my application will onboard the data,
> have Jena do some inference with custom rules, and then provide inferred
> data back to the external applications.
>
> I've been very happy with a proof of concept that involves running Jena in
> memory only, loading my ontology, adding triples through .addLiteral and
> .addProperty calls on Resources. The inference is working well and I am
> able to provide basic inferred data back through .listStatements calls.
>
> The time has come to bring persistence and SPARQL into the mix. I'd like to
> have a persistent triple store that my RESTful java web app can interface
> with and I would also like to expose the nice Fuseki web interface for
> power users and my own debugging purposes. From reading the documentation,
> it seems like the way to do that is have Fuseki manage the TDB2 store and
> both the Fuseki web app and my web app use a single Fuseki instance as the
> single point of contact so that there is no problem with multi-threaded
> access to the TDB2 store.
>
> Here are some questions:
>
> 1. Can I use the Fuseki web application as the interface point for my web
> application?
>
> 2. How should I connect my web application to the Fuseki instance? Should I
> use RDFConnection or ARQ? Or do I need to use a RESTful client in my web
> app to connect to Fuseki?
>
> 3. If I want to pull the Fuseki web application out in the future, is it a
> significant challenge to switch over to Fuseki as a service? Any design
> choices I should make to prepare for this potential direction?
>
> Thanks in advance!
>
> Ken
>

Re: General Jena/Fuseki/TDB2 architecture questions

Posted by "Bruno P. Kinoshita" <ki...@apache.org>.
Hi Ken,


I am probably not the best person to answer this, but hopefully others can comment/correct me if I'm wrong.


>1. Can I use the Fuseki web application as the interface point for my web application?


I think it depends how you are building your application. If you have portlets or iframes, and would like to simply embed it, it could work. If you your own applicatoin written in JS or Java, PHP, etc, probably you want to consume Fuseki services instead? So that you can customize security, RBAC, UI, etc.



> 2. How should I connect my web application to the Fuseki instance? Should I use RDFConnection or ARQ? Or do I need to use a RESTful client in my web app to connect to Fuseki?


Weirdly, I think I never connected to Jena via Web in Java. I used its API once, when ingesting some data into Impala/Hive, that needed to load ontologies. For that I used the Jena Model class, and the methods to create values/literals/etc, and add to the model (can't remember much about the code).


But I think I have used EasyRDF in PHP (SKOSMOS is a PHP application that uses it, for instance) that sends queries to Jena web services.


I also used rdflib which is Python, and is also able to send queries to an SPARQL endpoint. I think Jena has a client for SPARQL queries? If not it should be easy to find one.


> 3. If I want to pull the Fuseki web application out in the future, is it a significant challenge to switch over to Fuseki as a service? Any design choices I should make to prepare for this potential direction?


I think we were discussing something similar in the mailing list recently. I started working on an update of the Fuseki UI, which is shipped with Jena and available by default on http://localhost:3030. This updated version is being created with Vue.JS. It uses Axios to send HTTP requests to the Fuseki services. I think in the future we may have a standalone Fuseki Java web services module, and a separate UI-Javascript module. And maybe another module only with the UI for admin.

When/If we have this set up, you may be able to re-use the admin module, for instance, if you'd like to include it in your application only available to certain users.


When you visit Fuseki and choose a dataset, it should display some services for you. Like $datasetname/sparql, $datasetname/data, $datasetname/upload.


Jena comes with a series of command line utilities that execute SPARQL over HTTP (https://jena.apache.org/documentation/fuseki2/soh.html). You should be able to look at the code and adapt it for your application.


Hope that helps,

Bruno



On Wednesday, 17 June 2020, 9:28:02 am NZST, Kenneth Keefe <kj...@illinois.edu> wrote: 





I am learning Apache Jena and looking for advice. Please correct me if I am
speaking incorrectly about these components and suggestions for additional
learning resources are VERY welcome.

I am developing a RESTful Java web application that uses Apache Jena as a
data store with custom inference rules. Basically, external applications
will send data to my application, my application will onboard the data,
have Jena do some inference with custom rules, and then provide inferred
data back to the external applications.

I've been very happy with a proof of concept that involves running Jena in
memory only, loading my ontology, adding triples through .addLiteral and
.addProperty calls on Resources. The inference is working well and I am
able to provide basic inferred data back through .listStatements calls.

The time has come to bring persistence and SPARQL into the mix. I'd like to
have a persistent triple store that my RESTful java web app can interface
with and I would also like to expose the nice Fuseki web interface for
power users and my own debugging purposes. From reading the documentation,
it seems like the way to do that is have Fuseki manage the TDB2 store and
both the Fuseki web app and my web app use a single Fuseki instance as the
single point of contact so that there is no problem with multi-threaded
access to the TDB2 store.

Here are some questions:

1. Can I use the Fuseki web application as the interface point for my web
application?

2. How should I connect my web application to the Fuseki instance? Should I
use RDFConnection or ARQ? Or do I need to use a RESTful client in my web
app to connect to Fuseki?

3. If I want to pull the Fuseki web application out in the future, is it a
significant challenge to switch over to Fuseki as a service? Any design
choices I should make to prepare for this potential direction?

Thanks in advance!

Ken