1. Introduction
The concept of an Index Matrix (IM) was introduced in [
1] and discussed in a series of papers and in books [
2,
3]. IMs are extensions of the well-known mathematical object “matrix” (see, e.g., [
4,
5]). Each of operation’s addition, subtraction, and multiplication, defined over standard matrices, requires specific conditions in order for these operations to be correctly performed. The introduction of IMs was inspired by the idea that matrices are redefined in such a way that all operations on them are valide and applicable, regardless of the differences in their dimensions. By giving the matrices and operations on them a more complex form, these conditions ensure greater possibilities for matrix calculus, as well as more applications. Firstly, all operations were developed in the two-dimensional (2D) case [
2,
3]. Later on, certain results obtained for 2D IMs became the basis for the development of the apparatus for three (3D)- and
n-dimensional matrices, namely 3-DIMs and n-DIMS, respectively. The analogues of operations defined on 2-DIMs for the case of 3-DIMs have been elaborated in [
2,
3]. The theory of IMs has been further explored in [
6].
Following [
2,
3], we will mention that one IM can be populated by the following: elements of the set {0, 1}, real or complex numbers, variables, predicates, functions, or even whole IMs. In the latter case, the IM is called an Extended IM (EIM). When elements of a given IM are intuitionistic fuzzy pairs, the object is called an intuitionistic fuzzy IM (IFIM) (see [
2]). Therefore, each IFIM is a particular case of an EIM. The EIMs were extended to three- and
n-dimensional EIMs (3-DEIMs and
n-DEIMs).
In the present paper, in
Section 2, we give short remarks on 3-DEIMs, in
Section 3 we introduce two new operations of a “symmetric difference” type over two 3-DEIMs, and investigate some of their basic properties. In
Section 4, we present an example of the implementation of “symmetric difference” operations in the field of relational databases. Finally, in the Conclusion, we outline the main achievements of the current investigation, and discuss some additional ideas for future research.
List of abbreviations used in the current investigation:
IM—index matrix
EIM—extended index matrix
3-DEIM—three- dimensional extended index matrix
n-DEIM—n-dimensional extended index matrix
IFIM—intuitionistic fuzzy index matrix
NGB theory—von Neumann–Bernays–Gödel set theory
3. Definitions of Two New Operations “Symmetric Difference” over Two 3-DIMs and Some of Their Properties
In [
7], two operations of “symmetric difference” are defined over 2-DIMs. In this investigation, we extend their definition to 3-DIMs.
Let the 3-DEIMs A and B defined above be given. For those, we define the following operations:
First operation “symmetric difference”:
where for every two arbitrary (standard set-theoretical) sets
Y and
Z:
and
Second operation “symmetric difference”:
where
For a better understanding of the two “symmetric difference”-type operations developed here, they were visualized as two IMs that share a subset of identical indices and identical values, as illustrated in
Figure 1. In the following
Figure 2 and
Figure 3, graphical representations of the first operation “symmetric difference” (
Figure 2) and of the second operation “symmetric difference” (
Figure 3) are given.
Let the operation × denote a Cartesian product between two (ordinary) sets.
Theorem 1. For every two 3-DEIMs A and B, for each operation and for operation defined for two arbitrary by , the following equalities:hold. Proof. From the definitions of operations ⊖ and
, we obtain:
where
From the definitions of operations
and the condition
, we obtain:
because, by definition,
that proves the theorem. □
Let
be the set of all 3-DEIMs with elements from
. We must mention that when
is a set (class) in the sense of von Neumann–Bernays–Gödel (NGB)-set theory (see, e.g., [
8,
9,
10]),
will be a set if its matrices have numerical elements, or a class when its matrices have arbitrary predicates as elements.
Let
where the symbol ⊥ denotes the absence of objects.
Theorem 2. is a commutative group.
Proof. Following the definition of a commutative group (see, [
11]), we will check the respective conditions. First, from the definition of operation “
”, for every two 3-DEIMs
, it follows that
.
Second, using the well-known equality (see, e.g., [
10]) for every three sets
, and
Z:
for every three 3-DEIMs
, where
we obtain
(where each element
is some element
or some element
)
(where each element
is some element
or some element
, or some element
)
(where each element
is some element
or some element
)
Third, for the 3-DEIM
and for an arbitrary
, we obtain:
(where each element
coincides with the element
from
A for
,
)
Fourth, from the well-known equality
for two sets, it follows that
Finally,
(due to a lack of indices, element
must be ⊥). The theorem is proven. □
Theorem 3. is a commutative monoid.
Proof. The proof of this assertion is similar to the proof of Theorem 2, but without the final, fifth step of the proof of Theorem 2. Therefore, as in the previous proof, we can prove that
is a commutative monoid, but this object is not a group due to the fact that there is no 3-DEIM
, such that for some 3-DEIM
This fact follows from the set-theoretical fact that there is no set
X, such that for some non-empty set
Y to hold,
□
As mentioned in the Introduction, each IFIM is a particular case of an EIM. Therefore, the two new operations developed in
Section 3 can be applied to IFIMs, and therefore to IMs with elements from fuzzy sets, where there is only the degree of agreement, and each intuitionistic fuzzy pair
might be reduced to only the degree of agreement
a and the degree of disagreement is
, while the degree of uncertainty from the intuitionistic fuzzy logic is 0.
4. “Symmetric Difference” Operations Implementation over Databases
The current section presents an example of the above elaborated “symmetric difference”-tye operations in the field of databases. It is known that the relational databases are based on relational algebra and relational calculus. Thereafter, there is a close relation between the group of set operations in the relational databases theory and “symmetric difference”-type operations. Relational algebra uses a set of operators to create new relations from existing ones, the main three of which are
union,
intersection, and
difference [
12,
13,
14]. The
union operation combines the data from two tables with a similar structure. The
intersection operation finds equal records in both tables. The operation
difference is used for returning the data from table
A that do not exist in table
B, and vice versa.
The
difference operation will be the focus of the current investigation. Venn diagrams are frequently used to visualize database set operations and types of joins. Venn diagrams of different types of
difference operation over sets are presented in
Figure 4.
In database management systems (DBMSs), the difference operation is used to identify records that differ between two union-compatible tables. In structured query language (SQL), this operation is implemented through operators EXCEPT or MINUS, depending on the specific DBMS. In addition to set operations, various types of relationships between two tables can be identified using JOIN statements. The present discussion focuses on the more complex case in which the tables being compared belong to two different databases.
An example of data sources presented in the form of two databases are firstly created. In this case, the
BooksRepository and
BookStoresChain databases have a similar structure. Databases are created using SQL Server Express 2022 and SQL Server Management Studio 21 [
12,
15,
16]. Database
BooksRepository contains
Repositories,
Places,
MaterialsAvailability, and
Materials, tables. Database
BookStoresChain includes
Bookstores,
Regions,
BookState,
Books and tables. The diagrams of both databases are presented in
Figure 5. The data from
BooksRepository and
BookStoresChain is queried by INNER JOIN statements and is presented in
Figure 6.
The first query, presented in
Figure 6, selects the columns
MaterialName from
Materials table,
RepositoryName from
Repositories table,
Town from
Places table and
Number from
MaterialsAvailability table from
BooksRepository database. The second query, presented in
Figure 6, selects the columns
Title from
Books table,
BookStoreName from
BookStores table,
TRegion from
Regions table and
Number from
BookStates table from
BookStoresChain database.
The “symmetric difference” operation can be effectively illustrated in the context of relational databases. By applying it, reports can be generated to present intersections, unions, and differences between datasets. These standard operations are typically performed on two-dimensional tables. Therefore, an example of the symmetric difference operation is first presented for 2D data. Subsequently, the discussion is extended to the case of 3D data.
The implementation of “symmetric difference” operation in a 2D case is demonstrated through the BooksRepository and BookStoresChains databases. The aim is that a list of books that are available only in the first database or only in the second database are extracted. The SQL statement to realize that is presented below:
SQL query:
The result of the SQL statement is presented in
Figure 7. It contains nine books that are available only in the
BookRepository database and three books that are available only in the
BookStoreChains database.
Further, the “symmetric difference” operation is further illustrated in the context of multidimensional databases. The objective is to compare several datasets with differing attributes and to highlight elements present in one dataset but absent in another. The construction of 3D structures is again based on the
BookStoresChain and
BooksRepository databases. Two OLAP (Online Analytical Processing) cubes are implemented, and the resulting tables are used for subsequent data transformation. The initial two-dimensional tables are preprocessed and transformed into 3D representations (
Figure 8 and
Figure 9). The
BooksRepository database is used for
BooksRepository OLAP cube generation. The tables
Materials,
Places and
Repositories are used for constructing dimensions. The table
MaterialsAvailability is used for number measure generation. The OLAP cube is made using SQL Server Analysis Services (SSAS) and Microsoft Visual Studio 2022 [
17]. The multidimensional language (MDX) query is executed to select the 3D data analogously to the 3D index matrices.
MDX query:
Result:
Figure 8.
MDX query representing 3D data from the BooksRepository OLAP cube.
Figure 8.
MDX query representing 3D data from the BooksRepository OLAP cube.
The same algorithm and instruments are used for
BookStoresChain OLAP cube generation. It is constructed using
BookStoresChains database tables.
Books,
Regions, and
Bookstores tables are extracted for creating the dimensions. The table
BookStates is used for Number measure selection. The MDX query is executed to select the 3D data similar to the 3D index matrices. The result is presented in
Figure 9.
MDX query:
Result:
Figure 9.
MDX query representing 3-D data from BookStoresChains OLAP cube.
Figure 9.
MDX query representing 3-D data from BookStoresChains OLAP cube.
It is well known that set operations are typically performed within a single OLAP data cube, where they are implemented by combining attribute groups across dimensions [
18]. In the present case, however, two OLAP cubes are involved. Therefore, the corresponding 3D tables are extracted and used for further processing. The “symmetric difference” operation is implemented in a separate application. To this end, OLAP data are extracted via an SSAS connection using Excel OLAP tools and represented as 3D tables. The table shown in
Figure 10 contains data from the
BookStoresChains OLAP cube, while the table presented in
Figure 11 includes data from the
BooksRepository OLAP cube.
Two tables from the
BooksRepository OLAP cube and
BookStoresChains OLAP cubes are cleaned and preprocessed to take the form presented in
Figure 12. The first two columns contain the values for attributes of two dimensions. The first row presents the attributes of the third dimension. These two tables are used for visualization of the “symmetric difference” operation. Another possible option is for the user to generate artificial files of a similar type.
4.1. An Illustration of the First “Symmetric Difference” Operation over Three-Dimensional Data
The “symmetric difference” operations are implemented in a Windows Forms (.NET Core 12) application using the programming language C#. The data from the two input tables are loaded into two programmatically generated DataGridView controls. These controls are designed to represent three dimensions. The first and second dimensions are visualized in the first two columns, while the third dimension is presented in the first row of the DataGridView controls.
The first operation “symmetric difference” identifies differing records across the dimensions by performing the suboperations BooksRepository minus BookStoresChains and BookStoresChains minus BooksRepository. The resulting data are then combined into a single dataset. The operation includes the following steps:
Case 1: The combination of:
- •
Titles of books stored in Materials table of BooksRepository database minus Titles of books stored in Books table of BookStoresChain database AND
- •
The names of bookshops stored in Repositories table of BooksRepository database minus the names of bookshops stored in BookStores table of BookStoresChains database AND
- •
The names of towns stored in Places table of BooksRepository database minus the names of towns stored in Regions table of BookStoresChains database.
Case 2: The combination of:
- •
Titles of books stored in Books table of BookStoresChains database minus titles of books stored in Materials table of BooksRepository database AND
- •
The names of bookshops stored in BookStores table of BookStoresChains database minus the names of bookshops in Repositories table of BooksRepository database AND
- •
The names of towns stored in Regions table of BookStoresChains database minus the names of towns stored in Places table of BooksRepository database.
The first “symmetric difference”-type operation is tested using the data tables presented in
Figure 12. The result is visualized in
Figure 13. The third DataGridView control shown on the bottom of
Figure 13 presents the first “symmetric difference”-type operation as a result of the input data loaded in the first two datagridview controls.
4.2. An Illustration of the Second “Symmetric Difference”-Typr Operation over 3D Data
The second “symmetric difference”-type operation performs extraction based on the one different dimension for BooksRepository minus BookStoresChains and for BookStoresChains minus BooksRepository united in one resulting dataset. The operation includes the following steps:
Case 1: The combination of:
- •
Titles of books stored in Materials table of BooksRepository database minus titles of books stored in Books table of BookStoresChain database OR
- •
The names of bookshops stored in Repositories table of BooksRepository database minus the names of bookshops stored in BookStores table of BookStoresChains database OR
- •
The names of towns stored in Places table of BooksRepository database minus the names of towns stored in Regions table of BookStoresChains database.
Case 2: The combination of:
- •
Titles of books stored in Books table of BookStoresChains database minus titles of books stored in Materials table of BooksRepository database OR
- •
The names of bookshops stored in BookStores table of BookStoresChains database minus the names of bookshops in Repositories table of BooksRepository database OR
- •
The names of towns stored in Regions table of BookStoresChains database minus the names of towns stored in Places table of BooksRepository database.
The second “symmetric difference”-type operation is tested using the data tables presented in
Figure 12. The result is demonstrated in
Figure 14. The third DataGridView control shown on the bottom of
Figure 14 presents the second “symmetric difference”-type operation of the data loaded in the first two DataGridView controls.
The examples, presented in
Section 4.1 and
Section 4.2, demonstrate the implementations of the herewith defined “symmetric difference” operations, which provide capabilities to find different data from two 3D datasets. The operations are helpful when the user wants to extract and work with records that are present in only one of two datasets. Comparing data in different sources can be used to increase the efficiency of querying and supply management.