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 Witt <je...@gmail.com> on 2015/03/23 17:19:12 UTC

how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

I have been running an Apache Jean Fuseki with a closed port for a while. At
present my other apps can access this via localhost.
Following their instructions I start this service as follows:
./fuseki-server --update --mem /ds
This create and updatable in memory database.
The only way I currently know how to add data to this database is using the
built-in http request tools:
./s-post http://localhost:3030/ds/data
This works great except now I want to expose this port so that other people
can query the dataset. However, I don't want to allow people to update or
change the database, I just want them to be able to use and query the
information I originally loaded into the data base.
According to the documentation
(http://jena.apache.org/documentation/serving_data/), I can make the
database read-only by starting it without the update option.
> Data can be updated without access control if the server is started with the
> --update argument. If started without that argument, data is read-only.

But when I start the database this way, I am no longer able to populate with
the initial dataset.
So, MY QUESTION: How I start an in-memory Fuseki database which I can
populate with my original dataset but then disallow further http updates.
(My guess is that I need another method to populate the Fueseki database
that is not using the http protocol. But I'm not sure)


I posted this question on StackOverflow as well:
http://stackoverflow.com/questions/29214852/how-to-start-apache-jena-fuseki-
as-read-only-service-but-also-initially-populat
Thanks for your help.

-- 
Dr. Jeffrey C. Witt
Philosophy Department
Loyola University Maryland
4501 N. Charles St.
Baltimore, MD 21210
www.jeffreycwitt.com <http://www.jeffreycwitt.com/>



Re: how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

Posted by Andy Seaborne <an...@apache.org>.
On 03/24/15 17:13, Jeffrey Witt wrote:
> Andy, thanks so much,
>
> I went with option 2. It seems to work great.
>
> Check out http://sparql.scta.info <http://sparql.scta.info/>
>
> (If you have time maybe you could quickly browse the above link and see if
> you see any security concerns. I want people to be able to query the
> database, but just not add or delete anything. I tried to add a rdf/xml file
> through the interface and — as desired — it gave me an error. So it seems
> like it providing the desired read only access.

Not a security issues per se but editing the HTTP pages to remove the 
validators and the update panel makes it clearer.

>
> The only other follow up is that I would love to set my url:
> sparql.scta.info directly to the query endpoint.
>
> Right now the query endpoint is sparql.scta.info/ds/query, where as
> sparql.scta.info takes the user to the fuseki interface.
>
> Can you (or anyone else) think of a way to set sparql.scta.info/ds/query to
> the web root, so that queries can be sent directly to
> http://sparql.scta.info.
>
> I would prefer to get rid of the Fueseki web interface altogether, but not
> sure how to or if I can do that.


With just Fuseki, I can't think of a way.

But you could add a reverse proxy (i.e. run httpd, nginx etc) on 
sparql.scta.info and have it send "/?query=" to "/ds/query?query="

>
> Andy, feel free to pass on this question. You’ve already helped me a ton. Or
> just tell me to post this as a new question to the list-serv.
>
> Thanks.
>
> jeff
>
>
>
>
>
> On 3/24/15, 10:36 AM, "Andy Seaborne" <an...@apache.org> wrote:
>
>> Hi there,
>>
>> Re: option 1
>>
>> The TDB tools are command line scripts - no java programming involved.
>>
>> # One time:
>> tdbloader --loc=DB ... your data ...
>>
>> # Start server each time.
>> ./fuseki-server --loc=DB /ds
>>
>> Re: option 2
>>
>> ./fuseki-server --loc=DB --update /ds
>>
>> then
>> # one time
>> ./s-post
>>
>> puts it in a directory called "DB".
>>
>> There is a time when the server is accessible for update though.
>>
>> Andy
>>
>> On 24/03/15 12:40, Jeffrey Witt wrote:
>>>   Hi Andy,
>>>   Thanks for your response. This is probably a newbie follow up, butŠ
>>>
>>>   I¹m curious about option two. How can I build a persistent database with
>>>   --update without using TDB. Would I start Fuseki without the --mem option?
>>>   If so, where is the data getting stored if not with the TDB tools?
>>>
>>>   If I can somehow make a persistent data store while using only Fuseki, and
>>>   avoid using TBD for the time being, that would be the easiest option for
>>>   me.
>>>
>>>   Thanks for your help.
>>>   jw
>>>
>>>
>>
>>
>
>
>


Re: how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

Posted by Jeffrey Witt <je...@gmail.com>.
Andy, thanks so much,

I went with option 2. It seems to work great.

Check out http://sparql.scta.info <http://sparql.scta.info/>

(If you have time maybe you could quickly browse the above link and see if
you see any security concerns. I want people to be able to query the
database, but just not add or delete anything. I tried to add a rdf/xml file
through the interface and — as desired — it gave me an error. So it seems
like it providing the desired read only access.

The only other follow up is that I would love to set my url:
sparql.scta.info directly to the query endpoint.
 
Right now the query endpoint is sparql.scta.info/ds/query, where as
sparql.scta.info takes the user to the fuseki interface.

Can you (or anyone else) think of a way to set sparql.scta.info/ds/query to
the web root, so that queries can be sent directly to
http://sparql.scta.info.

I would prefer to get rid of the Fueseki web interface altogether, but not
sure how to or if I can do that.

Andy, feel free to pass on this question. You’ve already helped me a ton. Or
just tell me to post this as a new question to the list-serv.

Thanks.

jeff





On 3/24/15, 10:36 AM, "Andy Seaborne" <an...@apache.org> wrote:

> Hi there,
> 
> Re: option 1
> 
> The TDB tools are command line scripts - no java programming involved.
> 
> # One time:
> tdbloader --loc=DB ... your data ...
> 
> # Start server each time.
> ./fuseki-server --loc=DB /ds
> 
> Re: option 2
> 
> ./fuseki-server --loc=DB --update /ds
> 
> then
> # one time
> ./s-post
> 
> puts it in a directory called "DB".
> 
> There is a time when the server is accessible for update though.
> 
> Andy
> 
> On 24/03/15 12:40, Jeffrey Witt wrote:
>>  Hi Andy,
>>  Thanks for your response. This is probably a newbie follow up, butŠ
>> 
>>  I¹m curious about option two. How can I build a persistent database with
>>  --update without using TDB. Would I start Fuseki without the --mem option?
>>  If so, where is the data getting stored if not with the TDB tools?
>> 
>>  If I can somehow make a persistent data store while using only Fuseki, and
>>  avoid using TBD for the time being, that would be the easiest option for
>>  me.
>> 
>>  Thanks for your help.
>>  jw
>> 
>> 
> 
> 



Re: how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

Posted by Andy Seaborne <an...@apache.org>.
Hi there,

Re: option 1

The TDB tools are command line scripts - no java programming involved.

# One time:
tdbloader --loc=DB ... your data ...

# Start server each time.
./fuseki-server --loc=DB /ds

Re: option 2

./fuseki-server --loc=DB --update /ds

then
# one time
./s-post

puts it in a directory called "DB".

There is a time when the server is accessible for update though.

	Andy

On 24/03/15 12:40, Jeffrey Witt wrote:
> Hi Andy,
> Thanks for your response. This is probably a newbie follow up, butŠ
>
> I¹m curious about option two. How can I build a persistent database with
> --update without using TDB. Would I start Fuseki without the --mem option?
> If so, where is the data getting stored if not with the TDB tools?
>
> If I can somehow make a persistent data store while using only Fuseki, and
> avoid using TBD for the time being, that would be the easiest option for
> me.
>
> Thanks for your help.
> jw
>
>


Re: how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

Posted by Jeffrey Witt <je...@gmail.com>.
Hi Andy, 
Thanks for your response. This is probably a newbie follow up, butŠ

I¹m curious about option two. How can I build a persistent database with
--update without using TDB. Would I start Fuseki without the --mem option?
If so, where is the data getting stored if not with the TDB tools?

If I can somehow make a persistent data store while using only Fuseki, and
avoid using TBD for the time being, that would be the easiest option for
me.

Thanks for your help.
jw


-- 
Dr. Jeffrey C. Witt
Philosophy Department
Loyola University Maryland
4501 N. Charles St.
Baltimore, MD 21210www.jeffreycwitt.com <http://www.jeffreycwitt.com/>






On 3/24/15, 6:44 AM, "Andy Seaborne" <an...@apache.org> wrote:

>On 23/03/15 16:19, Jeffrey Witt wrote:
>> I have been running an Apache Jean Fuseki with a closed port for a
>>while. At
>> present my other apps can access this via localhost.
>> Following their instructions I start this service as follows:
>> ./fuseki-server --update --mem /ds
>> This create and updatable in memory database.
>> The only way I currently know how to add data to this database is using
>>the
>> built-in http request tools:
>> ./s-post http://localhost:3030/ds/data
>> This works great except now I want to expose this port so that other
>>people
>> can query the dataset. However, I don't want to allow people to update
>>or
>> change the database, I just want them to be able to use and query the
>> information I originally loaded into the data base.
>> According to the documentation
>> (http://jena.apache.org/documentation/serving_data/), I can make the
>> database read-only by starting it without the update option.
>>> Data can be updated without access control if the server is started
>>>with the
>>> --update argument. If started without that argument, data is read-only.
>>
>> But when I start the database this way, I am no longer able to populate
>>with
>> the initial dataset.
>> So, MY QUESTION: How I start an in-memory Fuseki database which I can
>> populate with my original dataset but then disallow further http
>>updates.
>> (My guess is that I need another method to populate the Fueseki database
>> that is not using the http protocol. But I'm not sure)
>>
>>
>> I posted this question on StackOverflow as well:
>> 
>>http://stackoverflow.com/questions/29214852/how-to-start-apache-jena-fuse
>>ki-
>> as-read-only-service-but-also-initially-populat
>> Thanks for your help.
>>
>
>Jeffrey,
>
>I can think of a couple of options:
>
>1/ Use TDB tools to build a database offline and then start the server
>read only on that TDB database.
>
>2/ Like (1) but use --update to build a persistent database, then stop
>the server, and restart without --update.  The database is now read
>only.  --update affects the services available and does not affect the
>data in any other way.
>
>Having a persistent database has the huge advantage that you can start
>and stop the server without needing to reload data.
>
>3/ Use a web server to pass through query requests to the fuseki server
>and limit the Fuseki server to talk to only localhost.  You can update
>from the local machine, external people can't.
>
>4/ Use Fuseki2 and adjust the security settings to allow update only
>from localhost but query from anywhere.
>
>What you can't do is update a TDB database currently being served by
>Fuseki.
>
>	Andy
>



Re: how to start Apache Jena Fuseki as read only service (but also initially populate it with data)

Posted by Andy Seaborne <an...@apache.org>.
On 23/03/15 16:19, Jeffrey Witt wrote:
> I have been running an Apache Jean Fuseki with a closed port for a while. At
> present my other apps can access this via localhost.
> Following their instructions I start this service as follows:
> ./fuseki-server --update --mem /ds
> This create and updatable in memory database.
> The only way I currently know how to add data to this database is using the
> built-in http request tools:
> ./s-post http://localhost:3030/ds/data
> This works great except now I want to expose this port so that other people
> can query the dataset. However, I don't want to allow people to update or
> change the database, I just want them to be able to use and query the
> information I originally loaded into the data base.
> According to the documentation
> (http://jena.apache.org/documentation/serving_data/), I can make the
> database read-only by starting it without the update option.
>> Data can be updated without access control if the server is started with the
>> --update argument. If started without that argument, data is read-only.
>
> But when I start the database this way, I am no longer able to populate with
> the initial dataset.
> So, MY QUESTION: How I start an in-memory Fuseki database which I can
> populate with my original dataset but then disallow further http updates.
> (My guess is that I need another method to populate the Fueseki database
> that is not using the http protocol. But I'm not sure)
>
>
> I posted this question on StackOverflow as well:
> http://stackoverflow.com/questions/29214852/how-to-start-apache-jena-fuseki-
> as-read-only-service-but-also-initially-populat
> Thanks for your help.
>

Jeffrey,

I can think of a couple of options:

1/ Use TDB tools to build a database offline and then start the server 
read only on that TDB database.

2/ Like (1) but use --update to build a persistent database, then stop 
the server, and restart without --update.  The database is now read 
only.  --update affects the services available and does not affect the 
data in any other way.

Having a persistent database has the huge advantage that you can start 
and stop the server without needing to reload data.

3/ Use a web server to pass through query requests to the fuseki server 
and limit the Fuseki server to talk to only localhost.  You can update 
from the local machine, external people can't.

4/ Use Fuseki2 and adjust the security settings to allow update only 
from localhost but query from anywhere.

What you can't do is update a TDB database currently being served by Fuseki.

	Andy