org.topbraid.core.registry
Interface IGraphRegistry

All Known Implementing Classes:
GraphRegistry

public interface IGraphRegistry

An interface for objects that manage the currently open (Jena) Graphs in the system. There is one global graph registry in any TopBraid application, accessible via TB.getGraphRegistry(). Graphs are identified by their base URI, and are stored together with their source (an IFile, java.io.File or URL). Note that the graph registry stores the "base" graphs only. These are either the graph as loaded from a storage device, or a CachingGraph that wraps it. If your application depends on other delegating graphs (e.g. to implement buffering), then the corresponding methods will automatically get to the base delegate of the Graph delegation chains.

Author:
Holger Knublauch

Method Summary
 void addListener(IGraphRegistryListener listener)
           
 void dispose()
           
 com.hp.hpl.jena.graph.Graph getBaseGraph(java.net.URI baseURI)
           
 java.net.URI getBaseURI(java.io.File file)
           
 java.net.URI getBaseURI(com.hp.hpl.jena.graph.Graph graph)
           
 java.net.URI getBaseURI(org.eclipse.core.resources.IFile file)
           
 com.hp.hpl.jena.rdf.model.Model getConfigModel(java.net.URI baseURI)
          Gets the configuration Model that holds metadata for a given Model.
 com.hp.hpl.jena.ontology.OntModel getConfigOntModel(java.net.URI baseURI)
          Gets the OntModel that contains all configuration models of subgraphs as well as the base config model and system configuration models.
 java.net.URI getImportBaseURI(java.net.URI importedURI)
          Gets the base URI of an ontology specified by an import statement.
 java.lang.Object getSource(java.net.URI baseURI)
          Gets the source where a Graph (represented by its base URI) has been loaded from.
 boolean isDirty(com.hp.hpl.jena.graph.Graph graph)
           
 boolean isMemoryGraph(com.hp.hpl.jena.graph.Graph graph)
           
 java.util.Iterator<java.net.URI> listURIs()
          Lists the URIs of all currently loaded graphs.
 com.hp.hpl.jena.graph.Graph register(java.net.URI baseURI, com.hp.hpl.jena.graph.Graph baseGraph, java.lang.Object source, org.eclipse.core.runtime.IProgressMonitor monitor)
          Registers a given Graph.
 void removeListener(IGraphRegistryListener listener)
           
 void replaceBaseURI(java.net.URI oldURI, java.net.URI newURI)
           
 void setDirty(com.hp.hpl.jena.graph.Graph graph, boolean value)
           
 void setSource(java.net.URI baseURI, java.lang.Object source)
           
 void unregister(java.net.URI baseURI)
           
 

Method Detail

addListener

void addListener(IGraphRegistryListener listener)

dispose

void dispose()

getBaseGraph

com.hp.hpl.jena.graph.Graph getBaseGraph(java.net.URI baseURI)

getBaseURI

java.net.URI getBaseURI(java.io.File file)

getBaseURI

java.net.URI getBaseURI(org.eclipse.core.resources.IFile file)

getBaseURI

java.net.URI getBaseURI(com.hp.hpl.jena.graph.Graph graph)

getConfigModel

com.hp.hpl.jena.rdf.model.Model getConfigModel(java.net.URI baseURI)
Gets the configuration Model that holds metadata for a given Model. Note: This is work in progress and should not be used yet externally.

Parameters:
baseURI - the URI to get the config Model for
Returns:
the Config Model or null for any unregistered baseURI

getConfigOntModel

com.hp.hpl.jena.ontology.OntModel getConfigOntModel(java.net.URI baseURI)
Gets the OntModel that contains all configuration models of subgraphs as well as the base config model and system configuration models.

Parameters:
baseURI - the URI to get the OntModel for
Returns:
the Config Model or null for any unregistered baseURI

getImportBaseURI

java.net.URI getImportBaseURI(java.net.URI importedURI)
Gets the base URI of an ontology specified by an import statement. This will first check if the URI is already registered in this ModelRegistry, e.g. when it has been loaded from a file. Otherwise, the method will resolve the URI into a URL and consult the URLRegistry to determine whether the URL can be opened to find a declared xml:base.

Parameters:
importedURI - the imported URI (object of an owl:imports statement)
Returns:
the URI (often identical to importedURI)

getSource

java.lang.Object getSource(java.net.URI baseURI)
Gets the source where a Graph (represented by its base URI) has been loaded from. If the model was loaded using the ModelLoader, then this will return one of:

Parameters:
baseURI - the base URI of the model
Returns:
the source (IFile, java.io.File, or URL) or null

isDirty

boolean isDirty(com.hp.hpl.jena.graph.Graph graph)

isMemoryGraph

boolean isMemoryGraph(com.hp.hpl.jena.graph.Graph graph)

listURIs

java.util.Iterator<java.net.URI> listURIs()
Lists the URIs of all currently loaded graphs.

Returns:
the open graph URIs

register

com.hp.hpl.jena.graph.Graph register(java.net.URI baseURI,
                                     com.hp.hpl.jena.graph.Graph baseGraph,
                                     java.lang.Object source,
                                     org.eclipse.core.runtime.IProgressMonitor monitor)
Registers a given Graph. This method is usually called directly after a Graph has been loaded, to announce it to the global registry. If the base Graph is not a memory graph, an implementation may create a delegating CachingGraph and use this instead of the base Graph. This is done in the default implementation - the new graph is then returned.

Parameters:
baseURI - the base URI to register the new graph under
baseGraph - the base "raw" Graph
source - the source where the graph has been loaded from
monitor - an optional progress monitor (if caches are built up)
Returns:
either baseGraph or a CachingGraph that wraps it

removeListener

void removeListener(IGraphRegistryListener listener)

replaceBaseURI

void replaceBaseURI(java.net.URI oldURI,
                    java.net.URI newURI)

setDirty

void setDirty(com.hp.hpl.jena.graph.Graph graph,
              boolean value)

setSource

void setSource(java.net.URI baseURI,
               java.lang.Object source)

unregister

void unregister(java.net.URI baseURI)