Abstract: This invention intends to create a new data model for the database management systems - use
of 2 or multi-dimension data model to store and retrieve data. First, all IDs or keywords are converted to numbers
(the first number and the second number). Then data are stored into cells of the data model according to these
numbers to be easily retrieved from the database. This data model has been successfully implemented with JavaScript.
These new technologies are beneficial to omitting data sorting processes, omitting the database retrieval server,
managing the data and index files more easily, eliminating database redundancy and making the database highly portable,
etc. They bring about many advantages for users to utilize databases more simply and efficiently through the Internet,
networks as well as on a stand-alone computer.
BACKGROUND OF THE INVENTION
The database is very important in the current digital times. Starting from 1960s, the navigational
database, relational database, object-oriented database and eXtensible Markup Language (XML) database etc.
have been developed to store various data produced in work flow and daily life. After the World Wide Web
(WWW) was popularized in 1990s, many efforts have been made to utilize databases directly through the
Internet. In the methods that have been created, the query fields need to be previously sorted to achieve
high performance for data retrieval. Also it is necessary to run a database server first and then write
codes in the Web pages to connect to the database server, open the database and retrieve data from the
database. These need complicated processes and the performance is affected by many situations such as
network status, server speed and database size.
In this invention, some new methods are created to achieve more simple and efficient data storage and
retrieval. First, a 2 or multi-dimension data model is created and the data are directly put in and get from
cells of this data model by numbers converted from IDs or keywords themselves. Second, the database is directly
embedded in the JavaScript to omit the database retrieval server. Third, the data and index files are managed
according to a number range of converted numbers and can be easily split more and more. Fourth, except for
the full functionality of database management systems, the programs for retrieving data from the database with
a keyword or ID are very simple.
BRIEF SUMMARY OF THE INVENTION
This invention intends to create a new data model for the database management systems - use of 2 or
multi-dimension data model to store and retrieve data. First, all IDs or keywords are converted to numbers
(the first number and the second number). Then the data are stored into cells of the 2 or multi-dimension data
model according to these numbers. The stored data can be easily retrieved from the database by these numbers.
This data model has been successfully implemented with JavaScript. The objective of this invention is to create
new methods for users to use databases more simply and efficiently through the Internet, networks as well as on
a stand-alone computer.
The advantages of this invention are remarkable. The data sorting processes for the query fields can be omitted
and the data are directly retrieved from the database with the numbers that are converted from the keywords or IDs
themselves. It is not necessary to run the database retrieval server by embedding the database directly in the
JavaScript. The data and index files of the database can be easily split more and more. These new technologies are
beneficial to omitting data sorting processes, omitting the database retrieval server, managing the data and index
files more easily, eliminating database redundancy and making the database highly portable, etc.
DETAILED DESCRIPTION OF THE INVENTION
First, two numbers are converted from the keywords or IDs themselves. The different convertion rules are applied
to the different data types. For the positive integer, the first number is itself and the second number is 0. For the
negative integer, the first number is itself after removing the negative symbol and the second number is 1. For the
decimal, if the digits after decimal point are less than 100, the decimal point is removed from the number and the digits
counted from right to decimal point are appended to the number as last two digits. The second number is assigned as 3 for
the positive decimal and 4 for the negative decimal (the negative symbol is removed). If the digits after decimal point
are equal to or larger than 100, they are handled in the same way as the string of alphabet character. For the string of
alphabet character, the first number is created by giving a definition to convert each alphabet character to a number
and the second number is created by summing up these converted numbers at the same time. The following is the JavaScript
function for converting alphabet characters to numbers:
function getCharNum( a ) {
var ret = -1;
if ( a != '' ) {
var c = a.toLowerCase();
switch ( c ) {
case '1':
ret = 1; break;
case '2':
ret = 2; break;
case '3':
ret = 3; break;
case '4':
ret = 4; break;
case '5':
ret = 5; break;
case '6':
ret = 6; break;
case '7':
ret = 7; break;
case '8':
ret = 8; break;
case '9':
ret = 9; break;
case '0':
ret = 10; break;
case 'a':
ret = 11; break;
case 'b':
ret = 12; break;
case 'c':
ret = 13; break;
case 'd':
ret = 14; break;
case 'e':
ret = 15; break;
case 'f':
ret = 16; break;
case 'g':
ret = 17; break;
case 'h':
ret = 18; break;
case 'i':
ret = 19; break;
case 'j':
ret = 20; break;
case 'k':
ret = 21; break;
case 'l':
ret = 22; break;
case 'm':
ret = 23; break;
case 'n':
ret = 24; break;
case 'o':
ret = 25; break;
case 'p':
ret = 26; break;
case 'q':
ret = 27; break;
case 'r':
ret = 28; break;
case 's':
ret = 29; break;
case 't':
ret = 30; break;
case 'u':
ret = 31; break;
case 'v':
ret = 32; break;
case 'w':
ret = 33; break;
case 'x':
ret = 34; break;
case 'y':
ret = 35; break;
case 'z':
ret = 36; break;
case '.':
ret = 37; break;
case '@':
ret = 38; break;
case '-':
ret = 39; break;
case '_':
ret = 40; break;
case '+':
ret = 41; break;
case '/':
ret = 42; break;
case '%':
ret = 43; break;
case ',':
ret = 44; break;
case ';':
ret = 45; break;
case '$':
ret = 46; break;
case '?':
ret = 47; break;
case '*':
ret = 48; break;
case ':':
ret = 49; break;
case '\'':
ret = 50; break;
case '\\':
ret = 51; break;
case '!':
ret = 52; break;
case '|':
ret = 53; break;
case '(':
ret = 54; break;
case ')':
ret = 55; break;
case '[':
ret = 56; break;
case ']':
ret = 57; break;
case '{':
ret = 58; break;
case '}':
ret = 59; break;
case '~':
ret = 60; break;
case '^':
ret = 61; break;
case '`':
ret = 62; break;
case '&':
ret = 63; break;
case '#':
ret = 64; break;
case '=':
ret = 65; break;
case '"':
ret = 66; break;
case '<':
ret = 67; break;
case '>':
ret = 68; break;
case ' ':
ret = 69; break;
default:
ret = -1;
}
}
return ret;
}
The numbers from 4 to 10 are reserved as the second numbers for other data types such as date and time data.
During the convention for the first number, '0' is added as prefix if returned value is 1 digit so that all converted
numbers for the alphanumeric are 2 digits. The first '0' is removed after the first number for a keyword of ID
is created. For example, the first number and the second number for 12345 are 12345 and 0, the numbers for -12345 are
12345 and 1, the numbers for 790.0 is 790001 and 2, the numbers for -790.5 is 790501 and 3, the numbers for 'M.0' are
233710 and 70, the numbers for 'mouse' are 2325312915 and 123, and the numbers for 'wawapeak@yahoo.com' are
331133112615112138351118252537132523 and 411. If the length of the number is larger than 15, it is split every 15
digits, e.g. 331133112615112138351118252537132523 is split as 331133, 112615112138351 and 118252537132523. The following
is an example for converting the numeric and string data to the numbers:
function convertNum(str) {
var ret = [2];
var retp = '';
var retv = 0;
var pd = str.indexOf('.');
var slen = 0;
if (pd >= 0) slen = str.length - pd - 1;
if (isNumeric(str) && slen < 100) {
if (pd < 0) {
if (str.indexOf('-') < 0) {
retp = str;
}
else {
retp = str.replace('-', '');
retv = 1;
}
}
else {
var l = '0' + slen;
retp = str.replace('.', '') + l.substr(l.length-2, 2);
if (retp.indexOf('-') < 0) {
retv = 2;
}
else {
retp = retp.replace('-', '');
retv = 3;
}
}
}
else {
for (var i = 0; i < str.length; i++) {
var a = str.substr(i, 1);
retp += getNumStr(a);
var num = getCharNum(a);
if ( num != -1 ) retv += num;
}
}
ret[0] = retp;
ret[1] = retv;
return ret;
}
function getNumStr(c) {
var ret = '';
var num = getCharNum(c);
if ( num != -1 ) {
if ( num < 10 )
ret = '0' + num;
else
ret += num;
}
return ret;
}
Second, the data and index files are created according to a range of the first numbers of the keywords or IDs. After
the numbers are created, the actual data or index file name is looked up according the first number. The ranges are properly
arranged according to how many data are within the intervals and the FileManager.js is specially created for this purpose.
The data range can be changed at any time as needed according to actual operational status of the database and the sizes of
the data or index files. When a data or index file is needed to be split, only that file needs to be processed and all other
data or index files will not be touched. In the data or index files, all data or index records are sorted according to the
first number of keywords or IDs to be easily split more and more.
The following example demonstrates this strategy:
Number From | Number To | Data File Name |
0 | 99 | dataName0-99.html |
100 | 399 | dataName100-399.html |
400 | 499 | dataName400-499.html |
500 | 999999999999999 | dataName500-999999999999999.html |
Third, a 2 or multi-dimensions data model is created for the numbers converted from keywords or IDs. The following
is the definition of the data model that is enough to handle the length of the first number within 90 (the length of
keywords or IDs within 45 because each alphabet character of the string is converted to 2-digit number):
function defineMatrix(p1, p2, p3, p4, p5, p6) {
var matrix = [];
var m01 = []; m02 = []; m03 = []; m04 = []; m05 = []; m06 = [];
matrix[p1] = m01;
matrix[p1][p2] = m02;
matrix[p1][p2][p3] = m03;
matrix[p1][p2][p3][p4] = m04;
matrix[p1][p2][p3][p4][p5] = m05;
matrix[p1][p2][p3][p4][p5][p6] = m06;
return matrix;
}
Fourth, the data are put in and get from the data model by using JavaScript in the Hyper Text Markup Language (HTML)
files. The HTML <iframe></iframe> tag is used to process data in the target data or index files which store
data or indexes for keywords or IDs. If retrieved data are the final query results, they are shown directly to the users,
otherwise the HTML <iframe></iframe> tag is used again to process data further in another HTML file. The
following are some examples in 3 HTML files to implement this data model with JavaScript.
(in the first HTML file ...)
var m = getHtmlParam1(); //get a keyword or ID - email address.
var numPV = convertNum(m); //convert the keyword or ID to numbers
var shipp = removeFirst0( numPV[0] ); //get the first number for the keyword or ID
var indexfile = getIndexFileName('idxEmail', shipp);
document.write('<iframe src="../jsdb/' + indexfile + '?' + m + '" name="datawin" width="830" height="1610" allowTransparency="true" scrolling="yes" frameborder="0" ></iframe>');
(in the second HTML file ...)
......
var D1 = removeFirst0( getAnyDigits(numPV[0], 1, 15) ); //get the first 15 digits from right
var D2 = removeFirst0( getAnyDigits(numPV[0], 2, 15) ); //get the second 15 digits from right
var D3 = removeFirst0( getAnyDigits(numPV[0], 3, 15) ); //get the third 15 digits from right
var matrix = defineMatrix(D3, D2, D1);
......
if (D3 == 232531 && D2 == 291538292522112 && D1 == 805020837132523){
// [D3] 232,531 [D2] 291,538,292,522,112 [D1] 805,020,837,132,523 - mouse@solar528.com
matrix[D3][D2][D1][389] = '17|';
}
if (D3 == 331133 && D2 == 112615112138351 && D1 == 118252537132523){
// [D3] 331,133 [D2] 112,615,112,138,351 [D1] 118,252,537,132,523 - wawapeak@yahoo.com
matrix[D3][D2][D1][411] = '30|';
}
......
var uid = getUserID(matrix[D3][D2][D1][numPV[1]]); //numPV[1] is the second number for email address
var datafile = getDataFileName('user', uid);
document.write('<iframe src="' + datafile + '?' + uid + '" name="userData" width="795" height="360" allowTransparency="true" scrolling="no" frameborder="0" ></iframe>');
(in the third HTML file ...)
......
var D1 = removeFirst0( numPV[0] ); //get the first number for user ID
var matrix = defineMatrix(D1);
......
if (D1 == 17){
matrix[D1][0] = '17|mouse@solar528.com|562-316-4728|123456|Mouse||Solar||18528 Casandra Ave||Cerritos|CA|90703|us|;26;27;28;';
}
......
if (D1 == 30){
matrix[D1][0] = '30|wawapeak@yahoo.com|562-316-4728|123456|Cun||Wang|18528 Casandra Ave||Cerritos|CA|90703|us|;A;1;2;3;';
}
......
writeUserData( matrix[D1][numPV[1]] ); //numPV[1] is the second number for user ID
This invention particularly focuses on a new data model for the database management systems - use of 2 or multi-dimension
data model to store and retrieve data. The great efforts have been made on omitting data sorting processes, omitting the
database retrieval server, managing the data and index files more easily, eliminating database redundancy and making the database
highly portable, etc. They bring about many advantages for users to utilize databases more simply and efficiently through the
Internet, networks as well as on a stand-alone computer.
It is an advantage of this invention that the data sorting processes for the query fields can be omitted and the data for
a keyword or ID are directly retrieved from the database with the numbers that are converted from the keyword or ID itself.
It is an advantage of this invention that it is not necessary to run the database retrieval server by embedding the database
directly in JavaScript and the data are directly retrieved from the database in the Web pages.
It is an advantage of this invention that the data and index files of the database can be easily split more and more and
the negative impact of database size on the database performance is minimized to the smallest.
It is an advantage of this invention that the databases can be simply built. Except for the full functionality of database
management systems, the programs for retrieving data from the database with a keyword or ID are very simple.
It is an advantage of this invention that the databases built with these methods are highly portable and users can easily
upload or download the whole database through networks or the Internet.
|