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 C. Witt" <je...@gmail.com> on 2018/02/11 13:06:01 UTC

setting default graph to be sum of named graphs

Dear All

This is a follow up to my earlier question (See forwarded message below)

The answer to my earlier question seems to be that I needed to start using
"named graphs".

My follow up question is the following:

I currently have hundreds of SPARQL queries written for the default graph.

If I start segmenting the default graph into named graphs, in order to
facilitate easier updating and replacement of select triples, can I
continue to use to my existing SPARQL queries which treat all the triples
in the TDB as one giant default graph.

In other words, I'd like to continue to be able to write SPARQL queries
that apply to the entire dataset, despite having divided these triples into
different names graphs.

On the internet I've seen some suggestions that this might be possible:

See for example:
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.rdf.doc/doc/c0060619.html

Thanks for any help you can provide.

---

*Begin earlier question below.*

*---*

From: "Jeffrey C. Witt" <je...@gmail.com>
To: users@jena.apache.org
Cc:
Bcc:
Date: Fri, 9 Feb 2018 14:31:53 -0500
Subject: Updating triples that originate from a specific named file.
I have a question about updating triples in TDB via Fueseki.

I have a work flow where I automatically build tripes through an
aggregator.

The results of this aggregation get stored in various named static files.

I then use then the "./s-post" command to add each of these files to TDB.

The static files get changed at different times depending on the rate of
updates further on upstream, and thus I'm wondering if there is a way to
update TDB by replacing only the triples that were ingested from a
particular file with the triples from the updated file.

Perhaps an example will help.

Suppose I have files A.rdf, B.rdf, and C.rdf.

On the initial build, I load all three files into TDB as follows:

./bin/s-post http://localhost:3030/ds/data default A.rdf
./bin/s-post http://localhost:3030/ds/data default B.rdf
./bin/s-post http://localhost:3030/ds/data default C.rdf

Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.

At the present, I'm creating an entirely new build by reloading all three
files in the same manner.

But as the number of files increases, each re-build takes a while.

I would prefer to be able to remove only the triples that were originally
added to the database from file C.rdf with the triples from the new,
updated, C.rdf file, leaving the triples that originated from A.rdf and
B.rdf untouched.

using ./s-post on the updated C.rdf file just adds the new triples
alongside the old ones
and
using ./s-update replaces the entire graph (including the triples from
files A and B) with the triples from the updated C.rdf file.

I'm not sure if this is possible, but I wanted to check before I continued
my practice or consider other solutions.

Many thanks for any assistance you can offer.
Jeff

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


---------- Forwarded message ----------
From: "Martynas Jusevičius" <ma...@atomgraph.com>
To: jena-users-ml <us...@jena.apache.org>
Cc:
Bcc:
Date: Fri, 9 Feb 2018 22:36:03 +0100
Subject: Re: Updating triples that originate from a specific named file.
I think what you want is to import each RDF document into a named graph and
then do Graph Store Protocol PUT with the graph URI:
https://www.w3.org/TR/sparql11-http-rdf-update/#http-put

On Fri, Feb 9, 2018 at 8:31 PM, Jeffrey C. Witt <je...@gmail.com>
wrote:

