apache / jena

Apache Jena
https://jena.apache.org/
Apache License 2.0
1.12k stars 653 forks source link

Serving the Jena Fuseki UI from the Embedded Server? #1795

Open benjaminaaron opened 1 year ago

benjaminaaron commented 1 year ago

Version

4.7.0

Question

I am using the embedded Fuseki server in a Spring Boot application like this:

FusekiServer fusekiServer = FusekiServer.create()
    .add("/ds", ds)
    .build();
fusekiServer.start();

I would like to use the Fuseki UI.

Here I saw that a few things have to be added for it to work? I also added implementation "org.apache.jena:jena-fuseki-ui:4.7.0" to my build.gradle and saw, that it adds a readily built webapp to my gradle libraries. I can't seem to find out how to serve this though and wire it up properly to the embedded Fuseki server.

Spring Boot serves content located in src/main/resources/static automatically at 8080, should I use this or let FusekiServer do the serving via .staticFileBase() somehow?

afs commented 1 year ago

Having the UI for Fuseki/main is "work in progress". The idea is to have 2 Fuseki modules - one for the admin server side code, and one to provide the UI.

If you just want the query page and data loading, (not dataset create etc), then either staticFileBase or let Spring Boot server the content should work with different addresses (different ports).

nichtich commented 1 year ago

The compiled Fuseki UI web application is availabe as part of Fuseki binary distribution in directory webapp. Any web server will do to serve the static HTML/CSS/JS.

afs commented 1 year ago

It needs the server side functions for database admin (create, delete, stats). Query and data loading work are portable using SPARQL protocols.

nichtich commented 1 year ago

The Fuseki UI is just a client to both SPARQL (Query, Update & Graph Store Protocol) and Fuseki HTTP Administration Protocol. If Fuseki runs on default port 3030, the Fuseki UI can be served in form of static files via any web server. Putting contents of webapp into a directory where Spring can directly serve it should be possible.

afs commented 1 year ago

Fuseki main (the version FusekiServer relates to) does not include the admin protocol. That is available in Fuseki/webapp.

benjaminaaron - BTW, you can run Fuseki/webapp from a java application! It is not as configurable. The artifact is org.apache.jena:jena-fuseki-webapp. Run FusekiCmd.main. Databases are shared with the rest of the JVM. It wil create and use a run area.

benjaminaaron commented 1 year ago

Thank you both, much appreciated. jena-fuseki-webapp sounds like a good alternative! I am getting ERROR Can't find resourceBase (tried webapp, target/webapp... though. I will experiment more with the arguments to pass.

afs commented 1 year ago

My development setup does this: (Fuseki reads Java system properties as well as environment variables:

        String fusekiHome = "/home/..Somewhere.../jena/jena-fuseki2/jena-fuseki-webapp" ;
        String fusekiBase = "/home/..Soemwhere.../Fuseki/run" ;

        // >> Clean start
        IOX.deleteAll(fusekiBase);
        FileOps.ensureDir(fusekiBase);
        // << Clean start

        System.setProperty("FUSEKI_HOME", fusekiHome) ;
        System.setProperty("FUSEKI_BASE", fusekiBase) ;
        //FusekiCmd.main("--update", "--tdb2", "--loc=/home/.../tmp/DB2", "/ds");
        FusekiCmd.main("--mem", "/db");
Afler commented 3 months ago

@afs Hello What is the status of this embeddable Fuseki admin UI feature? Also, the previous workaround is actual or there is more relevant solution for now?

rvesse commented 3 months ago

@afs Hello What is the status of this embeddable Fuseki admin UI feature? Also, the previous workaround is actual or there is more relevant solution for now?

I don't believe there's been any progress on this since the issue was last updated. I know it's something @afs still wants to do but hasn't got to yet

afs commented 3 months ago

Hi @Afler - no concrete progress but it's getting nearer.

@Afler, @benjaminaaron -- a few refinement questions --

There are several areas within the UI: query, data loading, endpoint stats database creation/deletion (roughly - 2x2 matrix is (read,write) X (data, admin).

Which functionality of the UI are you interested in?

There are authorization issues which are currently not properly separated out, at least in the default configuration.

Do you have "one user" usage in mind or with different people with different responsibilities?

Anything else you'd like to comment on?

Afler commented 3 months ago

@afs Ty for response First of all, I would like to be able to execute queries and to view all dataset data (pageable statements for example). Secondly, db creation/deletion, and data export/import. In the production environment there is a few dev's who would be able to use whole UI functionality which can be interpreted as "single user admin mode" and each dev knows username/password for admin user. This would be nice to have from start Seeing further, dataset visualization as a graph would be nice. Also, data viewing in some readable format where data grouped by resource would be convenient (i.e. all properties and relation of a resource display in a single UI block) which is, essentially, representation as a graph.