sanskrit_data.schema.ullekhanam

Intro

  • Annotations are stored in a directed acyclic graph, for example - a book portion having a TextAnnotation having PadaAnnotations having SamaasaAnnotations.

    • Some Annotations (eg. SandhiAnnotation, TextAnnotation) can have multiple “targets” (ie. other objects being annotated).
    • Rather than a simple tree, we end up with a Directed Acyclic Graph (DAG) of Annotation objects.
  • JSON schema mindmap here (Updated as needed).

  • For general context and class diagram, refer to schema.

class sanskrit_data.schema.ullekhanam.Annotation[source]

Bases: sanskrit_data.schema.common.UllekhanamJsonObject

classmethod get_allowed_target_classes()[source]
schema = {'description': 'Some JsonObject which can be saved as a document in the ullekhanam database.', 'properties': {'source': {'jsonClass': {'enum': ['DataSource']}, 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}}, 'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.'}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['Annotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
set_base_details(targets, source)[source]
class sanskrit_data.schema.ullekhanam.CommentAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.TextAnnotation

classmethod get_allowed_target_classes()[source]
schema = {'description': 'A comment that can be associated with nearly any Annotation or BookPortion.', 'properties': {'content': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'language_code': {'type': 'string'}}}, 'source': {'jsonClass': {'enum': ['DataSource']}, 'required': ['source_type', 'jsonClass'], 'type': 'object', 'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['CommentAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['content', 'source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.ImageAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

Mark a certain fragment of an image.

An introductory video

classmethod from_details(targets, source)[source]
classmethod get_allowed_target_classes()[source]
schema = {'description': 'A rectangle within an image, picked by a particular annotation source.', 'properties': {'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'rectangle', 'jsonClass'], 'type': 'object', 'description': 'The rectangle within the image being targetted.', 'properties': {'container_id': {'type': 'string'}, 'rectangle': {'required': ['y1', 'h', 'x1', 'w', 'jsonClass'], 'type': 'object', 'description': 'A rectangle within an image.', 'properties': {'y1': {'type': 'integer'}, 'h': {'type': 'integer'}, 'x1': {'type': 'integer'}, 'w': {'type': 'integer'}, 'jsonClass': {'enum': ['Rectangle'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'jsonClass': {'enum': ['ImageTarget'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['ImageAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
target_class

alias of ImageTarget

class sanskrit_data.schema.ullekhanam.ImageTarget[source]

Bases: sanskrit_data.schema.common.Target

classmethod from_details(container_id, rectangle)[source]
schema = {'description': 'The rectangle within the image being targetted.', 'properties': {'container_id': {'type': 'string'}, 'rectangle': {'required': ['y1', 'h', 'x1', 'w', 'jsonClass'], 'type': 'object', 'description': 'A rectangle within an image.', 'properties': {'y1': {'type': 'integer'}, 'h': {'type': 'integer'}, 'x1': {'type': 'integer'}, 'w': {'type': 'integer'}, 'jsonClass': {'enum': ['Rectangle'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'jsonClass': {'enum': ['ImageTarget'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['container_id', 'rectangle', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.Metre[source]

Bases: sanskrit_data.schema.common.NamedEntity

schema = {'properties': {'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'language_code': {'type': 'string'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Metre'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.MetreAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

schema = {'description': 'A metre, which may be ', 'properties': {'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'jsonClass': {'enum': ['MetreAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'metre': {'required': ['jsonClass'], 'type': 'object', 'properties': {'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'language_code': {'type': 'string'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Metre'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.OriginAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

See schema.description.

schema = {'description': 'A given text may be quoted from some other book. This annotation helps specify such origin.', 'properties': {'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'jsonClass': {'enum': ['OriginAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'originDetails': {'required': ['jsonClass'], 'type': 'object', 'properties': {'authors': {'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'language_code': {'type': 'string'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['NamedEntity'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'language_code': {'type': 'string'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['CreationDetails'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.QuoteAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.TextAnnotation

classmethod get_allowed_target_classes()[source]
schema = {'description': 'A quote, a memorable text fragment.', 'properties': {'content': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'language_code': {'type': 'string'}}}, 'source': {'jsonClass': {'enum': ['DataSource']}, 'required': ['source_type', 'jsonClass'], 'type': 'object', 'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}}}, 'editable_by_others': {'default': False, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['QuoteAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['content', 'source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.RatingAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

See schema.description.

schema = {'description': 'A given text may be quoted from some other book. This annotation helps specify such origin.', 'properties': {'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'jsonClass': {'enum': ['RatingAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'editable_by_others': {'default': False, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'rating': {'type': 'number'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.Rectangle[source]

Bases: sanskrit_data.schema.common.JsonObject

classmethod from_details(x=-1, y=-1, w=-1, h=-1, score=0.0)[source]
schema = {'description': 'A rectangle within an image.', 'properties': {'y1': {'type': 'integer'}, 'h': {'type': 'integer'}, 'x1': {'type': 'integer'}, 'w': {'type': 'integer'}, 'jsonClass': {'enum': ['Rectangle'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['y1', 'h', 'x1', 'w', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.TextAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

classmethod add_indexes(db_interface)[source]
classmethod from_details(targets, source, content)[source]
classmethod get_allowed_target_classes()[source]
schema = {'description': "Annotation of some (sub)text from within the object (image or another text) being annotated. Tells: 'what is written in this image? or text portion?", 'properties': {'content': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'language_code': {'type': 'string'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['TextAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['content', 'source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.TextOffsetAddress[source]

Bases: sanskrit_data.schema.common.JsonObject

classmethod from_details(start, end)[source]
schema = {'description': 'A way to specify a substring.', 'properties': {'start': {'type': 'integer'}, 'end': {'type': 'integer'}, 'jsonClass': {'enum': ['TextOffsetAddress'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.TextTarget[source]

Bases: sanskrit_data.schema.common.Target

classmethod from_details(container_id, shabda_id=None, offset_address=None)[source]
schema = {'description': 'A way to specify a particular substring within a string.', 'properties': {'shabda_id': {'type': 'string', 'description': "Format: pada_index.shabda_index or just pada_index.Suppose that some shabda in 'r\xc4\x81g\xc4\x81dirog\xc4\x81n satat\xc4\x81nu\xe1\xb9\xa3akt\xc4\x81n' is being targetted. This has the following pada-vigraha: r\xc4\x81ga [comp.]-\xc4\x81di [comp.]-roga [ac.p.m.] satata [comp.]-anu\xe1\xb9\xa3a\xc3\xb1j [ac.p.m.].Then, r\xc4\x81ga has the id 1.1. roga has id 1.3. satata has the id 2.1."}, 'container_id': {'type': 'string'}, 'offset_address': {'required': ['jsonClass'], 'type': 'object', 'description': 'A way to specify a substring.', 'properties': {'start': {'type': 'integer'}, 'end': {'type': 'integer'}, 'jsonClass': {'enum': ['TextOffsetAddress'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'jsonClass': {'enum': ['TextTarget'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['container_id', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.Topic[source]

Bases: sanskrit_data.schema.common.NamedEntity

schema = {'properties': {'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'language_code': {'type': 'string'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Topic'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.TopicAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

See schema.description.

schema = {'description': 'A given text may be quoted from some other book. This annotation helps specify such origin.', 'properties': {'topic': {'required': ['jsonClass'], 'type': 'object', 'properties': {'names': {'minItems': 1, 'items': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'language_code': {'type': 'string'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Topic'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'source': {'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'required': ['source_type', 'jsonClass'], 'type': 'object', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'jsonClass': {'enum': ['DataSource']}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['TopicAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.TranslationAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.TextAnnotation

classmethod get_allowed_target_classes()[source]
schema = {'description': 'A comment that can be associated with nearly any Annotation or BookPortion.', 'properties': {'content': {'required': ['jsonClass'], 'type': 'object', 'properties': {'search_strings': {'items': {'type': 'string'}, 'type': 'array', 'description': 'Search strings which should match this text. It could be derived from script_renderings - by a simple copy (intended for use with a text index) or some intelligent tokenization thereof.'}, 'jsonClass': {'enum': ['Text'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'script_renderings': {'minItems': 1, 'items': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array'}, 'language_code': {'type': 'string'}}}, 'source': {'jsonClass': {'enum': ['DataSource']}, 'required': ['source_type', 'jsonClass'], 'type': 'object', 'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['TranslationAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['content', 'source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.ValidationAnnotation[source]

Bases: sanskrit_data.schema.ullekhanam.Annotation

schema = {'description': "Any user can validate a certain annotation (or other object). But it is up to various systems whether such 'validation' has any effect.", 'properties': {'source': {'jsonClass': {'enum': ['DataSource']}, 'required': ['source_type', 'jsonClass'], 'type': 'object', 'description': 'Source of the json-data which contains this node. Eg. Uploader details in case of books, annotator in case of annotations. Consider naming the field that contains this object `source` to make querying uniform.', 'properties': {'source_type': {'default': 'system_inferred', 'enum': ['system_inferred', 'user_supplied'], 'type': 'string', 'description': 'Does this data come from a machine, or a human? source_ prefix avoids keyword conflicts in some languages.'}, 'jsonClass': {'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}, 'id': {'type': 'string', 'description': 'Something to identify the particular data source.'}, 'by_admin': {'type': 'boolean', 'description': 'Was the creator of this data an admin at the time it was created or updated?'}}}, 'editable_by_others': {'default': True, 'type': 'boolean', 'description': 'Can this annotation be taken over by others for wiki-style editing or deleting?'}, 'targets': {'minItems': 1, 'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'properties': {'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['Target'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}}, 'type': 'array', 'description': 'This field lets us define a directed graph involving JsonObjects stored in a database.'}, 'jsonClass': {'enum': ['ValidationAnnotation'], 'type': 'string', 'description': 'A hint used by json libraries to deserialize json data to an object of the appropriate type. This is necessary for sub-objects to have as well (to ensure that the deserialization functions as expected).'}}, 'required': ['source', 'targets', 'jsonClass'], 'type': 'object'}
class sanskrit_data.schema.ullekhanam.ValidationAnnotationSource[source]

Bases: sanskrit_data.schema.common.DataSource

We don’t override the schema here as no new fields are added.

setup_source(db_interface=None, user=None)[source]