Local Storage Frequently Asked questions

Getting models, opening and closing them

RDF2Go modelsets and models have to be open to use them, and have to be closed at one point to free system resources. There are two differnt cases about opening and closing them:

Using Models of the RdfRepository: a ModelSet retrieved from the RdfRepository is always open. The RdfRepository will close it on shutdown. You must not close modelsets retrieved from RdfRepository. Example:

ModelSet main = nepomukservices.getRdfRepository().getMain();
main.sparqlSelect("Select..."); // works, its open
// you don't close main, RdfRepository will close it on shutdown
Model mycontext = main.getModel("http://.....mycontexturi");
// mycontext should be open, if not, its an rdf2go bug we didn't fix....
mycontext.sparqlSelect("Select..."); //works
// you don't close mycontext

Using in-memory temporary models: a ModelSet retrieved from RDF2Go using the ModelFactory. The creator of the ModelSet must open it immediately after creation and the same class responsible for creating the ModelSet should also be responsible for closing it. If the ModelSet? is passed around as parameter, the method documentations must contain rules how to dispose it. Example:

/**
 * represents some data in-memory, opens and closes model on itself
 */
class MyData {
  ModelSet modelset;
  public MyData() {
    modelset = RDF2Go.getModelFactory().createModelSet();
    modelset.open();
  }
  public String readvalue() {
    return RDFTool.readSingleValueString(modelset, "uri:test", RDFS.label);
  }
  public dispose() {
    if (modelset!=null) {
      modelset.close(); modelset = null;
    }
  }
}
/** 
 * loads some data and returns a modelset, gives instructions what to do 
 */
class MyDataLoader {
  /**
   * Loads a model from file. The returned modelset must be closed by the 
   * caller using the close() mehtod.
   * @return a ModelSet, must be closed by the caller.
   */
  public ModelSet loadConfigA(String fromFile) {
    ModelSet result = RDF2Go.getModelFactory().createModelSet();
    result.open();
    result.read(new FileInputStream(fromFile));
    // do NOT close the model now, otherwise the return value is useless
    return result;
  }

Where is the data stored?

see data storage folder on the RdfRepository page and also DataFolder for background information.

My store is gone after I restart Nepomuk

  • maybe you are using eclipse to start nepomuk and the "clear configuration when starting" option was checked. that wipes nepomuk before each start.
  • maybe you didn't shutdown nepomuk correctly and the store got corrupted. When running command-line, enter "close" into OSGi, otherwise use the appropriate shutdown method

My store is full of bad data, how can I nuke it?

There is a red button on the lower end of the RDF Repository debug interface area, its linked from the start page:

How is the data organised in the RDFRepo

Usage conventions proposed by DFKI:

We have the idea that each "edit" done is stored in a separate graph, allowing us to annotate this graph with user/date/application and other provenance data. i.e. I start Nepomuk, create a new person "Dirk" and "save". this becomes one graph. Later I reopen this, edit it and add a workplace homepage and email address, when I "save" (think 'click apply') this is saved in another graph.

Queries query usally a whole ModelSet?. PimoService and LuceneSAIL both ignore context.

Would it be better to put crawled (=dirty) RDF in another repo?

  • Perhaps (this was done in gnowsis), but then you have the issue of "rebirth", i.e. mapping from the dirty data to your pimo. You do want some of the things that are crawled to also appear in the user interface

Where do I config where what kind of inferencing and/or lucene indexing takes place? Is it globally, or for feach ModelSet? or for each Model?

  • It is global. It is done in an XML file in the rdfrepository bundle. This is maybe not ideal, it should perhaps be possible to disable inference/indexing for certain graphs.

How can I backup / restore data?

How can I save / load data? Import/Export?

There is no consistent way (yet) to do this. Most data is stored in the RDFRepository. Replacing the data in this store will suffice for restoring. Note that when you restore, you must not restart nepomuk between deleting the data and loading it (when it finds an empty store on startup, it will load some default data). There are multiple ways you can backup (and restore data).

  • Backup using the file folders: copy the folder from the harddisk to a save place while NEPOMUK does not run. (look for other answers about where it stores it)
  • Backup by dumping the whole repository via the web interface. Use WGET or some other stable technology to do this - the repository may be very big.