On 14/04/13 15:36, Site Guo wrote:
Is there an API function that lists all models (graphs) within a given dataset?

There is a function listNames() in Dataset. I am not sure if it is used to 
return all named graphs. When I tried to use it like this:

Iterator<String> models = ds.listNames(); //ds is a dataset object that has 
been created and connected.
while (models.hasNext())
{
      System.out.println(models.next());
}

  Java gave me the following error:


Exception in thread "main" java.lang.NullPointerException
     at com.hp.hpl.jena.sparql.util.NodeUtils$1.accept(NodeUtils.java:94)
     at com.hp.hpl.jena.sparql.util.NodeUtils$1.accept(NodeUtils.java:90)
     at 
com.hp.hpl.jena.util.iterator.MapFilterIterator.hasNext(MapFilterIterator.java:55)

I am using TDB.

Could anyone help me figure that out ?
Thanks in advance.

Hi,

I checked it works for me (Jena 2.10.1 development, TDB 0.10.1 development).

A way this can occur is a corrupted database by non-transactional use then exiting the JVM without sync'ing the database.

Which version are you running>

        Andy


Site (Victor) Guo

                                        


Reply via email to