> I have a question about updating triples in TDB via Fueseki.
>
> I have a work flow where I automatically build tripes through an
> aggregator.
>
> The results of this aggregation get stored in various named static files.
>
> I then use then the "./s-post" command to add each of these files to TDB.
>
> The static files get changed at different times depending on the rate of
> updates further on upstream, and thus I'm wondering if there is a way to
> update TDB by replacing only the triples that were ingested from a
> particular file with the triples from the updated file.
>
> Perhaps an example will help.
>
> Suppose I have files A.rdf, B.rdf, and C.rdf.
>
> On the initial build, I load all three files into TDB as follows:
>
> ./bin/s-post http://localhost:3030/ds/data default A.rdf
> ./bin/s-post http://localhost:3030/ds/data default B.rdf
> ./bin/s-post http://localhost:3030/ds/data default C.rdf
>
> Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.
>
> At the present, I'm creating an entirely new build by reloading all three
> files in the same manner.
>
> But as the number of files increases, each re-build takes a while.
>
> I would prefer to be able to remove only the triples that were originally
> added to the database from file C.rdf with the triples from the new,
> updated, C.rdf file, leaving the triples that originated from A.rdf and
> B.rdf untouched.
>
> using ./s-post on the updated C.rdf file just adds the new triples
> alongside the old ones
> and
> using ./s-update replaces the entire graph (including the triples from
> files A and B) with the triples from the updated C.rdf file.
>
> I'm not sure if this is possible, but I wanted to check before I continued
> my practice or consider other solutions.
>
> Many thanks for any assistance you can offer.
> Jeff
>
> --
> Dr. Jeffrey C. Witt
> Philosophy Department
> Loyola University Maryland
> 4501 N. Charles St.
> Baltimore, MD 21210
> www.jeffreycwitt.com
>


---------- Forwarded message ----------
From: "Martynas Jusevičius" <ma...@atomgraph.com>
To: jena-users-ml <us...@jena.apache.org>
Cc:
Bcc:
Date: Fri, 9 Feb 2018 22:38:34 +0100
Subject: Re: Updating triples that originate from a specific named file.
Which is s-put in Jena:
https://jena.apache.org/documentation/fuseki2/soh.html#soh-sparql-http

On Fri, Feb 9, 2018 at 10:36 PM, Martynas Jusevičius <martynas@atomgraph.com
> wrote:

> I think what you want is to import each RDF document into a named graph
> and then do Graph Store Protocol PUT with the graph URI:
> https://www.w3.org/TR/sparql11-http-rdf-update/#http-put
>
> On Fri, Feb 9, 2018 at 8:31 PM, Jeffrey C. Witt <je...@gmail.com>
> wrote:
>
>> I have a question about updating triples in TDB via Fueseki.
>>
>> I have a work flow where I automatically build tripes through an
>> aggregator.
>>
>> The results of this aggregation get stored in various named static files.
>>
>> I then use then the "./s-post" command to add each of these files to TDB.
>>
>> The static files get changed at different times depending on the rate of
>> updates further on upstream, and thus I'm wondering if there is a way to
>> update TDB by replacing only the triples that were ingested from a
>> particular file with the triples from the updated file.
>>
>> Perhaps an example will help.
>>
>> Suppose I have files A.rdf, B.rdf, and C.rdf.
>>
>> On the initial build, I load all three files into TDB as follows:
>>
>> ./bin/s-post http://localhost:3030/ds/data default A.rdf
>> ./bin/s-post http://localhost:3030/ds/data default B.rdf
>> ./bin/s-post http://localhost:3030/ds/data default C.rdf
>>
>> Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.
>>
>> At the present, I'm creating an entirely new build by reloading all three
>> files in the same manner.
>>
>> But as the number of files increases, each re-build takes a while.
>>
>> I would prefer to be able to remove only the triples that were originally
>> added to the database from file C.rdf with the triples from the new,
>> updated, C.rdf file, leaving the triples that originated from A.rdf and
>> B.rdf untouched.
>>
>> using ./s-post on the updated C.rdf file just adds the new triples
>> alongside the old ones
>> and
>> using ./s-update replaces the entire graph (including the triples from
>> files A and B) with the triples from the updated C.rdf file.
>>
>> I'm not sure if this is possible, but I wanted to check before I
continued
>> my practice or consider other solutions.
>>
>> Many thanks for any assistance you can offer.
>> Jeff
>>
>> --
>> Dr. Jeffrey C. Witt
>> Philosophy Department
>> Loyola University Maryland
>> 4501 N. Charles St.
>> Baltimore, MD 21210
>> www.jeffreycwitt.com
>>
>
>


