OSID Logo
OSID Specifications
ontology package
Version 3.1.0
Interfaceosid.ontology.SubjectHierarchySession
Implementsosid.OsidSession
Used Byosid.ontology.OntologyManager
osid.ontology.OntologyProxyManager
Description

This session defines methods for traversing a hierarchy of Subject objects. Each node in the hierarchy is a unique Subject. The hierarchy may be traversed recursively to establish the tree structure through getSubjectNodes(). To relate these Ids to another OSID, getAncestorSubjects() and getDescendantSubjects() can be used for retrievals that can be used for bulk lookups in other OSIDs. Any Subject available in the Ontology OSID is known to this hierarchy but does not appear in the hierarchy traversal until added as a root node or a child of another node.

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 getParentSubjects() or getChildSubjects() in lieu of a PERMISSION_DENIED error that may disrupt the traversal through authorized pathways.

This session defines views that offer differing behaviors when retrieving multiple objects.

  • comparative view: subject elements may be silently omitted or re-ordered
  • plenary view: provides a complete set or is an error condition
MethodgetSubjectHierarchyId
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.
MethodgetSubjectHierarchy
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.
MethodcanAccessSubjectHierarchy
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 traversal operations.

Returnboolean false if hierarchy traversal methods are not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethoduseComparativeSubjectView
Description

The returns from the subject methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.

Compliancemandatory This method is must be implemented.
MethodusePlenarySubjectView
Description

A complete view of the Hierarchy returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.

Compliancemandatory This method is must be implemented.
MethodgetRootSubjectIds
Description

Gets the root subject Ids in this hierarchy.

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

Gets the root subjects in this subject hierarchy.

Returnosid.ontology.SubjectList the root subjects
ErrorsOPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method is must be implemented.
MethodhasParentSubjects
Description

Tests if the Subject has any parents.

Parametersosid.id.IdsubjectId the Id of a subject
Returnboolean true if the subject has parents, false otherwise
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisParentOfSubject
Description

Tests if an Id is a direct parent of a subject.

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

If id not found return false.

MethodgetParentSubjectIds
Description

Gets the parent Ids of the given subject.

Parametersosid.id.IdsubjectId the Id of a subject
Returnosid.id.IdList the parent Ids of the subject
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodgetParentSubjects
Description

Gets the parents of the given subject.

Parametersosid.id.IdsubjectId the Id of a subject
Returnosid.ontology.SubjectList the parents of the subject
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisAncestorOfSubject
Description

Tests if an Id is an ancestor of a subject.

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

If id not found return false.

MethodhasChildSubjects
Description

Tests if a subject has any children.

Parametersosid.id.IdsubjectId the Id of a subject
Returnboolean true if the subjectId has children, false otherwise
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisChildOfSubject
Description

Tests if a subject is a direct child of another.

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

If id not found return false.

MethodgetChildSubjectIds
Description

Gets the child Ids of the given subject.

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

Gets the children of the given subject.

Parametersosid.id.IdsubjectId the Id to query
Returnosid.ontology.SubjectList the children of the subject
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodisDescendantOfSubject
Description

Tests if an Id is a descendant of a subject.

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

If id is not found return false.

MethodgetSubjectNodeIds
Description

Gets a portion of the hierarchy for the given subject.

Parametersosid.id.IdsubjectId 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 subject node
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodgetSubjectNodes
Description

Gets a portion of the hierarchy for the given subject.

Parametersosid.id.IdsubjectId 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.ontology.SubjectNode a subject node
ErrorsNOT_FOUND subjectId is not found
NULL_ARGUMENT subjectId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.