One of the basics I want to share with you in this publication.
Elements: theoretical part
An element (object) is a unit: material, abstract or conditional. ')
Containers and objects
The elements are divided into: container (K), container object (KO) and object (O).
Container (K) - an element that can contain other elements - container objects (KO) or objects (O). The container itself cannot be inside of anything.
Container Object (KO) is an element that can contain other elements - container objects (KO) and objects (O), and at the same time it can be inside a container object (KO) or container (K).
An object (O) is an element that cannot contain other elements within itself, but can itself be inside a container object (QO) or container (K).
Relativity
Each of the elements can be considered separately:
As a Container, cutting off information about everything inside of which it can be, making it original, in relation to which we will consider everything else. For example: a book, when we take it for a Container, it doesn’t matter that it is in a room or in a closet on a shelf, only it’s important and what’s inside it (sheets, pages, text, chapters, paragraphs, sentences, words , syllables, letters, symbols).
As a container object. Then it is taken into account, and what is inside the element, and what is inside itself.
An object. When we consider an element as O, then we directly go to its type and properties, while not forgetting about the element within which it can be. If we turn to the consideration of the book as an object, then we begin to consider its parameters: length, thickness, width, author, title, etc.
Types and Properties
Each element has its own type.
An item type is a specific set of item properties.
You can also say that the element has a list (set) of properties. This list has a name and, saying “element type”, we mean (we mean) the name of this list.
Element properties - describe the element. Conventionally, you can take anything for a property. Element properties are ordinary (basic) and composite, based on the interaction of basic properties or other information including. the interaction of elements.
For example, here is a list of the element properties:
Width
Length
Radius
Circumference
Height
Thickness
Hearing
Vision
Perimeter
Square
Circumference
...
Each of the element types above has its own set of properties. So, for example, the element type: square, has properties 1, 2, 9, and 10, and type: circle has properties 3, 4, and 11. Properties 10 and 11 are composite properties, so they run separately from each other.
Hearing and vision, although not related to geometric shapes, but if we conditionally took them for the properties of the element, they will be on this list and will be of the type: animal.
Following the trailing properties of magnitude: cm, mm, km, kg, second, minute, hour, Hz, Ohm, etc.
If we consider an element as an Object, then we proceed to consider the properties of this element. If we consider an element as K or KO, then we consider a list of elements that are inside K or KO, if they are there. If inside K or KO there are no elements, it would be appropriate to treat them immediately as an Object.
Interactions
Elements can interact with each other, even though each of them may be in a different branch of the tree (DOM). The interaction between elements and element types occurs within a specific pattern.
Interactions are otherwise called intersections (cross).
Take the two elements E1 and E2. When crossing, E1 and E2 may have some influence on each other:
E1 has an effect on E2.
E2 has an effect on E1.
E1 and E2 have equal or no influence on each other.
If we consider the example with the address given above, then if Ivan Ivanovich is taken as E1, and his apartment is E2, then the first interaction option will suit us, since Ivan Ivanovich can sell his apartment. The apartment does not have an impact on Ivanovich.
And if for E1 we take the Worker, and for E2, the work, then option 3, since The employee works and he gets paid for it, and the employee can be fired from his job or he can quit. In addition to the influence of the interaction stands out: K, KO and O:
K and K.
K and KO.
K and O.
KO and KO.
KO and O.
O and O.
What is the practical use of all this?
To begin with, each element has its own identifier (ID), knows its parent (parent), has its own type (type), and the order of display inside the parent (sort).
If you store this information in the database, the table will look like this:
id (int)
parent (int)
type (int)
sort (int)
one
Null
one
0
2
one
2
0
3
2
3
0
Actually, element types should have their own reference table:
id (int)
title (vchar)
name (vchar)
one
Triangle
triangle
2
A circle
Circle
3
Square
square
Behind the types will pull the list of properties:
id (int)
title (vchar)
name (vchar)
one
Width
width
2
Length
length
3
Height
height
four
Radius
radius
And lists of type properties (which properties of which type)
type (int)
property (int)
3
one
3
2
2
four
Table-reference Values ​​(value (id, title, name)), in which property values ​​are measured.
id (int)
title (vchar)
name (vchar)
one
px
px
2
cm
sm
3
minute
min
four
second
sec
But this is what basics swing. Each property can have its own separate table in which certain data will be stored. For example, the Width table (a table of the size of one of the sides that defines the width).
Records are not assigned to the property, but to the ID of the element whose type has this property.
elementID (int)
width (int)
valueID (int)
3
50
one
Next come the crossings (cross)
elementID1 (int)
elementID2 (int)
pattern (int)
type (int)
effect (int)
one
2
one
one
one
Pattern - Intersection patterns, table reference.
id (int)
title (vchar)
name (vchar)
one
Address
address
Type - Intersection types (k-ko or ko-o), as well as the usual reference book similar pattern. Effect - consider the effect of one element on another.
Columns Type and Effect as practice has shown can be omitted. Maybe these columns will come in handy sometime, somewhere ...
The basis of the database is ready.
If we take categories and publications, that is, an element of type “category”, and there is an element of type “publication.” Elements of type “publication” are inside an element of type “Category”. The type “publication” pulls the properties “content”, “images”, “video”, “prices” (if it is a product), etc.
What about you can rush with this basis at hand?
Restructured OKUN List-Directory (All-Russian Classification of Services to the Population)
In this image, the OKUN is considered as a CO. list of items.
In this image, one of the Elements (OCUN) is considered as O, i.e. its properties.
Additional images for example
A game, or something else. A visual representation of some idea.
Both works have the same basis and database. Only different types and properties of elements, and visually they are presented in different ways.