---------- Forwarded message ----------
From: "Berkin Özdemir Bengisu" <be...@gmail.com>
To: users@jena.apache.org
Cc:
Bcc:
Date: Sat, 10 Feb 2018 22:09:51 +0200
Subject: Query Builder Debugging
Hello,

I extended the sparql grammar with new keywords and now I would like to add
those keywords to the query.  I tried to debug through a basic select query
to understand how the query is built.

For example: After the method below "SELECT"  is added to the query

getQuery().setQuerySelectType() ;

but the function only sets the type to a constant value,

public void setQuerySelectType()  { queryType = QueryTypeSelect ; }

I couldn't manage to see how it is added, probably using the querybuilder
module right? Could you please explain how it is added? Thanks a alot for
the help!

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

Re: setting default graph to be sum of named graphs

Posted by ajs6f <aj...@apache.org>.
You can use SPARQL Query's FROM keyword to merge a certain set of named graphs into the default graph in the in-scope dataset for a given query:

https://www.w3.org/TR/sparql11-query/#specifyingDataset

which is extremely flexible and useful.

If you are using a TDB1 backend, you have some other TDB-specific choices.

If you _always_ want the default graph to be the union of the named graphs (and nothing but) you can use TDB's union graph function:

https://jena.apache.org/documentation/tdb/configuration.html#tdb-configuration-symbols
https://jena.apache.org/documentation/tdb/assembler.html#union-default-graph

or you can do the same for a single query:

https://jena.apache.org/documentation/tdb/datasets.html#dataset-query

or access the union graph via special graph name:

https://jena.apache.org/documentation/tdb/datasets.html#special-graph-names

---
A. Soroka
Research Computing : Office of the CIO : the Smithsonian Institution

