Commenting Open Service Interface Definitions commenting version 3.0.0
The Commenting OSID provides a means of relating user comments and ratings to OSID Objects.
The Commenting OSID may be used as an auxiliary service orchestrated
with other OSIDs to either provide administrative comments as well as
create a social network-esque comment and rating service to various
OsidObjects.
Comments
Comments contain text entries logged by date and Agent. A
Comment may also include a rating represented by a Grade defined
in a GradeSystem. The RatingLookupSession may be used to query
cumulative scores across an object reference or the entire Book.
Comments are OsidRelationships between a commentor and a
reference Id. The relationship defines dates for which the comment
and/or rating is effective.
Commentors
An Agent comments on something. As a person is represented by a
Resource in the Resource OSID, the Comments provide access to both
the commenting Agent and the related Resource to avoid the need
of an additional service orchestration for resolving the Agent.
Cataloging
Comments are cataloged in Books which may also be grouped
hierarchically to federate multiple collections of comments.
Sub Packages
The Commenting OSID includes a Commenting Batch OSID for managing
Comments and Books in bulk.
Service Managers¶
Commenting Manager¶
-
class
dlkit.services.commenting.CommentingManager¶ Bases:
dlkit.osid.managers.OsidManager,dlkit.osid.sessions.OsidSession,dlkit.services.commenting.CommentingProfile-
commenting_batch_manager¶ Gets a
CommentingBatchManager.Returns: a CommentingBatchManagerReturn type: osid.commenting.batch.CommentingBatchManagerRaise: OperationFailed– unable to complete requestRaise: Unimplemented–supports_commenting_batch()isfalse
-
Commenting Profile Methods¶
CommentingManager.supports_comment_lookup()¶Tests for the availability of a comment lookup service.
Returns: trueif comment lookup is available,falseotherwiseReturn type: boolean
CommentingManager.supports_comment_query()¶Tests if querying comments is available.
Returns: trueif comment query is available,falseotherwiseReturn type: boolean
CommentingManager.supports_comment_admin()¶Tests if managing comments is available.
Returns: trueif comment admin is available,falseotherwiseReturn type: boolean
CommentingManager.supports_book_lookup()¶Tests for the availability of an book lookup service.
Returns: trueif book lookup is available,falseotherwiseReturn type: boolean
CommentingManager.supports_book_admin()¶Tests for the availability of a book administrative service for creating and deleting books.
Returns: trueif book administration is available,falseotherwiseReturn type: boolean
CommentingManager.supports_book_hierarchy()¶Tests for the availability of a book hierarchy traversal service.
Returns: trueif book hierarchy traversal is available,falseotherwiseReturn type: boolean
CommentingManager.supports_book_hierarchy_design()¶Tests for the availability of a book hierarchy design service.
Returns: trueif book hierarchy design is available,falseotherwiseReturn type: boolean
CommentingManager.comment_record_types¶Gets the supported
Commentrecord types.
Returns: a list containing the supported comment record types Return type: osid.type.TypeList
CommentingManager.comment_search_record_types¶Gets the supported comment search record types.
Returns: a list containing the supported comment search record types Return type: osid.type.TypeList
CommentingManager.book_record_types¶Gets the supported
Bookrecord types.
Returns: a list containing the supported book record types Return type: osid.type.TypeList
CommentingManager.book_search_record_types¶Gets the supported book search record types.
Returns: a list containing the supported book search record types Return type: osid.type.TypeList
Book Lookup Methods¶
CommentingManager.can_lookup_books()¶Tests if this user can perform
Booklookups. 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 aPermissionDenied. This is intended as a hint to an application that may not offer lookup operations to unauthorized users.
Returns: falseif lookup methods are not authorized,trueotherwiseReturn type: boolean
CommentingManager.use_comparative_book_view()¶The returns from the lookup 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.
CommentingManager.use_plenary_book_view()¶A complete view of the
Bookreturns 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.
CommentingManager.get_books_by_ids(book_ids)¶Gets a
BookListcorresponding to the givenIdList. In plenary mode, the returned list contains all of the books specified in theIdlist, in the order of the list, including duplicates, or an error results if anIdin the supplied list is not found or inaccessible. Otherwise, inaccessibleBooksmay be omitted from the list and may present the elements in any order including returning a unique set.
Parameters: book_ids ( osid.id.IdList) – the list ofIdsto retrieveReturns: the returned BooklistReturn type: osid.commenting.BookListRaise: NotFound– anId wasnot foundRaise: NullArgument–book_idsisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_books_by_genus_type(book_genus_type)¶Gets a
BookListcorresponding to the given book genusTypewhich does not include books of genus types derived from the specifiedType. In plenary mode, the returned list contains all known books or an error results. Otherwise, the returned list may contain only those books that are accessible through this session.
Parameters: book_genus_type ( osid.type.Type) – a book genus typeReturns: the returned BooklistReturn type: osid.commenting.BookListRaise: NullArgument–book_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_books_by_parent_genus_type(book_genus_type)¶Gets a
BookListcorresponding to the given book genusTypeand include any additional books with genus types derived from the specifiedType. In plenary mode, the returned list contains all known books or an error results. Otherwise, the returned list may contain only those books that are accessible through this session.
Parameters: book_genus_type ( osid.type.Type) – a book genus typeReturns: the returned BooklistReturn type: osid.commenting.BookListRaise: NullArgument–book_genus_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_books_by_record_type(book_record_type)¶Gets a
BookListcontaining the given book recordType. In plenary mode, the returned list contains all known books or an error results. Otherwise, the returned list may contain only those books that are accessible through this session.
Parameters: book_record_type ( osid.type.Type) – a book record typeReturns: the returned BooklistReturn type: osid.commenting.BookListRaise: NullArgument–book_record_typeisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_books_by_provider(resource_id)¶Gets a
BookListfrom the given provider ````. In plenary mode, the returned list contains all known books or an error results. Otherwise, the returned list may contain only those books that are accessible through this session.
Parameters: resource_id ( osid.id.Id) – a resourceIdReturns: the returned BooklistReturn type: osid.commenting.BookListRaise: NullArgument–resource_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.books¶Gets all
Books. In plenary mode, the returned list contains all known books or an error results. Otherwise, the returned list may contain only those books that are accessible through this session.
Returns: a list of BooksReturn type: osid.commenting.BookListRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
Book Admin Methods¶
CommentingManager.can_create_books()¶Tests if this user can create
Books. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aBookwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
Returns: falseifBookcreation is not authorized,trueotherwiseReturn type: boolean
CommentingManager.can_create_book_with_record_types(book_record_types)¶Tests if this user can create a single
Bookusing the desired record types. WhileCommentingManager.getBookRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificBook. Providing an empty array tests if aBookcan be created with no records.
Parameters: book_record_types ( osid.type.Type[]) – array of book record typesReturns: trueifBookcreation using the specified recordTypesis supported,falseotherwiseReturn type: booleanRaise: NullArgument–book_record_typesisnull
CommentingManager.get_book_form_for_create(book_record_types)¶Gets the book form for creating new books. A new form should be requested for each create transaction.
Parameters: book_record_types ( osid.type.Type[]) – array of book record typesReturns: the book form Return type: osid.commenting.BookFormRaise: NullArgument–book_record_typesisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported– unable to get form for requested record types
CommentingManager.create_book(book_form)¶Creates a new
Book.
Parameters: book_form ( osid.commenting.BookForm) – the form for thisBookReturns: the new BookReturn type: osid.commenting.BookRaise: IllegalState–book_formalready used in a create transactionRaise: InvalidArgument– one or more of the form elements is invalidRaise: NullArgument–book_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–book_formdid not originte fromget_book_form_for_create()
CommentingManager.can_update_books()¶Tests if this user can update
Books. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBookwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
Returns: falseifBookmodification is not authorized,trueotherwiseReturn type: boolean
CommentingManager.get_book_form_for_update(book_id)¶Gets the book form for updating an existing book. A new book form should be requested for each update transaction.
Parameters: book_id ( osid.id.Id) – theIdof theBookReturns: the book form Return type: osid.commenting.BookFormRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.update_book(book_form)¶Updates an existing book.
Parameters: book_form ( osid.commenting.BookForm) – the form containing the elements to be updatedRaise: IllegalState–book_formalready used in an update transactionRaise: InvalidArgument– the form contains an invalid valueRaise: NullArgument–book_formisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failureRaise: Unsupported–book_formdid not originte fromget_book_form_for_update()
CommentingManager.can_delete_books()¶Tests if this user can delete
BooksA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBookwill result in aPermissionDenied. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
Returns: falseifBookdeletion is not authorized,trueotherwiseReturn type: boolean
CommentingManager.delete_book(book_id)¶Deletes a
Book.
Parameters: book_id ( osid.id.Id) – theIdof theBookto removeRaise: NotFound–book_idnot foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.can_manage_book_aliases()¶Tests if this user can manage
Idaliases forBooks. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPermissionDenied. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
Returns: falseifBookaliasing is not authorized,trueotherwiseReturn type: boolean
CommentingManager.alias_book(book_id, alias_id)¶Adds an
Idto aBookfor the purpose of creating compatibility. The primaryIdof theBookis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another book, it is reassigned to the given bookId.
Parameters:
- book_id (
osid.id.Id) – theIdof aBook- alias_id (
osid.id.Id) – the aliasIdRaise:
AlreadyExists–alias_idis already assignedRaise:
NotFound–book_idnot foundRaise:
NullArgument–book_idoralias_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
Book Hierarchy Methods¶
CommentingManager.book_hierarchy_id¶Gets the hierarchy
Idassociated with this session.
Returns: the hierarchy Idassociated with this sessionReturn type: osid.id.Id
CommentingManager.book_hierarchy¶Gets the hierarchy associated with this session.
Returns: the hierarchy associated with this session Return type: osid.hierarchy.HierarchyRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.can_access_book_hierarchy()¶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
PermissionDenied. This is intended as a hint to an application that may opt not to offer lookup operations.
Returns: falseif hierarchy traversal methods are not authorized,trueotherwiseReturn type: boolean
CommentingManager.use_comparative_book_view()The returns from the lookup 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.
CommentingManager.use_plenary_book_view()A complete view of the
Bookreturns 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.
CommentingManager.root_book_ids¶Gets the root book
Idsin this hierarchy.
Returns: the root book IdsReturn type: osid.id.IdListRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.root_books¶Gets the root books in the book hierarchy. A node with no parents is an orphan. While all book
Idsare known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node.
Returns: the root books Return type: osid.commenting.BookListRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.has_parent_books(book_id)¶Tests if the
Bookhas any parents.
Parameters: book_id ( osid.id.Id) – a bookIdReturns: trueif the book has parents, falseotherwiseReturn type: booleanRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.is_parent_of_book(id_, book_id)¶Tests if an
Idis a direct parent of book.
Parameters:
- id (
osid.id.Id) – anId- book_id (
osid.id.Id) – theIdof a bookReturns:
trueif thisidis a parent ofbook_id,falseotherwiseReturn type:
booleanRaise:
NotFound–book_idis not foundRaise:
NullArgument–idorbook_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.get_parent_book_ids(book_id)¶Gets the parent
Idsof the given book.
Parameters: book_id ( osid.id.Id) – a bookIdReturns: the parent Idsof the bookReturn type: osid.id.IdListRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_parent_books(book_id)¶Gets the parent books of the given
id.
Parameters: book_id ( osid.id.Id) – theIdof theBookto queryReturns: the parent books of the idReturn type: osid.commenting.BookListRaise: NotFound– aBookidentified byId isnot foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.is_ancestor_of_book(id_, book_id)¶Tests if an
Idis an ancestor of a book.
Parameters:
- id (
osid.id.Id) – anId- book_id (
osid.id.Id) – theIdof a bookReturns:
true if thisidis an ancestor ofbook_id,falseotherwiseReturn type:
booleanRaise:
NotFound–book_idis not foundRaise:
NullArgument–idorbook_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.has_child_books(book_id)¶Tests if a book has any children.
Parameters: book_id ( osid.id.Id) – a bookIdReturns: trueif thebook_idhas children,falseotherwiseReturn type: booleanRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.is_child_of_book(id_, book_id)¶Tests if a book is a direct child of another.
Parameters:
- id (
osid.id.Id) – anId- book_id (
osid.id.Id) – theIdof a bookReturns:
trueif theidis a child ofbook_id,falseotherwiseReturn type:
booleanRaise:
NotFound–book_idis not foundRaise:
NullArgument–idorbook_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.get_child_book_ids(book_id)¶Gets the child
Idsof the given book.
Parameters: book_id ( osid.id.Id) – theIdto queryReturns: the children of the book Return type: osid.id.IdListRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.get_child_books(book_id)¶Gets the child books of the given
id.
Parameters: book_id ( osid.id.Id) – theIdof theBookto queryReturns: the child books of the idReturn type: osid.commenting.BookListRaise: NotFound– aBookidentified byId isnot foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.is_descendant_of_book(id_, book_id)¶Tests if an
Idis a descendant of a book.
Parameters:
- id (
osid.id.Id) – anId- book_id (
osid.id.Id) – theIdof a bookReturns:
trueif theidis a descendant of thebook_id,falseotherwiseReturn type:
booleanRaise:
NotFound–book_idis not foundRaise:
NullArgument–idorbook_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.get_book_node_ids(book_id, ancestor_levels, descendant_levels, include_siblings)¶Gets a portion of the hierarchy for the given book.
Parameters:
- book_id (
osid.id.Id) – theIdto query- ancestor_levels (
cardinal) – the maximum number of ancestor levels to include. A value of 0 returns no parents in the node.- descendant_levels (
cardinal) – the maximum number of descendant levels to include. A value of 0 returns no children in the node.- include_siblings (
boolean) –trueto include the siblings of the given node,falseto omit the siblingsReturns: a book node
Return type:
osid.hierarchy.NodeRaise:
NotFound–book_idis not foundRaise:
NullArgument–book_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.get_book_nodes(book_id, ancestor_levels, descendant_levels, include_siblings)¶Gets a portion of the hierarchy for the given book.
Parameters:
- book_id (
osid.id.Id) – theIdto query- ancestor_levels (
cardinal) – the maximum number of ancestor levels to include. A value of 0 returns no parents in the node.- descendant_levels (
cardinal) – the maximum number of descendant levels to include. A value of 0 returns no children in the node.- include_siblings (
boolean) –trueto include the siblings of the given node,falseto omit the siblingsReturns: a book node
Return type:
osid.commenting.BookNodeRaise:
NotFound–book_idis not foundRaise:
NullArgument–book_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
Book Hierarchy Design Methods¶
CommentingManager.book_hierarchy_idGets the hierarchy
Idassociated with this session.
Returns: the hierarchy Idassociated with this sessionReturn type: osid.id.Id
CommentingManager.book_hierarchyGets the hierarchy associated with this session.
Returns: the hierarchy associated with this session Return type: osid.hierarchy.HierarchyRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.can_modify_book_hierarchy()¶Tests if this user can change the hierarchy. A return of true does not guarantee successful authorization. A return of false indicates that it is known performing any update will result in a
PermissionDenied. This is intended as a hint to an application that may opt not to offer these operations to an unauthorized user.
Returns: falseif changing this hierarchy is not authorized,trueotherwiseReturn type: boolean
CommentingManager.add_root_book(book_id)¶Adds a root book.
Parameters: book_id ( osid.id.Id) – theIdof a bookRaise: AlreadyExists–book_idis already in hierarchyRaise: NotFound–book_idis not foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.remove_root_book(book_id)¶Removes a root book.
Parameters: book_id ( osid.id.Id) – theIdof a bookRaise: NotFound–book_idis not a rootRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure
CommentingManager.add_child_book(book_id, child_id)¶Adds a child to a book.
Parameters:
- book_id (
osid.id.Id) – theIdof a book- child_id (
osid.id.Id) – theIdof the new childRaise:
AlreadyExists–book_idis already a parent ofchild_idRaise:
NotFound–book_idorchild_idnot foundRaise:
NullArgument–book_idorchild_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.remove_child_book(book_id, child_id)¶Removes a child from a book.
Parameters:
- book_id (
osid.id.Id) – theIdof a book- child_id (
osid.id.Id) – theIdof the new childRaise:
NotFound–book_idnot a parent ofchild_idRaise:
NullArgument–book_idorchild_idisnullRaise:
OperationFailed– unable to complete requestRaise:
PermissionDenied– authorization failure
CommentingManager.remove_child_books(book_id)¶Removes all children from a book.
Parameters: book_id ( osid.id.Id) – theIdof a bookRaise: NotFound–book_idnot foundRaise: NullArgument–book_idisnullRaise: OperationFailed– unable to complete requestRaise: PermissionDenied– authorization failure