How to submit the workbook as a database?


Prompt on such question. There is a book whose structure is very simple. Introduction, Chapters, subchapters of the same level, and a list of sources. But there is a problem in each Chapter there are pictures and formulas. That I do not understand how in the database to store images and formulas, and how to normalize? Database, you can use any.
Maybe someone has done this or think something will be?
July 9th 19 at 10:05
4 answers
July 9th 19 at 10:07
The implementation depends on the ultimate goals of your task.
The picture is a set of bytes, typically the database includes a blob. Can for images a separate table.
int id,
blob data

Formula the same set of data can be stored in the same table (including specifying the type through the field, for example int typeofdata).
Next, make a bunch Chapter. This link in the head < img id='N' > and if you need level search byzy, it is still an additional plate bundle (ID head - ID of the image or of the formula)
I do not quite understand this "Is a link in the head < img id='N' > " I understand that is a table "sub-Chapter", which in the field, for example text (varchar) will contain the text of the Chapter, and of this field will link to the table with formulas and symbols? - kadin_Hyatt commented on July 9th 19 at 10:10
in test varchar and write a in place of formulas or images < img id='N' >, as is done in html - candida_Upton commented on July 9th 19 at 10:13
: I do not understand what is substituted instead of N? How it will eventually look, for example, when displaying on the html page? And what is link table with the heads will be connected with a table with pictures and formulas? One-to-many? - kadin_Hyatt commented on July 9th 19 at 10:16
Instead of N substitutes the value of the ID from the table with pictures. That is, the final connection must be implemented by your application that displays this book. - candida_Upton commented on July 9th 19 at 10:19
July 9th 19 at 10:09
chapters ( // Chapter
id int,
title text,
body text
id_parent int, can be null

attachments ( // files (formulas, pictures, etc.)
id int,
id_type int
title text,
file blob // binary contents of the image files and formulas

attachment_types ( // types of files
id int,
name text

chapter_attachments ( // attitude files to chapters
id_chapter int
id_attachment int
order int // if need to sort the attachments in chapters
July 9th 19 at 10:11
our database stored the path to images
July 9th 19 at 10:13
This: .docx
Need to get: tree structure of the text (in the table of contents to match the ID parts of the text) of the text (+markings), objects: images, formulas, videos etc.
1. First, we share the table of contents and content.
2. On the basis of the table of contents, building the "tree" and "leaves" of the content (text).
3. For each part of the text formed the view template (%paragraph,%, %note%, %formula%, %picture%, etc.).
4. The whole "clean" text (contained within the presentation template) - keep separately determined for each ID in the markup.
5. Everything that is not related to the text - make into separate objects, also assigning the ID and stamped ID of these objects in the template.

In the end we will get:
1. structure ("tree": a table of contents with "leaves": the ID of a template of the target text)
2. the view template of each "leaf" of structure (markup and ID-shnik components)
3. the component store "sheet" element. (pieces of text, images, formulas, videos etc.)

After that you can make the database structure.

Find more questions by tags Databases