> On Feb 11, 2018, at 8:06 AM, Jeffrey C. Witt <je...@gmail.com> wrote:
> 
> Dear All
> 
> This is a follow up to my earlier question (See forwarded message below)
> 
> The answer to my earlier question seems to be that I needed to start using
> "named graphs".
> 
> My follow up question is the following:
> 
> I currently have hundreds of SPARQL queries written for the default graph.
> 
> If I start segmenting the default graph into named graphs, in order to
> facilitate easier updating and replacement of select triples, can I
> continue to use to my existing SPARQL queries which treat all the triples
> in the TDB as one giant default graph.
> 
> In other words, I'd like to continue to be able to write SPARQL queries
> that apply to the entire dataset, despite having divided these triples into
> different names graphs.
> 
> On the internet I've seen some suggestions that this might be possible:
> 
> See for example:
> https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.rdf.doc/doc/c0060619.html
> 
> Thanks for any help you can provide.
> 
> ---
> 
> *Begin earlier question below.*
> 
> *---*
> 
> From: "Jeffrey C. Witt" <je...@gmail.com>
> To: users@jena.apache.org
> Cc:
> Bcc:
> Date: Fri, 9 Feb 2018 14:31:53 -0500
> Subject: Updating triples that originate from a specific named file.
> I have a question about updating triples in TDB via Fueseki.
> 
> I have a work flow where I automatically build tripes through an
> aggregator.
> 
> The results of this aggregation get stored in various named static files.
> 
> I then use then the "./s-post" command to add each of these files to TDB.
> 
> The static files get changed at different times depending on the rate of
> updates further on upstream, and thus I'm wondering if there is a way to
> update TDB by replacing only the triples that were ingested from a
> particular file with the triples from the updated file.
> 
> Perhaps an example will help.
> 
> Suppose I have files A.rdf, B.rdf, and C.rdf.
> 
> On the initial build, I load all three files into TDB as follows:
> 
> ./bin/s-post http://localhost:3030/ds/data default A.rdf
> ./bin/s-post http://localhost:3030/ds/data default B.rdf
> ./bin/s-post http://localhost:3030/ds/data default C.rdf
> 
> Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.
> 
> At the present, I'm creating an entirely new build by reloading all three
> files in the same manner.
> 
> But as the number of files increases, each re-build takes a while.
> 
> I would prefer to be able to remove only the triples that were originally
> added to the database from file C.rdf with the triples from the new,
> updated, C.rdf file, leaving the triples that originated from A.rdf and
> B.rdf untouched.
> 
> using ./s-post on the updated C.rdf file just adds the new triples
> alongside the old ones
> and
> using ./s-update replaces the entire graph (including the triples from
> files A and B) with the triples from the updated C.rdf file.
> 
> I'm not sure if this is possible, but I wanted to check before I continued
> my practice or consider other solutions.
> 
> Many thanks for any assistance you can offer.
> Jeff
> 
> --
> Dr. Jeffrey C. Witt
> Philosophy Department
> Loyola University Maryland
> 4501 N. Charles St.
> Baltimore, MD 21210
> www.jeffreycwitt.com
> 
> 
> ---------- Forwarded message ----------
> From: "Martynas Jusevičius" <ma...@atomgraph.com>
> To: jena-users-ml <us...@jena.apache.org>
> Cc:
> Bcc:
> Date: Fri, 9 Feb 2018 22:36:03 +0100
> Subject: Re: Updating triples that originate from a specific named file.
> I think what you want is to import each RDF document into a named graph and
> then do Graph Store Protocol PUT with the graph URI:
> https://www.w3.org/TR/sparql11-http-rdf-update/#http-put
> 
> On Fri, Feb 9, 2018 at 8:31 PM, Jeffrey C. Witt <je...@gmail.com>
> wrote:
> 
>> I have a question about updating triples in TDB via Fueseki.
>> 
>> I have a work flow where I automatically build tripes through an
>> aggregator.
>> 
>> The results of this aggregation get stored in various named static files.
>> 
>> I then use then the "./s-post" command to add each of these files to TDB.
>> 
>> The static files get changed at different times depending on the rate of
>> updates further on upstream, and thus I'm wondering if there is a way to
>> update TDB by replacing only the triples that were ingested from a
>> particular file with the triples from the updated file.
>> 
>> Perhaps an example will help.
>> 
>> Suppose I have files A.rdf, B.rdf, and C.rdf.
>> 
>> On the initial build, I load all three files into TDB as follows:
>> 
>> ./bin/s-post http://localhost:3030/ds/data default A.rdf
>> ./bin/s-post http://localhost:3030/ds/data default B.rdf
>> ./bin/s-post http://localhost:3030/ds/data default C.rdf
>> 
>> Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.
>> 
>> At the present, I'm creating an entirely new build by reloading all three
>> files in the same manner.
>> 
>> But as the number of files increases, each re-build takes a while.
>> 
>> I would prefer to be able to remove only the triples that were originally
>> added to the database from file C.rdf with the triples from the new,
>> updated, C.rdf file, leaving the triples that originated from A.rdf and
>> B.rdf untouched.
>> 
>> using ./s-post on the updated C.rdf file just adds the new triples
>> alongside the old ones
>> and
>> using ./s-update replaces the entire graph (including the triples from
>> files A and B) with the triples from the updated C.rdf file.
>> 
>> I'm not sure if this is possible, but I wanted to check before I continued
>> my practice or consider other solutions.
>> 
>> Many thanks for any assistance you can offer.
>> Jeff
>> 
>> --
>> Dr. Jeffrey C. Witt
>> Philosophy Department
>> Loyola University Maryland
>> 4501 N. Charles St.
>> Baltimore, MD 21210
>> www.jeffreycwitt.com
>> 
> 
> 
> ---------- Forwarded message ----------
> From: "Martynas Jusevičius" <ma...@atomgraph.com>
> To: jena-users-ml <us...@jena.apache.org>
> Cc:
> Bcc:
> Date: Fri, 9 Feb 2018 22:38:34 +0100
> Subject: Re: Updating triples that originate from a specific named file.
> Which is s-put in Jena:
> https://jena.apache.org/documentation/fuseki2/soh.html#soh-sparql-http
> 
> On Fri, Feb 9, 2018 at 10:36 PM, Martynas Jusevičius <martynas@atomgraph.com
>> wrote:
> 
>> I think what you want is to import each RDF document into a named graph
>> and then do Graph Store Protocol PUT with the graph URI:
>> https://www.w3.org/TR/sparql11-http-rdf-update/#http-put
>> 
>> On Fri, Feb 9, 2018 at 8:31 PM, Jeffrey C. Witt <je...@gmail.com>
>> wrote:
>> 
>>> I have a question about updating triples in TDB via Fueseki.
>>> 
>>> I have a work flow where I automatically build tripes through an
>>> aggregator.
>>> 
>>> The results of this aggregation get stored in various named static files.
>>> 
>>> I then use then the "./s-post" command to add each of these files to TDB.
>>> 
>>> The static files get changed at different times depending on the rate of
>>> updates further on upstream, and thus I'm wondering if there is a way to
>>> update TDB by replacing only the triples that were ingested from a
>>> particular file with the triples from the updated file.
>>> 
>>> Perhaps an example will help.
>>> 
>>> Suppose I have files A.rdf, B.rdf, and C.rdf.
>>> 
>>> On the initial build, I load all three files into TDB as follows:
>>> 
>>> ./bin/s-post http://localhost:3030/ds/data default A.rdf
>>> ./bin/s-post http://localhost:3030/ds/data default B.rdf
>>> ./bin/s-post http://localhost:3030/ds/data default C.rdf
>>> 
>>> Now suppose that C.rdf changes. But A.rdf and B.rdf remain the same.
>>> 
>>> At the present, I'm creating an entirely new build by reloading all three
>>> files in the same manner.
>>> 
>>> But as the number of files increases, each re-build takes a while.
>>> 
>>> I would prefer to be able to remove only the triples that were originally
>>> added to the database from file C.rdf with the triples from the new,
>>> updated, C.rdf file, leaving the triples that originated from A.rdf and
>>> B.rdf untouched.
>>> 
>>> using ./s-post on the updated C.rdf file just adds the new triples
>>> alongside the old ones
>>> and
>>> using ./s-update replaces the entire graph (including the triples from
>>> files A and B) with the triples from the updated C.rdf file.
>>> 
>>> I'm not sure if this is possible, but I wanted to check before I
> continued
>>> my practice or consider other solutions.
>>> 
>>> Many thanks for any assistance you can offer.
>>> Jeff
>>> 
>>> --
>>> Dr. Jeffrey C. Witt
>>> Philosophy Department
>>> Loyola University Maryland
>>> 4501 N. Charles St.
>>> Baltimore, MD 21210
>>> www.jeffreycwitt.com
>>> 
>> 
>> 
> 
> 
> ---------- Forwarded message ----------
> From: "Berkin Özdemir Bengisu" <be...@gmail.com>
> To: users@jena.apache.org
> Cc:
> Bcc:
> Date: Sat, 10 Feb 2018 22:09:51 +0200
> Subject: Query Builder Debugging
> Hello,
> 
> I extended the sparql grammar with new keywords and now I would like to add
> those keywords to the query.  I tried to debug through a basic select query
> to understand how the query is built.
> 
> For example: After the method below "SELECT"  is added to the query
> 
> getQuery().setQuerySelectType() ;
> 
> but the function only sets the type to a constant value,
> 
> public void setQuerySelectType()  { queryType = QueryTypeSelect ; }
> 
> I couldn't manage to see how it is added, probably using the querybuilder
> module right? Could you please explain how it is added? Thanks a alot for
> the help!
> 
> -- 
> Dr. Jeffrey C. Witt
> Philosophy Department
> Loyola University Maryland
> 4501 N. Charles St.
> Baltimore, MD 21210
> www.jeffreycwitt.com