annotations.models module¶
Models for the annotations app.
Texts and projects¶
Text |
Represents a document that is available for annotation. |
TextCollection |
This is referred to as a “Project” in most cases. |
Annotations¶
Annotation |
Mixin (abstract) for text-based annotations. |
Appellation |
An Appellation represents a user’s interpretation of a specific passage of text. |
DateAppellation |
Dates can be represented as ISO-8601 literals, with variable precision. |
Interpreted |
Mixin for Annotations that refer to a concepts.Concept. |
QuadrigaAccession |
Records the event that a set of RelationSets are accessioned to Quadriga. |
Relation |
A Relation captures a user’s assertion that a passage of text implies a specific relation between two concepts. |
RelationSet |
A RelationSet organizes Relations into complete statements. |
RelationTemplate |
Provides a template for complex relations, allowing the user to simply fill in fields without worrying about the structure of the quadruple. |
RelationTemplatePart |
Template for a Relation constituent to a RelationSet. |
Users and groups¶
GroupManager |
The manager for the auth’s Group model. |
VogonGroup |
|
VogonUser |
|
VogonUserManager |
Detailed descriptions¶
-
class
annotations.models.Annotation(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelMixin (abstract) for text-based annotations.
Provides fields for
Textassociation, the creation event, and Quadriga accession.-
Annotation.created= None¶ The date and time that the
Annotationwas created.
-
Annotation.createdBy¶ The
VogonUserwho created theAnnotation.
-
Annotation.get_next_by_created(*moreargs, **morekwargs)¶
-
Annotation.get_previous_by_created(*moreargs, **morekwargs)¶
-
Annotation.occursIn¶ The
Textto which theAnnotationrefers.
-
Annotation.submitted= None¶ Indicates whether or not the
Annotationhas been accessioned to Quadriga.
-
Annotation.submittedOn= None¶ The date and time that the
Annotationwas accessioned to Quadriga.
-
Annotation.submittedWith¶ If the
Annotationhas been added to Quadriga, this refers to theQuadrigaAccessionwith which it was submitted.
-
-
class
annotations.models.Appellation(*args, **kwargs)[source]¶ Bases:
annotations.models.Annotation,annotations.models.InterpretedAn Appellation represents a user’s interpretation of a specific passage of text. In particular, it captures the user’s belief that the passage in question refers to a specific concept (e.g. of a person, place, etc).
Notes
startPosandendPosare deprecated – these can be created on-the-fly, and don’t apply to non-plain-text use-cases.controlling_verbis deprecated as of v0.3. This is no longer necessary, since we now implement the full quadruple model in VogonWeb.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
Appellation.HAS= 'has'¶
-
Appellation.IS= 'is'¶
-
exception
Appellation.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Appellation.NONE= None¶
-
Appellation.VCHOICES= ((None, ''), ('is', 'is/was'), ('has', 'has/had'))¶
-
Appellation.asPredicate= None¶ Indicates whether this Appellation should function as a predicate for a Relation. As of version 0.3, this basically just controls whether or not the Appellation should be displayed in the text annotation view.
-
Appellation.controlling_verb= None¶ **.. deprecated* –* – 0.4 We now fully implement the quadruple data model, so this is no longer relevant.
-
Appellation.createdBy¶
-
Appellation.endPos= None¶ Character offset from the end of the (plain text) document.
Deprecated since version 0.5: Text positions will be represented using
DocumentPosition.
-
Appellation.get_controlling_verb_display(*moreargs, **morekwargs)¶
-
Appellation.get_next_by_created(*moreargs, **morekwargs)¶
-
Appellation.get_previous_by_created(*moreargs, **morekwargs)¶
-
Appellation.interpretation¶
-
Appellation.objects= <django.db.models.manager.Manager object>¶
-
Appellation.occursIn¶
-
Appellation.relationsAs¶
-
Appellation.relationsFrom¶ This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.
-
Appellation.relationsTo¶ This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.
-
Appellation.startPos= None¶ Character offset from the beginning of the (plain text) document.
Deprecated since version 0.5: Text positions will be represented using
DocumentPosition.
-
Appellation.stringRep= None¶ Plain-text snippet spanning the selected text.
-
Appellation.submittedWith¶
-
Appellation.tokenIds= None¶ IDs of words (in the tokenizedContent) selected for this Appellation.
-
exception
-
class
annotations.models.Authorization(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelRepresents an authorization token for an external service.
Deprecated since version 0.5: Repository-related models and methods should be implemented in
repository.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Authorization.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Authorization.objects= <django.db.models.manager.Manager object>¶
-
Authorization.repository¶
-
Authorization.user¶
-
exception
-
class
annotations.models.DateAppellation(*args, **kwargs)[source]¶ Bases:
annotations.models.AnnotationDates can be represented as ISO-8601 literals, with variable precision.
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
DateAppellation.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
DateAppellation.createdBy¶
-
DateAppellation.get_next_by_created(*moreargs, **morekwargs)¶
-
DateAppellation.get_previous_by_created(*moreargs, **morekwargs)¶
-
DateAppellation.objects= <django.db.models.manager.Manager object>¶
-
DateAppellation.occursIn¶
-
DateAppellation.precision¶ This is mainly for display. Indicates the precision of the
DateAppellation: ‘year’, ‘month’, or ‘day’. Precision will vary depending on the confidence/interpretation of the user.
-
DateAppellation.submittedWith¶
-
exception
-
class
annotations.models.GroupManager[source]¶ Bases:
django.db.models.manager.ManagerThe manager for the auth’s Group model.
-
use_in_migrations= True¶
-
-
class
annotations.models.Interpreted(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelMixin for
Annotations that refer to aconcepts.Concept.Todo
Should this subclass
Annotation? Does it matter?-
Interpreted.interpretation¶ The
Conceptto which theAnnotationrefers.
-
Interpreted.interpretation_label¶ The referenced
concepts.Concept‘s lemma/label.
-
Interpreted.interpretation_type¶ The primary-key identifier of the referenced
concepts.Concepts associatedconcepts.Type.If the
concepts.Concepthas no type, returnsNone.Returns: Return type: int or None
-
Interpreted.interpretation_type_label¶ The lemma/label of the referenced
concepts.Concept‘s associatedconcepts.Type.If the
concepts.Concepthas no type, returnsNone.Returns: Return type: unicode or None
-
-
class
annotations.models.QuadrigaAccession(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelRecords the event that a set of
RelationSets are accessioned to Quadriga.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
QuadrigaAccession.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
QuadrigaAccession.appellation_set¶
-
QuadrigaAccession.createdBy¶
-
QuadrigaAccession.dateappellation_set¶
-
QuadrigaAccession.get_next_by_created(*moreargs, **morekwargs)¶
-
QuadrigaAccession.get_previous_by_created(*moreargs, **morekwargs)¶
-
QuadrigaAccession.objects= <django.db.models.manager.Manager object>¶
-
QuadrigaAccession.relation_set¶
-
QuadrigaAccession.relationset_set¶
-
exception
-
class
annotations.models.Relation(*args, **kwargs)[source]¶ Bases:
annotations.models.AnnotationA
Relationcaptures a user’s assertion that a passage of text implies a specific relation between two concepts.The
sourceand/orobjectof theRelationcan be aAppellation,DateAppellation, or anotherRelation.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Relation.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Relation.createdBy¶
-
Relation.get_next_by_created(*moreargs, **morekwargs)¶
-
Relation.get_previous_by_created(*moreargs, **morekwargs)¶
-
Relation.object_appellations¶
-
Relation.object_content_object¶ Provides a generic relation to any object through content-type/object-id fields.
-
Relation.object_content_type¶
-
Relation.objects= <django.db.models.manager.Manager object>¶
-
Relation.occursIn¶
-
Relation.part_of¶
-
Relation.predicate¶
-
Relation.source_appellations¶
-
Relation.source_content_object¶ Provides a generic relation to any object through content-type/object-id fields.
-
Relation.source_content_type¶
-
Relation.submittedWith¶
-
exception
-
class
annotations.models.RelationSet(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA
RelationSetorganizesRelations into complete statements.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
RelationSet.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
RelationSet.appellations()[source]¶ Get all non-predicate appellations in child
Relations.Returns: Return type: django.db.models.query.QuerySet
-
RelationSet.concepts()[source]¶ Get all of the Concept instances connected to non-predicate Appellation instances.
Returns: Return type: django.db.models.query.QuerySet
-
RelationSet.constituents¶
-
RelationSet.createdBy¶ The user who created the RelationSet.
-
RelationSet.get_next_by_created(*moreargs, **morekwargs)¶
-
RelationSet.get_previous_by_created(*moreargs, **morekwargs)¶
-
RelationSet.label¶ The label displayed in lists of
RelationSets.Returns: Return type: unicode
-
RelationSet.objects= <django.db.models.manager.Manager object>¶
-
RelationSet.occursIn¶ The text on which this RelationSet is based.
-
RelationSet.pending= None¶ A
RelationSetis pending if it has been selected for submission, but the submission process has not yet completed. The primary purpose of this field is to prevent duplicate submissions.
-
RelationSet.ready()[source]¶ Check whether or not the constituent
Concepts in thisRelationSethave been resolved (or merged).This aids the process of submitting annotations to Quadriga: all
Concepts must be present in Conceptpower prior to submission.Returns: Return type: bool
-
RelationSet.root¶ Identifies and retrieves the highest-level or “starting”
Relationin theRelationSet.
-
RelationSet.submitted= None¶ Whether or not the
RelationSethas been accessioned to Quadriga. This is setTrueonly if theRelationSetwas added successfully.
-
RelationSet.submittedOn= None¶ The date/time when the
RelationSetwas (successfully) accessioned to Quadriga.
-
RelationSet.submittedWith¶ The
QuadrigaAccessiontracks the entire set of RelationSets that were accessioned together in a single query.
-
RelationSet.template¶ If this RelationSet was created from a RelationTemplate, we can use the template to make decisions about display.
-
exception
-
class
annotations.models.RelationTemplate(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelProvides a template for complex relations, allowing the user to simply fill in fields without worrying about the structure of the quadruple.
Todo
Add
created_byfield, perhaps others.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
RelationTemplate.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
RelationTemplate.description= None¶ A longer-form description of the relation.
-
RelationTemplate.expression= None¶ Pattern for representing the relation in normal language.
-
RelationTemplate.fields¶ The fields that we need the user to fill to create a
RelationSetfrom thisRelationSet.
-
RelationTemplate.instantiations¶
-
RelationTemplate.name= None¶ A descriptive name used in menus in the annotation interface.
-
RelationTemplate.objects= <django.db.models.manager.Manager object>¶
-
RelationTemplate.template_parts¶
-
exception
-
class
annotations.models.RelationTemplatePart(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelTemplate for a
Relationconstituent to aRelationSet.-
CONCEPT= 'CO'¶
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
RelationTemplatePart.HAS= 'HA'¶
-
exception
RelationTemplatePart.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
RelationTemplatePart.NODE_CHOICES= (('TP', 'Concept type'), ('CO', 'Specific concept'), ('RE', 'Relation'))¶
-
RelationTemplatePart.PRED_CHOICES= (('TP', 'Concept type'), ('CO', 'Specific concept'), ('IS', 'Is/was'), ('HA', 'Has/had'))¶
-
RelationTemplatePart.RELATION= 'RE'¶
-
RelationTemplatePart.TOBE= 'IS'¶
-
RelationTemplatePart.TYPE= 'TP'¶
-
RelationTemplatePart.get_object_node_type_display(*moreargs, **morekwargs)¶
-
RelationTemplatePart.get_predicate_node_type_display(*moreargs, **morekwargs)¶
-
RelationTemplatePart.get_source_node_type_display(*moreargs, **morekwargs)¶
-
RelationTemplatePart.object_concept¶
-
RelationTemplatePart.object_prompt_text= None¶ Indicates whether the user should be asked for evidence for object.
-
RelationTemplatePart.object_relationtemplate¶
-
RelationTemplatePart.object_type¶
-
RelationTemplatePart.objects= <django.db.models.manager.Manager object>¶
-
RelationTemplatePart.part_of¶
-
RelationTemplatePart.predicate_concept¶
-
RelationTemplatePart.predicate_prompt_text= None¶ Indicates whether the user should be asked for evidence for predicate.
-
RelationTemplatePart.predicate_type¶
-
RelationTemplatePart.source_concept¶
-
RelationTemplatePart.source_prompt_text= None¶ Indicates whether the user should be asked for evidence for source.
-
RelationTemplatePart.source_relationtemplate¶
-
RelationTemplatePart.source_type¶
-
RelationTemplatePart.used_as_object¶
-
RelationTemplatePart.used_as_source¶
-
-
class
annotations.models.Repository(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelRepresents an online repository from which
Texts can be retrieved.Deprecated since version 0.5: Use
repository.models.Repositoryinstead.We assume that there is a manager (see
annotations.managers) for eachRepositorythat provides CRUD methods.Todo
Can we gracefully remove this without breaking migrations?
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Repository.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Repository.endpoint= None¶ The base URL for the repository API.
-
Repository.get_manager_display(*moreargs, **morekwargs)¶
-
Repository.loadedTexts¶
-
Repository.manager= None¶ The name of the manager class for this repository.
-
Repository.name= None¶ The human-readable name that will be presented to end users.
-
Repository.oauth_client_id= None¶ **.. todo* –* – This should be moved to a more general formatted configuration in
repository.
-
Repository.oauth_secret_key= None¶ **.. todo* –* – This should be moved to a more general formatted configuration in
repository.
-
Repository.objects= <django.db.models.manager.Manager object>¶
-
exception
-
class
annotations.models.TemporalBounds(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelDeprecated since version 0.5: We now fully implement the Quadruple model in VogonWeb. See
DateAppellation.-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
TemporalBounds.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
TemporalBounds.end¶ A placeholder class that provides a way to set the attribute on the model.
-
TemporalBounds.objects= <django.db.models.manager.Manager object>¶
-
TemporalBounds.occur¶ A placeholder class that provides a way to set the attribute on the model.
-
TemporalBounds.relation_set¶
-
TemporalBounds.start¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
annotations.models.Text(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelRepresents a document that is available for annotation.
Todo
Add a field to store arbitrary metadata about the document.
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Text.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Text.added= None¶ The date and time when the text was added to VogonWeb.
-
Text.addedBy¶ The user who added the text to VogonWeb.
-
Text.annotation_count¶ The combined number of
Appellations andRelations that have been created using this text.
-
Text.annotators¶ If a text is non-public, these users are authorized to access and annotate that text.
-
Text.appellation_set¶
-
Text.created= None¶ The publication or creation date of the original document.
-
Text.dateappellation_set¶
-
Text.get_next_by_added(*moreargs, **morekwargs)¶
-
Text.get_previous_by_added(*moreargs, **morekwargs)¶
-
Text.objects= <django.db.models.manager.Manager object>¶
-
Text.originalResource= None¶ The (online) location of the original resource, or its digital surrogate.
-
Text.partOf¶
-
Text.public= None¶ If
True(default), the full content of this text will be made publicly available.
-
Text.relation_count¶ The number of
RelationSets that have been created using this text.
-
Text.relation_set¶
-
Text.relationsets¶
-
Text.source¶ The repository (if applicable) from which the text was retrieved.
Todo
This should target
repository.Repositoryrather thanannotations.Repository.
-
Text.title= None¶ The original title of the document.
-
Text.tokenizedContent= None¶ Text should already be tagged, with <word> elements delimiting tokens.
-
Text.uri= None¶ This identifier is used when submitting
RelationSets to Quadriga.Todo
Make this field non-changeable once it is set.
-
exception
-
class
annotations.models.TextCollection(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelThis is referred to as a “Project” in most cases.
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
TextCollection.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
TextCollection.get_next_by_created(*moreargs, **morekwargs)¶
-
TextCollection.get_previous_by_created(*moreargs, **morekwargs)¶
-
TextCollection.objects= <django.db.models.manager.Manager object>¶
-
TextCollection.ownedBy¶
-
TextCollection.participants¶
-
TextCollection.quadriga_id= None¶ This ID will be used when submitting
RelationSets to Quadriga. If not set, the default value (seeQUADRIGA_PROJECTin settings) will be used instead.
-
TextCollection.texts¶
-
exception
-
class
annotations.models.TupleField(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.TextField-
contribute_to_class(cls, name, **kwargs)¶
-
description= 'Stores a Python tuple of instances of built-in types'¶
-
-
class
annotations.models.VogonGroup(id, name)[source]¶ Bases:
django.db.models.base.Model-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
VogonGroup.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
VogonGroup.objects= <annotations.models.GroupManager object>¶
-
VogonGroup.permissions¶
-
exception
-
class
annotations.models.VogonUser(id, password, last_login, is_superuser, username, email, affiliation, location, link, full_name, conceptpower_uri, imagefile, is_active, is_admin)[source]¶ Bases:
django.contrib.auth.models.AbstractBaseUser,django.contrib.auth.models.PermissionsMixin-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
VogonUser.MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
VogonUser.REQUIRED_FIELDS= ['email']¶
-
VogonUser.USERNAME_FIELD= 'username'¶
-
VogonUser.accessions¶
-
VogonUser.add_obj_perm(perm, obj)¶
-
VogonUser.addedTexts¶
-
VogonUser.affiliation= None¶ The user’s home institution or employer.
-
VogonUser.appellation_set¶
-
VogonUser.collections¶
-
VogonUser.conceptpower_uri= None¶ Ideally, each
VogonUserwill have a corresponding record in Conceptpower that we can submit to Quadriga along with annotations. This is not typicaly at the moment, but we should create a mechanism to make this easy.
-
VogonUser.contributes_to¶
-
VogonUser.dateappellation_set¶
-
VogonUser.del_obj_perm(perm, obj)¶
-
static
VogonUser.get_anonymous()¶
-
VogonUser.groups¶
-
VogonUser.has_module_perms(app_label)[source]¶ Does the user have permissions to view the app app_label?
-
VogonUser.imagefile= None¶ Location of the user’s profile picture. This will usually be in our AWS S3 bucket.
-
VogonUser.is_active= None¶ If this field is
False, the user will not be able to log in.
-
VogonUser.is_staff¶ Is the user a member of staff?
Returns: Return type: bool
-
VogonUser.link= None¶ The location of the user’s online bio or homepage.
-
VogonUser.location= None¶ The user’s current geographical location.
-
VogonUser.logentry_set¶
-
VogonUser.objects= <annotations.models.VogonUserManager object>¶
-
VogonUser.relation_set¶
-
VogonUser.relationset_set¶
-
VogonUser.uri¶ The Uniform Resource Identifier (URI) for this
VogonUser.This is required for accessioning annotations into Quadriga.
Returns: Return type: unicode
-
VogonUser.userTexts¶
-
VogonUser.user_permissions¶
-
VogonUser.userobjectpermission_set¶
-
exception