1、1Logical modeling of the non relational database of the document typeAbstract. Non relational database (Nosql) is a new database technology for the application of the large-scale data, among which the Nosql database of the document model is widely applied with the characteristics of easy understandi
2、ng and rich features. Based on the relational database modeling, the method for processing the three elements of the E-R figure is presented in this paper, and based on this the logical modeling of the non relational database of the document type is constructed. Key words: Non relational database; l
3、ogic model; MongoDB; document model; large-scale data 1. Introduction The development of the sensors, the increase in the bandwidth and the popularity of the handheld devices, make the database technology more and more widely used in the information management system, and even the smallest Web appli
4、cation also needs large-scale storage, and the application of the database of the TB level has been very common. The 2appearance of the massive data requirements makes the Web application transform from the centralized and up-extended system architecture for the distributed and horizontally expanded
5、 system architecture, and the cloud computing technology provides an analysis platform for large-scale data. At the same time, the new system architecture puts forward new requirements for the database technology. The deficiency of the relational database in the aspect of the concurrent reading and
6、writing and the horizontal expansion is becoming increasingly prominent. In such an environment, non relational database (Nosql) has drawn wide attention of the people for its high efficiency, easy expansion and other characteristics. Nosql database uses more loosely data mode, which is convenient f
7、or the storage of the unstructured data. Compared with the relational database, the data organization is more flexible, and the data is no longer centered on the relation, but considers more of the actual needs of the application. Therefore, in the process of the modeling of the database, there is a
8、 big difference between Nosql and the relational database. In order to make more use of the Nosql flexible data model, and construct more reasonable database model, based on the study of the non relational database, taking MongoDB as an 3example, in this paper the author studies the modeling process
9、 of the Nosql document model. 2. Overview of the relational database The relational database must provide fast data transmission and update, the flexible and efficient index, and the advanced and efficient query capabilities, so as to organize and retrial the data in the data warehouse. In the OLTP
10、system, the advanced locking mechanism and the height of the multi table transaction throughput may be more important than the data warehouse. But this function is usually designed based on the most efficient relation engine, which is very important in the data warehouse operation. Microsoft SQL Ser
11、ver TM 2000 provides a very powerful database for the OLTP system and the data storage of the data warehouse. It also includes many of the powerful functions which are very important to the data warehouse, such as the data transformation services (DTS), replication management, the support of the mul
12、tidimensional online analytical processing (OLAP) and the data mining servers and SQL Server 2000 Analysis Services、SQL Server 2000 Meta Data Services it manages and the English Query which can use the common language for the query of the relational and multidimensional data. Therefore, the relation
13、al database is 4widely used by many people, which is well displayed from the following figures. In September 2003, InfoWorld announced a developer survey, which has a surprising result. 89.2% of the respondents say they use the relational database, and 52% of the respondents say they use the object-
14、oriented or the XML database. When asked about the types of the data storage, 40.2% say they store persistent objects, and 58.9% of the people say they store the XML data, and 89% of the people say they store the relational data. The basic element of the document database processing is the document.
15、 It organizes and displays the information using the document, and the document is the basic unit of the information storage. In the relational database, recording is the basic unit of the information storage, and is the basic object of the data manipulation. In a document database, the concept of t
16、he domain is emerging in the object of the forms, and the domain is the single element to store the data in the forms, which determines what data a separate document can contain. In a relational database, the field is a set of attribute values, and is the Column of the Table. The nature of the field
17、 determines the data structure of a Table. In the relational database and the document database, there are concepts of the view. In a document database, the 5users browse the document by using the Notes view. The view is the very convenient recording, and the users can see the summary letter about t
18、he documents and the status of the document, and then store the specific Notes documents in the relational database. 3. The modeling process of the document model 3-1. The MongoDB document model MongoDB is a common Nosql database. Due to its high performance and rich application functions it has bee
19、n widely applied in the production. MongoDB uses the automatic slices to achieve the data distribution, and supports all types of index. The query language grammar it uses is similar to the object-oriented query language, which can achieve most of the functions of the similar single table query rela
20、tional database, and it supports the two kinds of data replication mechanism of the master / slave and the duplicate set. And it also has the characteristics of the cross platforms, which is easy for the database migration. The data structure in the MongoDB is very loose, which is similar to the b-J
21、SON format of the JSON, so it can store complex data types, and its logical structure is a hierarchical structure which mainly consists of the database, the collection, and the document. The data types that the 6MongoDB supports are: Null、Boolean、String、Symbol、Object-Id、date、regular expression、code、
22、array、and emb edded document. Compared with the data types of the relational database, it is characterized in the support of the arrays and the document. 3-2. MongoDB database logic model In the stage of the logic structure design, MongoDB uses the document model to organize the data, and different
23、from the two-dimensional table tuples of the relational database, the flexible data model of the MongoDB is mainly reflected in the support of the array and the document type. Through the rational use of the auras and the documents, we can amalgamate the unnecessary sets, reduce the multi-site opera
24、tions, and improve the database efficiency. In the design process of the conceptual structure, the relational database will abstract the user needs into the informational structure usually in the form of the E-R graph. The MongoDB database can also use this method, because of the different forms of
25、organization of the MongoDB database, where the transfer approach of the logic model of the E-R diagram is different from the relational database. As is shown in Figure 2, convert the E-R graph of the courses of the students and the relatives, and the conversion process is 7divided into the followin
26、g steps: 3-2-1. The processing of the attributes The multi-valued attributes can be represented by the array types, as a data item of the document. In the diagram, the phone is a multi-valued attribute, expressed using the array as “Tel“: tel1, tel2, . The composite attribute is represented by the n
27、ested document type or the array type, as a data item of the document. The address attribute in the graph is a composite attribute, and the properties of the state, city, and street are clearly marked. The derived attribute: according to the actual application needs, if the data are given priority t
28、o the query operation, the derived attributes can improve the query efficiency, and can be used as a data item in the document. If the data are updated frequently, it can be removed directly from the document. In the diagram the age is a derived attribute, and it will be used often, and it is update
29、d once a year. Therefore it will be stored in the database. 3-2-2. The entity conversion Each entity is a collection. There are three entities in the E-R diagram: the students, the relatives and the curriculum, and each entity is used as a collection, which is respectively converted into three colle
30、ctions of Student, Course, and 8Relatives. The collection structure of the database is shown in Table 1. 3-2-3. Conversion of the relations between the entities One to one relationship: according to the demand of the application, we can merge the related two entities into a single entity as a set, a
31、nd the attribute of the relationship itself is also incorporated into the collection. Under normal circumstances, the one-to-one relationships of the entity can view an entity as the property of another entity. One to many relationships: according to the demand of the application, we can nest the mu
32、lti entities set into the single end entities, and we can also respectively establish the sets, and the primary key of the single end entity set can be used as the foreign key of the multiple entity sets. In the diagram, the relationship between the middle school students and the relatives is a one
33、to many relationships. The number of a students family and relatives is limited, and usually the relation data is used as part of the larger framework of the students. Therefore, the Relatives set can be nested in the Student collection, and can be displayed in the form of the multiple relatives arr
34、ay. 4. The logic model of the non-relational database In a 9relational database, there is the concept of the attribute, namely each column in the two-dimensional table is called an attribute. The name for each column is the property name. However, in the document database, there is no attribute, whi
35、le what the document has is the item. The entry refers to the any data stored in the document. Each entry represents the data in the document. In the user interface, the item of the document is displayed through the fields in the form. Although the two are different in the names, from the angle of t
36、he attributes it is easier to understand the significance of the items of the document database. There are the concepts of the views in the relational database and the document database. In a relational database, the view is the form derived from one or several basic tables (or views). The view is d
37、ifferent from the basic table. A view is a virtual table, that is to say, the corresponding data of the view are not actually stored in the database. In a database there exists only the definition of the views (in the data dictionary). In the document database, the users browse the document by using
38、 the Notes views. The view is a very convenient directory, and the users can see the summary information about the document and the status of the documents, 10and then store the specific Notes document. In the document database, the document can display the whole or part of the contents in the views
39、. Through the views, users can see the key domain of a set of the documents, and classify and sort the displayed information according to certain criteria. In fact, the two are very similar in the logic, namely, the corresponding view data are not actually stored in the database, and there is only t
40、he definition of the stored views in the database. The Web database is the network system structure which has experienced a great change in recent years. The client / server structure is becoming more and more popular, and the Intranet spreads rapidly at an alarming rate in a year, which is facing a
41、 new structure. How to easily realize the connection with the client and the server with the connection with the Web and the Intranet has become the focus of attention of the database management staff. The development of the computer and the network technology makes the network centric computing being paid more attention. WWW system and the database have become the foundation of the network information service. If the document database can be connected to the WWW server, we can retrieve documents from within the browser. The integrative