class ResourceBody(AnnotationBody): iri = StringProperty(required=True, index=True, show=True) name = StringProperty(index=True, show=True) spatial = ArrayProperty(FloatProperty(), show=True) # [lat, long] detected_objects = RelationshipFrom('ODBody', 'CONCEPT', cardinality=ZeroOrMore)
class NonAVEntity(Creation): """ Non-audiovisual objects in IMC can be pictures, photos, correspondence, books, periodicals etc. Attributes: date_created The point or period of time associated with the creation of the non-audiovisual creation ("CCYY-MM-DD", "CCYY", CCYY-CCYY). If the production year is unknown, the term “unknown” should be added to indicate that research regarding the production time has been unsuccessful. non_av_type The general type of the non-audiovisual manifestation ("image" or "text"). specific_type This element further specifies the type of the non-audiovisual entity. phisical_format_size The dimensions of the physical object. colour This element can be used to indicate the colour of a non-audiovisual object (e.g. "black and white", "colour", "mixed"). """ date_created = ArrayProperty(StringProperty(), show=True) non_av_type = StringProperty(required=True, choices=codelists.NON_AV_TYPES, show=True) specific_type = StringProperty(required=True, choices=codelists.NON_AV_SPECIFIC_TYPES, show=True) phisical_format_size = ArrayProperty(StringProperty(), show=True) colour = StringProperty(choices=codelists.COLOUR, show=True)
class Keyword(StructuredNode): """ A term or set of vocabulary terms describing the content of a creation. This can be keywords or other vocabularies to describe subjects. Controlled and uncontrolled terms can be used together, but not within a single set of terms. Likewise, if more than one controlled vocabulary is used, then terms from each of these must be contained in a separate instance of this element. A separate instance is also required for each language if terms in more than one language are taken from a multilingual vocabulary. Attributes: term The term value. This can be the textual value of the term. For non-textual terms the classification codes, preferably a combination of the code and the verbal class description should be indicated. termID A non-text identifier that can be combined with the scheme ID from a unique resource identifier for the term within a controlled vocabulary. keyword_type Type of information described by the keywords. language The language of the content of each subject. schemeID A unique identifier denoting the controlled vocabulary (preferably URI). If the subject terms are not from a controlled vocabulary, the value of this element should be set to "uncontrolled". """ term = StringProperty(index=True, required=True, show=True) termID = IntegerProperty(show=True) keyword_type = StringProperty(choices=codelists.KEYWORD_TYPES, show=True) language = StringProperty(choices=codelists.LANGUAGE, show=True) schemeID = StringProperty(show=True) creation = RelationshipFrom('Creation', 'HAS_KEYWORD', cardinality=One, show=True)
class Description(StructuredNode): """ Wrapper for the description of a creation. Attributes: text Textual descriptions include synopses, plot summaries, reviews, transcripts or shot lists. They can occur in more than one language and they can have statements of authorship or references to external resources. language The language of the description text. description_type A keyword denoting the type of description. source_ref Either the name of the institution, or an URI identifying the source directly or via a reference system such as an on-line catalogue. """ text = StringProperty(index=True, required=True, show=True) language = StringProperty(choices=codelists.LANGUAGE, show=True) description_type = StringProperty(choices=codelists.DESCRIPTION_TYPES, show=True) source_ref = StringProperty(show=True) creation = RelationshipFrom('Creation', 'HAS_DESCRIPTION', cardinality=One, show=True)
class VideoFormat(StructuredNode): """ The description of the physical artefact or digital file on which an audiovisual manifestation is fixed. Attributes: gauge The width of the film stock or other carrier (such as magnetic tape) used for the manifestation. aspect_ratio The ratio between width and height of the image (e.g. "full frame", "cinemascope", "1:1,33"). sound Element from values list. colour Element from values list. """ gauge = StringProperty(choices=codelists.GAUGE, show=True) aspect_ratio = StringProperty(choices=codelists.ASPECT_RATIO, show=True) sound = StringProperty(choices=codelists.VIDEO_SOUND, show=True) colour = StringProperty(choices=codelists.COLOUR, show=True) creation = RelationshipFrom('AVEntity', 'VIDEO_FORMAT', cardinality=One, show=True) def __str__(self): return "VideoFormat: [gauge: {}, aspect_ratio: {}, sound: {}; colour {}]".format( self.gauge, self.aspect_ratio, self.sound, self.colour)
class Token(StructuredNode): jti = StringProperty(required=True, unique_index=True) token = StringProperty(required=True, unique_index=True) token_type = StringProperty() creation = DateTimeProperty(required=True) expiration = DateTimeProperty() last_access = DateTimeProperty() IP = StringProperty() hostname = StringProperty() emitted_for = RelationshipFrom('User', 'HAS_TOKEN', cardinality=ZeroOrOne)
class Rightholder(IdentifiedNode): """ Rightholder. Attributes: name Name of the copyright holder. url If available, URL to the homepage of the copyright holder. """ name = StringProperty(required=True, show=True) url = StringProperty(show=True) creation = RelationshipFrom('Creation', 'COPYRIGHTED_BY', cardinality=ZeroOrMore)
class Provider(IdentifiedNode): """ name The name of the archive supplying the record. identifier An unambiguous reference to the archive supplying the record. scheme Name of the registration scheme encoding the institution name ("ISIL code" or "Institution acronym") address The address of the archive phone The phone number of the archive fax The fax number of the archive website The website of the archive email The email of the archive city The city which the items refer to """ name = StringProperty(index=True, required=True, show=True) identifier = StringProperty(required=True, show=True) scheme = StringProperty(choices=codelists.PROVIDER_SCHEMES, required=True, show=True) address = StringProperty(required=False, show=True) phone = StringProperty(required=False, show=True) fax = StringProperty(required=False, show=True) website = StringProperty(required=False, show=True) email = EmailProperty(required=False, show=True) city = StringProperty(required=False, show=True) record_source = RelationshipFrom('RecordSource', 'RECORD_SOURCE', cardinality=ZeroOrMore)
class Coverage(StructuredNode): """ The spatial or temporal topic of the creation object. Attributes: spatial This may be a named place, a location, a spatial coordinate, a named administrative entity or an URI to a LOD-service. temporal This may be a period, date or range date. """ spatial = ArrayProperty(StringProperty(), required=True, show=True) temporal = ArrayProperty(StringProperty(), show=True) creation = RelationshipFrom('Creation', 'HAS_COVERAGE', cardinality=One, show=True)
class ContributionRel(StructuredRel): """ Attributes: activities One or more film-related activities of the person taken from relationship records or from secondary sources. """ activities = ArrayProperty(StringProperty(), show=True)
class Group(IdentifiedNode): fullname = StringProperty(required=True, unique_index=True, show=True) shortname = StringProperty(required=True, unique_index=True, show=True) members = RelationshipFrom('User', 'BELONGS_TO', cardinality=ZeroOrMore, show=True) coordinator = RelationshipFrom('User', 'PI_FOR', cardinality=ZeroOrMore, show=True) stage_files = RelationshipFrom('Stage', 'IS_OWNED_BY', cardinality=ZeroOrMore, show=False)
class RevisionRel(StructuredRel): """ Attributes: when Date of start or approval of a revision. state Revision status: Waiting or Running """ when = DateTimeProperty(default=lambda: datetime.now(pytz.utc), show=True) state = StringProperty(choices=codelists.REVISION_STATUS, show=True)
class Shot(VideoSegment): """Shot class""" shot_num = IntegerProperty(required=True, show=True) frame_uri = StringProperty() thumbnail_uri = StringProperty() timestamp = StringProperty(show=True) duration = FloatProperty(show=True) revision_confirmed = BooleanProperty(default=False, show=True) revision_check = BooleanProperty(default=False, show=True) item = RelationshipFrom('Item', 'SHOT', cardinality=One) embedded_segments = RelationshipFrom('VideoSegment', 'WITHIN_SHOT', cardinality=ZeroOrMore) revised_by = RelationshipTo('User', 'REVISED_BY', cardinality=ZeroOrMore, model=RevisionRel)
class User(IdentifiedNode): # uuid = StringProperty(required=True, unique_index=True) email = EmailProperty(required=True, unique_index=True, show=True) name = StringProperty(required=True, show=True) surname = StringProperty(required=True, show=True) authmethod = StringProperty(required=True) password = StringProperty() # Hashed from a custom function first_login = DateTimeProperty(show=True) last_login = DateTimeProperty(show=True) last_password_change = DateTimeProperty(show=True) is_active = BooleanProperty(default=True, show=True) privacy_accepted = BooleanProperty(default=True, show=True) tokens = RelationshipTo('Token', 'HAS_TOKEN', cardinality=ZeroOrMore) roles = RelationshipTo('Role', 'HAS_ROLE', cardinality=ZeroOrMore, show=True)
class User(IdentifiedNode): # uuid = StringProperty(required=True, unique_index=True) email = EmailProperty(required=True, unique_index=True, show=True) name = StringProperty(required=True, show=True) surname = StringProperty(required=True, show=True) authmethod = StringProperty(required=True) password = StringProperty() # Hashed from a custom function first_login = DateTimeProperty(show=True) last_login = DateTimeProperty(show=True) last_password_change = DateTimeProperty(show=True) tokens = RelationshipTo('Token', 'HAS_TOKEN', cardinality=ZeroOrMore) roles = RelationshipTo('Role', 'HAS_ROLE', cardinality=ZeroOrMore, show=True) externals = RelationshipTo('ExternalAccounts', 'HAS_AUTHORIZATION', cardinality=OneOrMore)
class RecordSource(StructuredNode): """ A reference to the IMC content provider and their local ID. Attributes: source_id The local identifier of the record. If this does not exist in the content provider´s database the value is "undefined". is_shown_at An unambiguous URL reference to the digital object on the web site of the source provider and/or on the content provider's web site in its full information context. """ source_id = StringProperty(required=True, show=True) is_shown_at = StringProperty(show=True) provider = RelationshipTo('Provider', 'PROVIDED_BY', cardinality=One, show=True) creation = RelationshipFrom('Creation', 'RECORD_SOURCE', cardinality=One)
class AVEntity(Creation): """ The AVEntity is designed to store descripticve metadata on IMC audiovisual objects provided by the archives with the initial ingest. This entity extends Creation class that wraps common metadata. Attributes: identifying_title A short phrase for identifying the audiovisual creation, to be used e.g. in human-readable result lists from database queries. identifying_title_origin Acronym or other identifier indicating the origin of the element content. production_years The year or time span associated with the production of the audiovisual creation (e.g. CCYY, CCYY-CCYY). production_countries The geographic origin of an audiovisual creation. This should be the country or countries where the production facilities are located. video_format The description of the physical artefact or digital file on which an audiovisual manifestation is fixed. view_filmography An unambiguous URL reference to the full filmographic entry of a film on the content provider web site. """ identifying_title = StringProperty(index=True, required=True, show=True) identifying_title_origin = StringProperty(index=True, show=True) production_years = ArrayProperty(StringProperty(), required=True, show=True) production_countries = RelationshipTo('Country', 'COUNTRY_OF_REFERENCE', cardinality=ZeroOrMore, model=CountryOfReferenceRel, show=True) video_format = RelationshipTo('VideoFormat', 'VIDEO_FORMAT', cardinality=ZeroOrOne, show=True) view_filmography = ArrayProperty(StringProperty(), show=True)
class Language(StructuredNode): """ ISO-639-1 LanguageCS Attributes: code The language code. labels The translation into different languages. """ code = StringProperty(choices=codelists.LANGUAGE, show=True, required=True) creation = RelationshipFrom('Creation', 'HAS_LANGUAGE', cardinality=ZeroOrMore)
class Title(StructuredNode): """Wrapper class for title. Attributes: text The textual expression of the title. language The language of the title. part_designations A combination of the name of a structuring unit and the count value that identifies the current entity as an individual part of a complex work. relation The type of relationship between the title and the entity to which it is assigned (e.g. "Original title", "Distribution title", "Translated title" etc). """ text = StringProperty(required=True, show=True) language = StringProperty(choices=codelists.LANGUAGE, show=True) part_designations = ArrayProperty(StringProperty(), show=True) relation = StringProperty(choices=codelists.AV_TITLE_TYPES, show=True) creation = RelationshipFrom('Creation', 'HAS_TITLE', cardinality=One, show=True)
class Annotation(IdentifiedNode, AnnotationTarget): """Annotation class""" ANNOTATION_TYPES = (('VQ', 'video quality'), ('VIM', 'video image motion'), ('TVS', 'temporal video segmentation'), ('TAG', 'tagging'), ('COM', 'commenting'), ('RPL', 'replying'), ('LNK', 'linking'), ('REP', 'reporting'), ('ASS', 'assessing'), ('DSC', 'describing'), ('BMK', 'bookmarking')) AUTOMATIC_GENERATOR_TOOLS = (('FHG', 'Fraunhofer tool'), ('VIS', 'Google Vision API'), ('AWS', 'Amazon Rekognition API')) annotation_type = StringProperty(required=True, choices=ANNOTATION_TYPES, show=True) creation_datetime = DateTimeProperty( default=lambda: datetime.now(pytz.utc), show=True) private = BooleanProperty(default=False, show=True) embargo = DateProperty(show=True) source_item = RelationshipTo('Item', 'SOURCE', cardinality=One, show=True) creator = RelationshipTo('User', 'IS_ANNOTATED_BY', cardinality=ZeroOrOne, model=AnnotationCreatorRel, show=True) generator = StringProperty(choices=AUTOMATIC_GENERATOR_TOOLS, show=True) bodies = RelationshipTo('AnnotationBody', 'HAS_BODY', cardinality=ZeroOrMore, show=True) targets = RelationshipTo('AnnotationTarget', 'HAS_TARGET', cardinality=OneOrMore, show=True) refined_selection = RelationshipTo('FragmentSelector', 'REFINED_SELECTION', cardinality=ZeroOrOne)
class Country(StructuredNode): """ ISO 3166-1, ISO 3166-2 (Region codes), ISO 3166-3, AFNOR XP2 44-002 Attributes: code The country code. labels The translation into different languages. """ code = StringProperty(choices=codelists.COUNTRY, show=True, required=True) creation = RelationshipFrom('AVEntity', 'COUNTRY_OF_REFERENCE', cardinality=ZeroOrMore)
class ExternalAccounts(StructuredNode): username = StringProperty(required=True, unique_index=True) token = StringProperty(required=True) email = StringProperty() certificate_cn = StringProperty() proxyfile = StringProperty() description = StringProperty(default='No description') main_user = RelationshipFrom(User, 'HAS_AUTHORIZATION', cardinality=OneOrMore)
class Stage(TimestampedNode, HeritableStructuredNode): # __abstract_node__ = True filename = StringProperty(required=True, show=True) path = StringProperty(required=True, unique_index=True, show=True) status = StringProperty(show=True) status_message = StringProperty(show=True) warnings = ArrayProperty(StringProperty(), show=True) task_id = StringProperty(show=True) ownership = RelationshipTo('Group', 'IS_OWNED_BY', cardinality=ZeroOrMore, show=True)
class User(UserBase): declared_institution = StringProperty(required=False, show=True, default="none") items = RelationshipFrom('Item', 'IS_OWNED_BY', cardinality=ZeroOrMore) annotations = RelationshipFrom('Annotation', 'IS_ANNOTATED_BY', cardinality=ZeroOrMore) belongs_to = RelationshipTo('Group', 'BELONGS_TO', show=True) coordinator = RelationshipTo('Group', 'PI_FOR', cardinality=ZeroOrMore, show=True) items_under_revision = RelationshipFrom('Item', 'REVISION_BY', cardinality=ZeroOrMore) revised_shots = RelationshipFrom('Shot', 'REVISED_BY', cardinality=ZeroOrMore)
class Agent(IdentifiedNode): """ It refers mostly to agents which are involved in the creation of the objects. Attributes: uuid Identifier generated by the system. external_ids IDs chosen from external schemas. record_sources List of sources from which the record comes. agent_type Defines the type of the Agent (person, corporate body, family etc.). names Name(s) by which the entity is (or was) known. birth_date Date of birth ("CCYY-MM-DD" or "CCYY"). death_date Date of death ("CCYY-MM-DD" or "CCYY"). biographical_note Short biographical note about a person or organisation. biography_views Unambiguous URL references to a full biographical entry in an external database or on content provider's website. """ # record_sources = RelationshipTo( # 'RecordSource', 'RECORD_SOURCE', cardinality=OneOrMore, show=True) external_ids = ArrayProperty(StringProperty(), show=True) agent_type = StringProperty(required=True, choices=codelists.AGENT_TYPES, show=True) names = ArrayProperty(StringProperty(), required=True, show=True) birth_date = DateProperty(show=True) death_date = DateProperty(default=None, show=True) biographical_note = StringProperty() sex = StringProperty(choices=codelists.SEXES, show=True) biography_views = ArrayProperty(StringProperty()) creation = RelationshipFrom('Creation', 'CONTRIBUTED_BY', cardinality=ZeroOrMore, show=True)
class Role(StructuredNode): name = StringProperty(required=True, unique_index=True, show=True) description = StringProperty(default='No description', show=True) privileged = RelationshipFrom(User, 'HAS_ROLE', cardinality=OneOrMore)
class BibliographicReference(AnnotationBody): title = StringProperty(required=True, show=True) authors = ArrayProperty(StringProperty(), required=True, show=True) book_title = StringProperty(show=True) journal = StringProperty(show=True) volume = StringProperty(show=True) number = StringProperty(show=True) year = IntegerProperty(show=True) month = IntegerProperty(show=True) editor = StringProperty(show=True) publisher = StringProperty(show=True) address = StringProperty(show=True) url = StringProperty(show=True) isbn = StringProperty(show=True) doi = StringProperty(show=True)
class AudioBody(AnnotationBody): audio_format = StringProperty(show=True) language = StringProperty(show=True)
class ODBody(AnnotationBody): """Detected Object""" object_id = StringProperty(required=True, show=True) confidence = FloatProperty(required=True, show=True) object_type = RelationshipTo('ResourceBody', 'CONCEPT', cardinality=One)
class TextualBody(AnnotationBody): value = StringProperty(required=True, show=True) language = StringProperty(show=True)