sanskrit_data.schema.books¶
Intro¶
Here we define data-containers to store books. Books are stored or represented as a tree of BookPortion objects - book containing many chapters containing many lines etc..
- JSON schema mindmap here (Updated as needed).
- An introductory video.
- For general context and class diagram, refer to
schema
.
-
class
sanskrit_data.schema.books.
BookMetadata
[source]¶ Bases:
sanskrit_data.schema.common.JsonObject
-
schema
= {'required': ['name', 'jsonClass'], 'type': 'object', 'properties': {'issuePage': {'type': 'string'}, 'canonicalSource': {'type': 'string'}, 'jsonClass': {'enum': ['Language'], 'type': 'string'}, 'name': {'type': {'required': ['jsonClass'], 'type': 'object', 'properties': {'language_code': {'type': 'string'}, 'script_renderings': {'items': {'type': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string'}}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string'}}}}, 'authors': {'items': {'type': {'required': ['jsonClass'], 'type': 'object', 'properties': {'language_code': {'type': 'string'}, 'script_renderings': {'items': {'type': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string'}}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string'}}}}, 'type': 'array'}}}¶
-
-
class
sanskrit_data.schema.books.
BookPortion
[source]¶ Bases:
sanskrit_data.schema.common.JsonObjectWithTarget
-
classmethod
from_details
(title, path=None, authors=None, targets=None, base_data=None, curated_content=None, portion_class=None, publication_details=None)[source]¶
-
schema
= {'required': ['jsonClass'], 'type': 'object', 'description': 'A BookPortion could represent a Book or a chapter or a verse or a half-verse or a sentence or any such unit.', 'properties': {'title': {'type': 'string'}, 'base_data': {'enum': ['image', 'text'], 'type': 'string'}, 'portion_class': {'type': 'string', 'description': 'book, part, chapter, verse, line etc..'}, 'authors': {'items': {'type': 'string'}, 'type': 'array'}, 'thumbnail_path': {'type': 'string'}, 'path': {'type': 'string'}, 'curated_content': {'required': ['jsonClass'], 'type': 'object', 'properties': {'language_code': {'type': 'string'}, 'script_renderings': {'items': {'type': {'required': ['text', 'jsonClass'], 'type': 'object', 'properties': {'encoding_scheme': {'type': 'string'}, 'text': {'type': 'string'}, 'jsonClass': {'enum': ['ScriptRendering'], 'type': 'string'}}}}, 'type': 'array'}, 'jsonClass': {'enum': ['Text'], 'type': 'string'}}}, 'targets': {'items': {'required': ['container_id', 'jsonClass'], 'type': 'object', 'description': 'A BookPortion could represent a Book or a chapter or a verse or a half-verse or a sentence or any such unit.', 'properties': {'position': {'type': 'number', 'description': 'Any number describing the position of one BookPortion within another.'}, 'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['BookPositionTarget', 'Target'], 'type': 'string'}}}, 'description': 'Target for BookPortion of which this BookPortion is a part. It is an array only for consistency. For any given BookPortion, one can get the right order of contained BookPortions by seeking all BookPortions referring to it in the targets list, and sorting them by their target position values.', 'maxLength': 1}, 'publication_details': {'required': ['jsonClass'], 'type': 'object', 'description': 'Publication details of a BookPortion.', 'properties': {'release_time': {'type': 'string'}, 'publisher': {'type': 'string'}, 'jsonClass': {'enum': ['PublicationDetails'], 'type': 'string'}}}, 'jsonClass': {'enum': ['BookPortion'], 'type': 'string'}}}¶
-
target_class
¶ alias of
BookPositionTarget
-
classmethod
-
class
sanskrit_data.schema.books.
BookPositionTarget
[source]¶ Bases:
sanskrit_data.schema.common.Target
-
schema
= {'required': ['container_id', 'jsonClass'], 'type': 'object', 'description': 'A BookPortion could represent a Book or a chapter or a verse or a half-verse or a sentence or any such unit.', 'properties': {'position': {'type': 'number', 'description': 'Any number describing the position of one BookPortion within another.'}, 'container_id': {'type': 'string'}, 'jsonClass': {'enum': ['BookPositionTarget', 'Target'], 'type': 'string'}}}¶
-
-
class
sanskrit_data.schema.books.
PublicationDetails
[source]¶ Bases:
sanskrit_data.schema.common.JsonObject
-
schema
= {'required': ['jsonClass'], 'type': 'object', 'description': 'Publication details of a BookPortion.', 'properties': {'release_time': {'type': 'string'}, 'jsonClass': {'enum': ['PublicationDetails'], 'type': 'string'}, 'publisher': {'type': 'string'}}}¶
-