OSID Logo
OSID Specifications
hierarchy package
Version 3.1.0
Interfaceosid.hierarchy.HierarchyTraversalSession
Implementsosid.OsidSession
Used Byosid.hierarchy.HierarchyManager
osid.hierarchy.HierarchyProxyManager
Description

This session defines methods for traversing a hierarchy. Each node in the hierarchy is a unique OSID Id. The hierarchy may be traversed recursively to establish the tree structure through getParents() and getChildren(). To relate these Ids to another OSID, getNodes() can be used for retrievals that can be used for bulk lookups in other OSIDs.

Any Id available in an associated OSID is known to this hierarchy. A lookup up a particular Id in this hierarchy for the purposes of establishing a starting point for traversal or determining relationships should use the Id returned from the corresponding OSID object, not an Id that has been stored, to avoid problems with Id translation or aliasing.

A user may not be authorized to traverse the entire hierarchy. Parts of the hierarchy may be made invisible through omission from the returns of getParents() or getChildren() in lieu of a PERMISSION_DENIED error that may disrupt the traversal through authorized pathways.

MethodgetHierarchyId
Description

Gets the hierarchy Id associated with this session.

Returnosid.id.Id the hierarchy Id associated with this session
Compliancemandatory This method must be implemented.
MethodgetHierarchy
Description

Gets the hierarchy associated with this session.

Returnosid.hierarchy.Hierarchy the hierarchy associated with this session
ErrorsOPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodcanAccessHierarchy
Description

Tests if this user can perform hierarchy queries. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.

Returnboolean false if lookup methods are not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodgetRoots
Description

Gets the root nodes of this hierarchy.

Returnosid.id.IdList the root nodes
ErrorsOPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodhasParents
Description

Tests if this Id contains any parents.

Parametersosid.id.Idid the Id to query
Returnboolean true if this Id contains parents, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisParent
Description

Tests if an Id is a direct parent of another.

Parametersosid.id.Idid the Id to query
osid.id.IdparentId the Id of a parent
Returnboolean true if this parentId is a parent of id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or parentId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
Provider Notes

If parentId not found return false.

MethodgetParents
Description

Gets the parents of the given id.

Parametersosid.id.Idid the Id to query
Returnosid.id.IdList the parents of the id
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisAncestor
Description

Tests if an Id is an ancestor of another.

Parametersosid.id.Idid the Id to query
osid.id.IdancestorId the Id of an ancestor
Returnboolean true if this ancestorId is a parent of id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or ancestorId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
Provider Notes

If ancestorId not found return false.

MethodhasChildren
Description

Tests if this Id has any children.

Parametersosid.id.Idid the Id to query
Returnboolean true if this Id has children, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisChild
Description

Tests if a node is a direct child of another.

Parametersosid.id.Idid the Id to query
osid.id.IdchildId the Id of a child
Returnboolean true if this childId is a child of the Id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or childId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
Provider Notes

If childId not found return false.

MethodgetChildren
Description

Gets the children of the given Id.

Parametersosid.id.Idid the Id to query
Returnosid.id.IdList the children of the id
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisDescendant
Description

Tests if a node is a descendant of another.

Parametersosid.id.Idid the Id to query
osid.id.IddescendantId the Id of a descendant
Returnboolean true if this descendantId is a child of the Id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or descendant is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
Provider Notes

If not found return false.

MethodgetNodes
Description

Gets a portion of the hierarchy for the given Id.

Parametersosid.id.Idid the Id to query
cardinalancestorLevels the maximum number of ancestor levels to include. A value of 0 returns no parents in the node.
cardinaldescendantLevels the maximum number of descendant levels to include. A value of 0 returns no children in the node.
booleanincludeSiblings true to include the siblings of the given node, false to omit the siblings
Returnosid.hierarchy.Node a node
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.