Removing all triples in a named graph from java

8 views
Skip to first unread message

Håvard Ottestad

unread,
Jan 18, 2017, 5:07:55 AM1/18/17
to Stardog
Hi,

I'm trying to remove alle the triples in a named graph from Java, but it seems to delete everything in stardog instead.

This is the code I'm using:

connection.remove().context(namedGraph).all();

I can't use SPARQL, because I need to add more data within the same transaction afterwards.

Essentially what I'm trying to do is an upload-and-replace for a named graph.

Cheers,
Håvard M. Ottestad

Michael Grove

unread,
Jan 18, 2017, 7:09:31 AM1/18/17
to stardog
On Wed, Jan 18, 2017 at 5:07 AM, Håvard Ottestad <hmott...@gmail.com> wrote:
Hi,

I'm trying to remove alle the triples in a named graph from Java, but it seems to delete everything in stardog instead.

This is the code I'm using:

connection.remove().context(namedGraph).all();


This removes both the context (via `context`) and the entire database (via `all`).

Cheers,

Mike
 
I can't use SPARQL, because I need to add more data within the same transaction afterwards.

Essentially what I'm trying to do is an upload-and-replace for a named graph.

Cheers,
Håvard M. Ottestad

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+unsubscribe@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Håvard Ottestad

unread,
Jan 18, 2017, 9:39:29 AM1/18/17
to Stardog
Thanks Mike, got it to work now.

Doesn't seem quite consistent with how the getter works.  

connection.get().context(namedGraph) doesn't actually get anything, but returns a getter that you can keep working on. So when the remover returns a remover object, it makes it feel like it's expecting more calls. 

Getter builds with what feels like chained filters, while the remover doesn't.

Cheers,
Håvard

Michael Grove

unread,
Jan 18, 2017, 10:33:46 AM1/18/17
to stardog
That's fair criticism. As I mentioned in the blog yesterday [1], we're revisiting the design of the SNARL API, so this is something I'll try to take into consideration as we iterate on it internally.

Cheers,

Mike

 

Cheers,
Håvard
Reply all
Reply to author
Forward
0 new messages