Package ptolemy.vergil.ontologies
Class OntologyGraphModel.RelationModel
- java.lang.Object
-
- ptolemy.vergil.ontologies.OntologyGraphModel.RelationModel
-
- All Implemented Interfaces:
EdgeModel
,MutableEdgeModel
- Enclosing class:
- OntologyGraphModel
public class OntologyGraphModel.RelationModel extends java.lang.Object implements MutableEdgeModel
The model for relations between concepts in the ontology.
-
-
Constructor Summary
Constructors Constructor Description RelationModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptHead(java.lang.Object edge, java.lang.Object head)
Return true if the head of the given edge can be attached to the given node.boolean
acceptTail(java.lang.Object edge, java.lang.Object tail)
Return true if the tail of the given edge can be attached to the given node.java.lang.String
getDeleteEdgeMoML(java.lang.Object edge)
Return a MoML String that will delete the given edge from the Ptolemy model.java.lang.Object
getHead(java.lang.Object edge)
Return the head node of the given edge.java.lang.Object
getTail(java.lang.Object edge)
Return the tail node of the specified edge.boolean
isDirected(java.lang.Object edge)
Return true if this edge is directed.void
removeEdge(java.lang.Object edge)
Remove the given edge and delete its associated relation.void
setHead(java.lang.Object edge, java.lang.Object head)
Connect the given edge to the given head node.void
setTail(java.lang.Object edge, java.lang.Object tail)
Connect the given edge to the given tail node.
-
-
-
Method Detail
-
acceptHead
public boolean acceptHead(java.lang.Object edge, java.lang.Object head)
Return true if the head of the given edge can be attached to the given node.- Specified by:
acceptHead
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge to attach, which is assumed to be a Link object.head
- The node to attach to.- Returns:
- True if the node can be attached to the head of the edge.
-
acceptTail
public boolean acceptTail(java.lang.Object edge, java.lang.Object tail)
Return true if the tail of the given edge can be attached to the given node.- Specified by:
acceptTail
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge to attach, which is assumed to be a Link object.tail
- The node to attach to.- Returns:
- True if the node can be attached to the tail of the edge.
-
getDeleteEdgeMoML
public java.lang.String getDeleteEdgeMoML(java.lang.Object edge)
Return a MoML String that will delete the given edge from the Ptolemy model.- Parameters:
edge
- The edge to be removed.- Returns:
- A valid MoML string.
-
getHead
public java.lang.Object getHead(java.lang.Object edge)
Return the head node of the given edge.- Specified by:
getHead
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be an instance of Link.- Returns:
- The node that is the head of the specified edge.
- See Also:
getTail(Object)
,setHead(Object, Object)
-
getTail
public java.lang.Object getTail(java.lang.Object edge)
Return the tail node of the specified edge.- Specified by:
getTail
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be an instance of Link.- Returns:
- The node that is the tail of the specified edge.
- See Also:
getHead(Object)
,setTail(Object, Object)
-
isDirected
public boolean isDirected(java.lang.Object edge)
Return true if this edge is directed. All ontology relations are directed, so this always returns true.- Specified by:
isDirected
in interfaceEdgeModel
- Parameters:
edge
- The edge, which is assumed to be a Link object.- Returns:
- True.
-
removeEdge
public void removeEdge(java.lang.Object edge)
Remove the given edge and delete its associated relation. This class queues a new change request with the ptolemy model to make this modification.- Parameters:
edge
- The edge, which is assumed to be an arc.
-
setHead
public void setHead(java.lang.Object edge, java.lang.Object head)
Connect the given edge to the given head node. If the specified head is null, then any pre-existing relation associated with this edge will be deleted.- Specified by:
setHead
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge, which is assumed to be an arc.head
- The new head for the edge, which is assumed to be an icon.- See Also:
setTail(Object, Object)
,getHead(Object)
-
setTail
public void setTail(java.lang.Object edge, java.lang.Object tail)
Connect the given edge to the given tail node. If the specified tail is null, then any pre-existing relation associated with this edge will be deleted.- Specified by:
setTail
in interfaceMutableEdgeModel
- Parameters:
edge
- The edge, which is assumed to be an arc.tail
- The new tail for the edge, which is assumed to be an icon.- See Also:
setHead(Object, Object)
,getTail(Object)
-
-