Queries

Hierarchy Query

class dlkit.hierarchy.queries.HierarchyQuery

Bases: dlkit.osid.queries.OsidCatalogQuery

This is the query for searching hierarchies.

Results are returned if all the specified elements match. Each method match request produces an AND term while multiple invocations of a method produces a nested OR, except for accessing the HierarchyQuery record.

match_node_id(id_, match)

Matches an Id of a node in this hierarchy.

Multiple nodes can be added to this query which behave as a boolean AND.

Parameters:
  • id (osid.id.Id) – Id to match
  • match (boolean) – true if a positive match, false for negative match
Raise:

NullArgumentid is null

compliance: mandatory – This method must be implemented.

match_any_node_id(match)

Matches hierarchies with any node.

Parameters:match (boolean) – true to match hierarchies with any nodes, false to match hierarchies with no nodes

compliance: mandatory – This method must be implemented.

node_id_terms
get_hierarchy_query_record(hierarchy_record_type)

Gets the hierarchy record query corresponding to the given Hierarchy record Type.

Multiple record retrievals of the same type may return the same underlying object and do not result in adding terms to the query. Multiple record retrievals of different types add AND terms to the other elements set in this form.

Parameters:hierarchy_record_type (osid.type.Type) – a hierarchy record type
Returns:the hierarchy query record
Return type:osid.hierarchy.records.HierarchyQueryRecord
Raise:NullArgumenthierarchy_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(hierarchy_record_type) is false

compliance: mandatory – This method must be implemented.