org.topbraid.spin.system
Class SPINImports

java.lang.Object
  extended by org.topbraid.spin.system.SPINImports

public class SPINImports
extends java.lang.Object

A singleton managing spin:imports. Subclasses can be installed that implement different loaders or otherwise change the default behavior.

Author:
Holger Knublauch

Field Summary
static SPINImports singleton
           
 
Constructor Summary
SPINImports()
           
 
Method Summary
static SPINImports get()
          Gets the singleton instance of this class.
protected  Graph getImportedGraph(java.lang.String uri)
          Attempts to load a graph with a given URI.
 Model getImportsModel(Model model)
          Checks if spin:imports have been declared and adds them to a union model.
static void set(SPINImports value)
          Installs a different SPINImports singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

public static SPINImports singleton
Constructor Detail

SPINImports

public SPINImports()
Method Detail

get

public static SPINImports get()
Gets the singleton instance of this class.

Returns:
the singleton

getImportedGraph

protected Graph getImportedGraph(java.lang.String uri)
                          throws java.io.IOException
Attempts to load a graph with a given URI. In the default implementation, this uses the Jena OntDocumentManager and default loading mechanisms. Subclasses can override this.

Parameters:
uri - the base URI of the graph to load
Returns:
the Graph or null to ignore this
Throws:
java.io.IOException

getImportsModel

public Model getImportsModel(Model model)
                      throws java.io.IOException
Checks if spin:imports have been declared and adds them to a union model. Will also register any SPIN modules defined in those imports that haven't been loaded before.

Parameters:
model - the base Model to operate on
Returns:
either model or the union of model and its spin:imports
Throws:
java.io.IOException

set

public static void set(SPINImports value)
Installs a different SPINImports singleton.

Parameters:
value - the new singleton