Queries

Resource Query

class dlkit.resource.queries.ResourceQuery

Bases: dlkit.osid.queries.OsidObjectQuery

This is the query for searching resources.

Each method specifies an AND term while multiple invocations of the same method produce a nested OR.

match_group(match)

Matches resources that are also groups.

Parameters:match (boolean) – true for a positive match, false for a negative match

compliance: mandatory – This method must be implemented.

group_terms
match_demographic(match)

Matches resources that are also demographics.

Parameters:match (boolean) – true for a positive match, false for a negative match

compliance: mandatory – This method must be implemented.

demographic_terms
match_containing_group_id(resource_id, match)

Sets the group Id for this query to match resources within the given group.

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

NullArgumentresource_id is null

compliance: mandatory – This method must be implemented.

containing_group_id_terms
supports_containing_group_query()

Tests if a ResourceQuery is available for querying containing groups.

Returns:true if a group resource query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

containing_group_query

Gets the query for a a containing group.

Multiple retrievals produce a nested OR term.

Returns:the resource query
Return type:osid.resource.ResourceQuery
Raise:Unimplementedsupports_containing_group_query() is false

compliance: optional – This method must be implemented if ``supports_agent_query()`` is ``true``.

match_any_containing_group(match)

Matches resources inside any group.

Parameters:match (boolean) – true to match any containing group, false to match resources part of no groups

compliance: mandatory – This method must be implemented.

containing_group_terms
match_avatar_id(asset_id, match)

Sets the asset Id for this query.

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

NullArgumentasset_id is null

compliance: mandatory – This method must be implemented.

avatar_id_terms
supports_avatar_query()

Tests if an AssetQuery is available.

Returns:true if an asset query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

avatar_query

Gets the query for an asset.

Multiple retrievals produce a nested OR term.

Returns:the asset query
Return type:osid.repository.AssetQuery
Raise:Unimplementedsupports_avatar_query() is false

compliance: optional – This method must be implemented if ``supports_avatar_query()`` is ``true``.

match_any_avatar(match)

Matches resources with any asset.

Parameters:match (boolean) – true to match any asset, false to match resources with no asset

compliance: mandatory – This method must be implemented.

avatar_terms
match_agent_id(agent_id, match)

Sets the agent Id for this query.

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

NullArgumentagent_id is null

compliance: mandatory – This method must be implemented.

agent_id_terms
supports_agent_query()

Tests if an AgentQuery is available.

Returns:true if an agent query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

agent_query

Gets the query for an agent.

Multiple retrievals produce a nested OR term.

Returns:the agent query
Return type:osid.authentication.AgentQuery
Raise:Unimplementedsupports_agent_query() is false

compliance: optional – This method must be implemented if ``supports_agent_query()`` is ``true``.

match_any_agent(match)

Matches resources with any agent.

Parameters:match (boolean) – true to match any agent, false to match resources with no agent

compliance: mandatory – This method must be implemented.

agent_terms
match_resource_relationship_id(resource_relationship_id, match)

Sets the resource relationship Id for this query.

Parameters:
  • resource_relationship_id (osid.id.Id) – the resource relationship Id
  • match (boolean) – true for a positive match, false for a negative match
Raise:

NullArgumentresource_relationship_id is null

compliance: mandatory – This method must be implemented.

resource_relationship_id_terms
supports_resource_relationship_query()

Tests if a ResourceRelationshipQuery is available.

Returns:true if a resource relationship query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

resource_relationship_query

Gets the query for aa resource relationship.

Multiple retrievals produce a nested OR term.

Returns:the resource relationship query
Return type:osid.resource.ResourceRelationshipQuery
Raise:Unimplementedsupports_resource_relationship_query() is false

compliance: optional – This method must be implemented if ``supports_resource_relationship_query()`` is ``true``.

match_any_resource_relationship(match)

Matches resources with any resource relationship.

Parameters:match (boolean) – true to match any resource relationship, false to match resources with no relationship

compliance: mandatory – This method must be implemented.

resource_relationship_terms
match_bin_id(bin_id, match)

Sets the bin Id for this query.

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

