Queries

Comment Query

class dlkit.commenting.queries.CommentQuery

Bases: dlkit.osid.queries.OsidRelationshipQuery

This is the query for searching comments.

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

match_reference_id(source_id, match)

Sets reference Id.

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

NullArgumentsource_id is null

compliance: mandatory – This method must be implemented.

reference_id_terms
match_commentor_id(resource_id, match)

Sets a resource Id to match a commentor.

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.

commentor_id_terms
supports_commentor_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.

commentor_query

Gets the query for a resource query.

Multiple retrievals produce a nested OR term.

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

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

commentor_terms
match_commenting_agent_id(agent_id, match)

Sets an agent Id.

Parameters:
  • agent_id (osid.id.Id) – an 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.

commenting_agent_id_terms
supports_commenting_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.

commenting_agent_query

Gets the query for an agent query.

Multiple retrievals produce a nested OR term.

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

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

commenting_agent_terms
match_text(text, string_match_type, match)

Matches text.

Parameters:
  • text (string) – the text
  • string_match_type (osid.type.Type) – a string match type
  • match (boolean) – true for a positive match, false for a negative match
Raise:

InvalidArgumenttext is not of string_match_type

Raise:

NullArgumenttext is null

Raise:

Unsupportedsupports_string_match_type(string_match_type) is false

compliance: mandatory – This method must be implemented.

match_any_text(match)

Matches a comment that has any text assigned.

Parameters:match (boolean) – true to match comments with any text, false to match comments with no text

compliance: mandatory – This method must be implemented.

text_terms
match_rating_id(grade_id, match)

Sets a grade Id.

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

NullArgumentgrade_id is null

compliance: mandatory – This method must be implemented.

rating_id_terms
supports_rating_query()

Tests if a GradeQuery is available.

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

compliance: mandatory – This method must be implemented.

rating_query

Gets the query for a rating query.

Multiple retrievals produce a nested OR term.

Returns:the rating query
Return type:osid.grading.GradeQuery
Raise:Unimplementedsupports_rating_query() is false

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

match_any_rating(match)

Matches books with any rating.

Parameters:match (boolean) – true to match comments with any rating, false to match comments with no ratings

compliance: mandatory – This method must be implemented.

rating_terms
match_book_id(book_id, match)

Sets the book Id for this query to match comments assigned to books.

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

NullArgumentbook_id is null

compliance: mandatory – This method must be implemented.

book_id_terms
supports_book_query()

Tests if a BookQuery is available.

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

compliance: mandatory – This method must be implemented.

book_query

Gets the query for a book query.

Multiple retrievals produce a nested OR term.

Returns:the book query
Return type:osid.commenting.BookQuery
Raise:Unimplementedsupports_book_query() is false

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

book_terms
get_comment_query_record(comment_record_type)

Gets the comment query record corresponding to the given Comment record Type.

Multiple record retrievals produce a nested OR term.

Parameters:comment_record_type (osid.type.Type) – a comment record type
Returns:the comment query record
Return type:osid.commenting.records.CommentQueryRecord
Raise:NullArgumentcomment_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(comment_record_type) is false

compliance: mandatory – This method must be implemented.

Book Query

class dlkit.commenting.queries.BookQuery

Bases: dlkit.osid.queries.OsidCatalogQuery

This is the query for searching books.

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

match_comment_id(comment_id, match)

Sets the comment Id for this query to match comments assigned to books.

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

NullArgumentcomment_id is null

compliance: mandatory – This method must be implemented.

comment_id_terms
supports_comment_query()

Tests if a comment query is available.

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

compliance: mandatory – This method must be implemented.

comment_query

Gets the query for a comment.

Returns:the comment query
Return type:osid.commenting.CommentQuery
Raise:Unimplementedsupports_comment_query() is false

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

match_any_comment(match)

Matches books with any comment.

Parameters:match (boolean) – true to match books with any comment, false to match books with no comments

compliance: mandatory – This method must be implemented.

comment_terms
match_ancestor_book_id(book_id, match)

Sets the book Id for this query to match books that have the specified book as an ancestor.

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

NullArgumentbook_id is null

compliance: mandatory – This method must be implemented.

ancestor_book_id_terms
supports_ancestor_book_query()

Tests if a BookQuery is available.

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

compliance: mandatory – This method must be implemented.

ancestor_book_query

Gets the query for a book.

Multiple retrievals produce a nested OR term.

Returns:the book query
Return type:osid.commenting.BookQuery
Raise:Unimplementedsupports_ancestor_book_query() is false

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

match_any_ancestor_book(match)

Matches books with any ancestor.

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

compliance: mandatory – This method must be implemented.

ancestor_book_terms
match_descendant_book_id(book_id, match)

Sets the book Id for this query to match books that have the specified book as a descendant.

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

NullArgumentbook_id is null

compliance: mandatory – This method must be implemented.

descendant_book_id_terms
supports_descendant_book_query()

Tests if a BookQuery is available.

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

compliance: mandatory – This method must be implemented.

descendant_book_query

Gets the query for a book.

Multiple retrievals produce a nested OR term.

Returns:the book query
Return type:osid.commenting.BookQuery
Raise:Unimplementedsupports_descendant_book_query() is false

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

match_any_descendant_book(match)

Matches books with any descendant.

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

compliance: mandatory – This method must be implemented.

descendant_book_terms
get_book_query_record(book_record_type)

Gets the book query record corresponding to the given Book record Type.

Multiple record retrievals produce a nested boolean OR term.

Parameters:book_record_type (osid.type.Type) – a book record type
Returns:the book query record
Return type:osid.commenting.records.BookQueryRecord
Raise:NullArgumentbook_record_type is null
Raise:OperationFailed – unable to complete request
Raise:Unsupportedhas_record_type(book_record_type) is false

compliance: mandatory – This method must be implemented.