org.topbraidcomposer.core.session
Class TBCSession

java.lang.Object
  extended by org.topbraid.core.session.AbstractSession
      extended by org.topbraidcomposer.core.session.TBCSession
All Implemented Interfaces:
IChangeEngineListener, IModelSelection, IResourceSelection, ISession

public class TBCSession
extends AbstractSession
implements IChangeEngineListener, ISession


Field Summary
static java.util.List<com.hp.hpl.jena.graph.Graph> deletableGraphs
           
 
Fields inherited from class org.topbraid.core.session.AbstractSession
baseURI
 
Constructor Summary
TBCSession()
           
 
Method Summary
 void changeOperationPerformed(ChangeOperation operation, boolean undone)
          Checks if the currently selected resource has been deleted as a result of a ModelOperation.
 com.hp.hpl.jena.rdf.model.Model ensureBaseModelExists(java.net.URI baseURI)
          Manually ensures that a Model has been instantiated and registered for a given base URI/Graph combination.
 com.hp.hpl.jena.rdf.model.Model getBaseModel(com.hp.hpl.jena.graph.Graph graph)
          Gets the base model used for a given graph in this session.
 com.hp.hpl.jena.rdf.model.Model getBaseModel(com.hp.hpl.jena.ontology.OntModel ontModel)
           
 com.hp.hpl.jena.rdf.model.Model getBaseModel(java.net.URI baseURI)
          Gets the current base Model for a given base URI, if one is loaded.
 IChangeEngine getChangeEngine()
          Gets the session's change engine.
 com.hp.hpl.jena.rdf.model.Model getInferenceModel(com.hp.hpl.jena.ontology.OntModel ontModel)
           
 com.hp.hpl.jena.ontology.OntModel getOntModel(java.net.URI baseURI)
          Gets the OntModel that has been associated with a given base URI in this session.
 com.hp.hpl.jena.rdf.model.Model getSystemModel(com.hp.hpl.jena.ontology.OntModel ontModel)
           
 void graphChangePerformed()
          Notifies the receiver that a global change to the current model has been performed.
 void graphDirty(com.hp.hpl.jena.graph.Graph graph)
          Called when a Graph has been set to dirty.
 void initChangeEngine(TBCChangeEngine changeEngine)
           
 boolean isDeletable(com.hp.hpl.jena.rdf.model.Statement statement)
          Checks whether a given Statement can be deleted, i.e.
 boolean isEditable(java.net.URI baseURI)
           
 boolean isVisible(com.hp.hpl.jena.rdf.model.Resource resource)
          Checks if a given Resource is visible for this session.
static java.util.Iterator<com.hp.hpl.jena.graph.Graph> listDeletableGraphs()
           
 java.util.Iterator<com.hp.hpl.jena.rdf.model.Model> listModels()
           
 void registerBaseModel(java.net.URI baseURI, com.hp.hpl.jena.rdf.model.Model baseModel)
           
 void replaceBaseURI(java.net.URI oldURI, java.net.URI newURI)
           
static void resetDeletableGraphs()
           
 void unregisterBaseModel(java.net.URI baseURI)
           
static void updateDeletableGraphs()
           
 
Methods inherited from class org.topbraid.core.session.AbstractSession
addModelSelectionListener, addResourceSelectionListener, getNode, getNodeId, getNodeIdMap, getPreviouslySelectedBaseURI, getPreviouslySelectedResource, getResource, getRuntimeObject, getSelectedBaseModel, getSelectedBaseURI, getSelectedOntModel, getSelectedResource, isFastModelSelected, notifyModelSelectionListeners, removeModelSelectionListener, removeResourceSelectionListener, setRuntimeObject, setSelectedBaseURI, setSelectedBaseURI, setSelectedOntModel, setSelectedResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.topbraid.core.session.ISession
getNodeId, getRuntimeObject, setRuntimeObject
 
Methods inherited from interface org.topbraid.core.session.IModelSelection
addModelSelectionListener, getSelectedBaseModel, getSelectedBaseURI, getSelectedOntModel, isFastModelSelected, removeModelSelectionListener, setSelectedBaseURI
 
Methods inherited from interface org.topbraid.core.session.IResourceSelection
addResourceSelectionListener, getPreviouslySelectedResource, getSelectedResource, removeResourceSelectionListener, setSelectedResource
 

Field Detail

deletableGraphs

public static java.util.List<com.hp.hpl.jena.graph.Graph> deletableGraphs
Constructor Detail

TBCSession

public TBCSession()
Method Detail

changeOperationPerformed

public void changeOperationPerformed(ChangeOperation operation,
                                     boolean undone)
