Protege 4.1.0

uk.ac.man.cs.mig.util.graph.model
Interface GraphModel

All Known Implementing Classes:
AbstractGraphModel, AbstractOWLClassGraphModel, DefaultGraphModel, OWLClassGraphAssertedModel, OWLClassGraphInferredModel, OWLOntologyImportsGraphModel, OWLVizAxiomGraphModel

public interface GraphModel

The GraphModel provides an interface to the data visualised by OWLViz, without assuming what the data is/represents. It provides methods to access parent and child objects of any given object.


Field Summary
static int DIRECTION_BACK
          The direction of the relationship is from child to parent
static int DIRECTION_BOTH
          The relationship is bidirectional - i.e.
static int DIRECTION_FORWARD
          The direction of the relationship is from parent to child.
static int DIRECTION_NONE
          The relationship does not have a direction.
 
Method Summary
 void addGraphModelListener(GraphModelListener lsnr)
          Adds a listener to the model that is notified when events such a Node addition and removal take place.
 boolean contains(Object obj)
          Tests whether or not the specified object is contained within the graph model.
 void dispose()
          Disposed of the graph model.
 int getChildCount(Object obj)
          Retrives the number of children that the specified object has.
 Iterator getChildren(Object obj)
          Gets the children of the specified object
 Iterator<GraphModelListener> getListeners()
          Gets an Iterator that can be used to traverse and remove listeners.
 int getParentCount(Object obj)
          Retrives the number of parents that the specified object has.
 Iterator getParents(Object obj)
          Retrieves the parents of the specified object
 Iterator getRelatedObjectsToAdd(Object obj)
          In some situations when an object is displayed in a graph it is necessary to display other (related) objects automatically.
 Iterator getRelatedObjectsToRemove(Object obj)
          In some situations when an object displayed in a graph is made invisible it might be useful to make other related objects invisible.
 int getRelationshipDirection(Object parentObject, Object childObject)
          Gets the direction of the relationship.
 Object getRelationshipType(Object parentObject, Object childObject)
          Retrieves the type of relationship between the specified objects.
 void removeGraphModelListener(GraphModelListener lsnr)
          Removes a previously added GraphModelListener.
 

Field Detail

DIRECTION_NONE

static final int DIRECTION_NONE
The relationship does not have a direction.

See Also:
Constant Field Values

DIRECTION_FORWARD

static final int DIRECTION_FORWARD
The direction of the relationship is from parent to child.

See Also:
Constant Field Values

DIRECTION_BACK

static final int DIRECTION_BACK
The direction of the relationship is from child to parent

See Also:
Constant Field Values

DIRECTION_BOTH

static final int DIRECTION_BOTH
The relationship is bidirectional - i.e. it holds from parent to child and from child to parent.

See Also:
Constant Field Values
Method Detail

getChildCount

int getChildCount(Object obj)
Retrives the number of children that the specified object has.

Parameters:
obj - The object
Returns:
The number of children.

getChildren

Iterator getChildren(Object obj)
Gets the children of the specified object

Returns:
An iterator, which can be used to traverse the children.

getParentCount

int getParentCount(Object obj)
Retrives the number of parents that the specified object has.

Parameters:
obj - The object
Returns:
The number of parents

getParents

Iterator getParents(Object obj)
Retrieves the parents of the specified object

Parameters:
obj - The object
Returns:
The parents of the specified object.

contains

boolean contains(Object obj)
Tests whether or not the specified object is contained within the graph model.

Parameters:
obj - The object to test for.
Returns:
true if the specified object is contained in the model, or false if the specified object is not contained in the model.

getRelationshipType

Object getRelationshipType(Object parentObject,
                           Object childObject)
Retrieves the type of relationship between the specified objects.

Parameters:
parentObject - The parent object.
childObject - The child object.
Returns:
An object representing the relationship between the child object and parent object. For example, this could be String that represents the name of the relationship, such as "is-a".

getRelationshipDirection

int getRelationshipDirection(Object parentObject,
                             Object childObject)
Gets the direction of the relationship. In some relationships the edge direction is in an opposite direction to the parent/child relationship. For example, a superclass/subclass relationship - the parent is the superclass and the child is the subclass, but the direction of the edge is from subclass to superclass - i.e. child to parent. This method allows the direction of the Edge between two objects to be customised.

Parameters:
parentObject - The parent object.
childObject - The child object.
Returns:
The direction of the edge that connects the objects. Directions are defined in this GraphModel interface. A forward direction represents and parent-to-child relationship. A back direction represents a child-to-parent relationship.

getRelatedObjectsToAdd

Iterator getRelatedObjectsToAdd(Object obj)
In some situations when an object is displayed in a graph it is necessary to display other (related) objects automatically. This method will usually be called so that objects that are related to the specified object (but not necessarily parent/child objects) can be retrieved.

Parameters:
obj - The object for which related objects are to be retrieved.
Returns:
An iterator that can be used to traverse the related objects.

getRelatedObjectsToRemove

Iterator getRelatedObjectsToRemove(Object obj)
In some situations when an object displayed in a graph is made invisible it might be useful to make other related objects invisible. This method will be called to determine if there are any other objects to be made invisible.

Parameters:
obj - The object being made invisible.
Returns:
Any objects that are related to obj that should also be made invisible.

addGraphModelListener

void addGraphModelListener(GraphModelListener lsnr)
Adds a listener to the model that is notified when events such a Node addition and removal take place.

Parameters:
lsnr - The listener to be added.

removeGraphModelListener

void removeGraphModelListener(GraphModelListener lsnr)
Removes a previously added GraphModelListener.

Parameters:
lsnr - The listener to be removed.

getListeners

Iterator<GraphModelListener> getListeners()
Gets an Iterator that can be used to traverse and remove listeners.


dispose

void dispose()
Disposed of the graph model. This clears any cached information and removes listeners.


Protege 4.1.0

Submit a bug report or feature request

For further API reference and developer documentation, see Protege 4 Developer Documentation.

Copyright © 2010 Stanford Center for Biomedical Informatics Research