NullArgumentbin_id is null

compliance: mandatory – This method must be implemented.

bin_id_terms
supports_bin_query()

Tests if a BinQuery is available.

Returns:true if a bin query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

bin_query

Gets the query for a bin.

Multiple retrievals produce a nested OR term.

Returns:the bin query
Return type:osid.resource.BinQuery
Raise:Unimplementedsupports_bin_query() is false

compliance: optional – This method must be implemented if ``supports_bin_query()`` is ``true``.

bin_terms
get_resource_query_record(resource_record_type)

Gets the resource query record corresponding to the given Resource record Type.

Multiple retrievals produce a nested OR term.

Parameters:resource_record_type (osid.type.Type) – a resource record type
Returns:the resource query record
Return type:osid.resource.records.ResourceQueryRecord
Raise:NullArgumentresource_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(resource_record_type) is false

compliance: mandatory – This method must be implemented.

Bin Query

class dlkit.resource.queries.BinQuery

Bases: dlkit.osid.queries.OsidCatalogQuery

This is the query for searching bins.

Each method specifies an AND term while multiple invocations of the same method produce a nested OR.

match_resource_id(resource_id, match)

Sets the resource Id for this query.

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

NullArgumentresource_id is null

compliance: mandatory – This method must be implemented.

resource_id_terms
supports_resource_query()

Tests if a ResourceQuery is available.

Returns:true if a resource query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

resource_query

Gets the query for a resource.

Multiple retrievals produce a nested OR term.

Returns:the resource query
Return type:osid.resource.ResourceQuery
Raise:Unimplementedsupports_resource_query() is false

compliance: optional – This method must be implemented if ``supports_resource_query()`` is ``true``.

match_any_resource(match)

Matches bins with any resource.

Parameters:match (boolean) – true to match bins with any resource, false to match bins with no resources

compliance: mandatory – This method must be implemented.

resource_terms
match_ancestor_bin_id(binid, match)

Sets the bin Id for this query to match bins that have the specified bin as an ancestor.

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

NullArgumentbin_id is null

compliance: mandatory – This method must be implemented.

ancestor_bin_id_terms
supports_ancestor_bin_query()

Tests if a BinQuery is available.

Returns:true if a bin query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

ancestor_bin_query

Gets the query for a bin.

Multiple retrievals produce a nested OR term.

Returns:the bin query
Return type:osid.resource.BinQuery
Raise:Unimplementedsupports_ancestor_bin_query() is false

compliance: optional – This method must be implemented if ``supports_ancestor_bin_query()`` is ``true``.

match_any_ancestor_bin(match)

Matches bins with any ancestor.

Parameters:match (boolean) – true to match bins with any ancestor, false to match root bins

compliance: mandatory – This method must be implemented.

ancestor_bin_terms
match_descendant_bin_id(binid, match)

Sets the bin Id for this query to match bins that have the specified bin as a descendant.

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

NullArgumentbin_id is null

compliance: mandatory – This method must be implemented.

descendant_bin_id_terms
supports_descendant_bin_query()

Tests if a BinQuery is available.

Returns:true if a bin query is available, false otherwise
Return type:boolean

compliance: mandatory – This method must be implemented.

descendant_bin_query

Gets the query for a bin.

Multiple retrievals produce a nested OR term.

Returns:the bin query
Return type:osid.resource.BinQuery
Raise:Unimplementedsupports_descendant_bin_query() is false

compliance: optional – This method must be implemented if ``supports_descendant_bin_query()`` is ``true``.

match_any_descendant_bin(match)

Matches bins with any descendant.

Parameters:match (boolean) – true to match bins with any descendant, false to match leaf bins

compliance: mandatory – This method must be implemented.

descendant_bin_terms
get_bin_query_record(bin_record_type)

Gets the bin query record corresponding to the given Bin record Type.

Multiple retrievals produce a nested OR term.

Parameters:bin_record_type (osid.type.Type) – a bin record type
Returns:the bin query record
Return type:osid.resource.records.BinQueryRecord
Raise:NullArgumentbin_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(bin_record_type) is false

compliance: mandatory – This method must be implemented.