Checks if the currently selected resource has been deleted as a result of a ModelOperation. If yes, then the ontology is selected.

Specified by:
changeOperationPerformed in interface IChangeEngineListener
Parameters:
operation -
undone -

ensureBaseModelExists

public com.hp.hpl.jena.rdf.model.Model ensureBaseModelExists(java.net.URI baseURI)
Description copied from interface: ISession
Manually ensures that a Model has been instantiated and registered for a given base URI/Graph combination. This call is typically not needed - only by low-level applications that manually load graphs.

Specified by:
ensureBaseModelExists in interface ISession
Parameters:
baseURI - the base URI to register
Returns:
the Model (never null)

getBaseModel

public com.hp.hpl.jena.rdf.model.Model getBaseModel(com.hp.hpl.jena.graph.Graph graph)
Description copied from interface: ISession
Gets the base model used for a given graph in this session.

Specified by:
getBaseModel in interface ISession
Returns:

getBaseModel

public com.hp.hpl.jena.rdf.model.Model getBaseModel(java.net.URI baseURI)
Description copied from interface: ISession
Gets the current base Model for a given base URI, if one is loaded. This method only returns not null if registerModel has been called for this URI before, and no invokation of unregister has happened in the meantime.

Specified by:
getBaseModel in interface ISession
Parameters:
baseURI - the URI to get the Model for
Returns:
the Model if it has been loaded or null if not

getBaseModel

public com.hp.hpl.jena.rdf.model.Model getBaseModel(com.hp.hpl.jena.ontology.OntModel ontModel)

getChangeEngine

public IChangeEngine getChangeEngine()
Description copied from interface: ISession
Gets the session's change engine. The change engine is responsible for write operations on the current models.

Specified by:
getChangeEngine in interface ISession
Returns:
the IChangeEngine (or null)

getInferenceModel

public com.hp.hpl.jena.rdf.model.Model getInferenceModel(com.hp.hpl.jena.ontology.OntModel ontModel)

getOntModel

public com.hp.hpl.jena.ontology.OntModel getOntModel(java.net.URI baseURI)
Description copied from interface: ISession
Gets the OntModel that has been associated with a given base URI in this session. In a multi-user setting, this will return the user's OntModel, i.e. there may be different results depending on the session.

Specified by:
getOntModel in interface ISession
Parameters:
baseURI - the base URI
Returns:
the OntModel or null if none exists (yet)

getSystemModel

public com.hp.hpl.jena.rdf.model.Model getSystemModel(com.hp.hpl.jena.ontology.OntModel ontModel)

graphChangePerformed

public void graphChangePerformed()
Description copied from interface: IChangeEngineListener
Notifies the receiver that a global change to the current model has been performed. This is typically called when new sub-Graphs have been added or removed, allowing the receiver to do a complete refresh.

Specified by:
graphChangePerformed in interface IChangeEngineListener

graphDirty

public void graphDirty(com.hp.hpl.jena.graph.Graph graph)
Description copied from interface: IChangeEngineListener
Called when a Graph has been set to dirty.

Specified by:
graphDirty in interface IChangeEngineListener
Parameters:
graph - the Graph that has changed

initChangeEngine

public void initChangeEngine(TBCChangeEngine changeEngine)

isDeletable

public boolean isDeletable(com.hp.hpl.jena.rdf.model.Statement statement)
Description copied from interface: ISession
Checks whether a given Statement can be deleted, i.e. whether the triple is stored in a read-only graph.

Specified by:
isDeletable in interface ISession
Parameters:
statement - the statement to check
Returns:
true if s can be deleted

isEditable

public boolean isEditable(java.net.URI baseURI)
Specified by:
isEditable in interface ISession

isVisible

public boolean isVisible(com.hp.hpl.jena.rdf.model.Resource resource)
Description copied from interface: ISession
Checks if a given Resource is visible for this session. While it is completely up to the UI to decide what to do with invisible resources, it is recommended that invisible resources are not shown in dialogs, forms and trees.

Specified by:
isVisible in interface ISession
Parameters:
resource - the resource to test
Returns:
true if resource is visible

listModels

public java.util.Iterator<com.hp.hpl.jena.rdf.model.Model> listModels()

registerBaseModel

public void registerBaseModel(java.net.URI baseURI,
                              com.hp.hpl.jena.rdf.model.Model baseModel)

replaceBaseURI

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

updateDeletableGraphs

public static void updateDeletableGraphs()

listDeletableGraphs

public static java.util.Iterator<com.hp.hpl.jena.graph.Graph> listDeletableGraphs()

resetDeletableGraphs

public static void resetDeletableGraphs()

unregisterBaseModel

public void unregisterBaseModel(java.net.URI baseURI)