org.topbraid.core.session
Interface ISession

All Superinterfaces:
IModelSelection, IResourceSelection
All Known Implementing Classes:
AbstractSession, TBCSession

public interface ISession
extends IModelSelection, IResourceSelection

An interface representing a user's session. The session object can provide a context for various user interface components and model operations. In a "single user per JVM" environment like TopBraid Composer, there is only a single ISession instance at any time, while in a client/server environment there may be multiple sessions going on at the same time.

Author:
Holger Knublauch

Method Summary
 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(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.
 java.lang.String getNodeId(com.hp.hpl.jena.rdf.model.RDFNode node)
           
 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.
 java.lang.Object getRuntimeObject(java.lang.String key)
          Gets a runtime object that has been attached to this session using setRuntimeObject().
 boolean isDeletable(com.hp.hpl.jena.rdf.model.Statement s)
          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.
 void setRuntimeObject(java.lang.String key, java.lang.Object value)
          Sets a runtime object; an arbitrary name/value pair.
 
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
 

Method Detail

ensureBaseModelExists

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. This call is typically not needed - only by low-level applications that manually load graphs.

Parameters:
baseURI - the base URI to register
Returns:
the Model (never null)

getBaseModel

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.

Parameters:
graph -
Returns:

getBaseModel

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. 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.

Parameters:
baseURI - the URI to get the Model for
Returns:
the Model if it has been loaded or null if not

getChangeEngine

IChangeEngine getChangeEngine()
Gets the session's change engine. The change engine is responsible for write operations on the current models.

Returns:
the IChangeEngine (or null)

getNodeId

java.lang.String getNodeId(com.hp.hpl.jena.rdf.model.RDFNode node)

getOntModel

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. In a multi-user setting, this will return the user's OntModel, i.e. there may be different results depending on the session.

Parameters:
baseURI - the base URI
Returns:
the OntModel or null if none exists (yet)

getRuntimeObject

java.lang.Object getRuntimeObject(java.lang.String key)
Gets a runtime object that has been attached to this session using setRuntimeObject().

Parameters:
key - the key to get the object for
Returns:
the runtime object or null

isDeletable

boolean isDeletable(com.hp.hpl.jena.rdf.model.Statement s)
Checks whether a given Statement can be deleted, i.e. whether the triple is stored in a read-only graph.

Parameters:
s - the statement to check
Returns:
true if s can be deleted

isEditable

boolean isEditable(java.net.URI baseURI)

isVisible

boolean isVisible(com.hp.hpl.jena.rdf.model.Resource resource)
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.

Parameters:
resource - the resource to test
Returns:
true if resource is visible

setRuntimeObject

void setRuntimeObject(java.lang.String key,
                      java.lang.Object value)
Sets a runtime object; an arbitrary name/value pair.

Parameters:
key - the key to set the object for
value - the value to set or null to delete an existing value