jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Budinsky <>
Subject Problem replacing graph
Date Tue, 01 Feb 2011 14:47:10 GMT

Hi All,

I'm having trouble doing a fairly straightforward operation in Jena, which
probably just means I'm doing something wrong. I'm trying to add or replace
a resource (as a graph) in my dataset. The code I wrote looks something
like this:

      protected Resource addOrReplaceResource(Dataset dataset, String
resourceURI, InputStream instream)
            Resource resource = dataset.containsNamedModel(resourceURI) ?
(resourceURI) : null;
            if (resource != null)
            Model model = dataset.getNamedModel(resourceURI);
  , null);
            resource = model.getResource(resourceURI);
            return resource;

When a resourceURI is added for the first time, it works fine but when
replacing a graph the call to removeGraph() seems to wipe out the entire
dataset. The only thing left in the dataset after that is the single
resource which gets added after the removeGraph call.

Is there something obvious that I'm doing wrong here?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message