Expression parsing method towards geospatial database attribute value constraint checking
Expression parsing method towards geospatial database attribute value constraint checking
 CN 104,794,240 B
 Filed: 05/08/2015
 Issued: 06/14/2019
 Est. Priority Date: 05/08/2015
 Status: Active Grant
First Claim
1. a kind of expression parsing method towards geospatial database attribute value constraint checking, which is characterized in that including such asLower step:
 Step 1, defined attribute value the constraint relationship expression formulaThe definition mode of attribute value the constraint relationship expression formula are as follows;
IF<
exp1>
Then<
exp2>
Wherein, symbol IF<
exp1>
indicates that the expression formula exp1 in bracket is conditional expression, and symbol Then<
exp2>
expression includesExpression formula exp2 in number is decision expression formula；
The calculated result of conditional expression and decision expression formula is only true or false, and is all made of following definition mode;
Exp=(V, A, M, R, L, F)Wherein, exp indicates the expression formula of definition；
Whole element sets that (V, A, M, R, L, F) expression exp is included；
VIt is numerical value or character string for selfdefining value；
A is attributename；
M is arithmetic operator, and arithmetic operator includes adding operator+, subtraction operator, multiplication operator ×
, division arithmetic symbol/；
R is relational operator, and relational operator includes greater than operator>
, greater than or equal to operator>
=, lessthan operator <
, be less than or equal to operator≤
, be equal to operator=, be not equal to operator<
>
；
L is logical operator, and logical operator includes union symbol And or operator Or, inverse symbol Not；
F is functional operation symbol；
Wherein, V, A are referred to as operand element, and M, R, L, F are referred to as operator elements；
Step 2, it decomposes and converting attribute value the constraint relationship expression formulaAccording to the definition mode of attribute value the constraint relationship expression formula, attribute value the constraint relationship expression formula is decomposed into conditional expressionExp1 and decision expression formula exp2, and conditional expression, decision expression formula are respectively converted into a symbol sequence sheet formIt is expressed；
Step 3, analytical expressionValue, the value of decision expression formula of analytical Calculation conditional expression are distinguished according to symbol sequence list；
Step 4, judge that attribute value constrainsJudge whether attribute value meets attribute value the constraint relationship expression formula according to the value of conditional expression and the value of decision expression formula；
Geospatial database attribute value the constraint relationship is existed between a data Table Properties value in geospatial databaseThe relationship that mutually limits of one kind；
A tables of data in the geospatial database is the collection of a kind of geographical space elementIt closes, a referred to as element collection；
A record in tables of data indicates a geographical space element, and geographical sky is shown in a data listBetween element an attribute.
Chinese PRB Reexamination
Abstract
The present invention provides a kind of expression parsing methods towards geospatial database attribute value constraint checking, comprising steps of step 1, defined attribute value the constraint relationship expression formula；Step 2, it decomposes and converting attribute value the constraint relationship expression formula；Step 3, analytical expression；Step 4, judge that attribute value constrains.The present invention is for the purpose of the inspection of geospatial database attribute value the constraint relationship, a kind of normalized by definition, parsing, calculating and judgment method being contained expression formula progress geospatial database attribute value the constraint relationship using logic is provided, realizes normalized expression, parsing and the judgement of geospatial database attribute value the constraint relationship.
7 Claims

1. a kind of expression parsing method towards geospatial database attribute value constraint checking, which is characterized in that including such asLower step:

Step 1, defined attribute value the constraint relationship expression formula The definition mode of attribute value the constraint relationship expression formula are as follows; IF<
exp1>
Then<
exp2>Wherein, symbol IF<
exp1>
indicates that the expression formula exp1 in bracket is conditional expression, and symbol Then<
exp2>
expression includesExpression formula exp2 in number is decision expression formula；The calculated result of conditional expression and decision expression formula is only true or false, and is all made of following definition mode; Exp=(V, A, M, R, L, F) Wherein, exp indicates the expression formula of definition；
Whole element sets that (V, A, M, R, L, F) expression exp is included；
VIt is numerical value or character string for selfdefining value；
A is attributename；
M is arithmetic operator, and arithmetic operator includes adding operator+, subtraction operator, multiplication operator ×
, division arithmetic symbol/；
R is relational operator, and relational operator includes greater than operator>
, greater than or equal to operator>
=, lessthan operator <
, be less than or equal to operator≤
, be equal to operator=, be not equal to operator<
>
；
L is logical operator, and logical operator includes union symbol And or operator Or, inverse symbol Not；
F is functional operation symbol；
Wherein, V, A are referred to as operand element, and M, R, L, F are referred to as operator elements；Step 2, it decomposes and converting attribute value the constraint relationship expression formula According to the definition mode of attribute value the constraint relationship expression formula, attribute value the constraint relationship expression formula is decomposed into conditional expressionExp1 and decision expression formula exp2, and conditional expression, decision expression formula are respectively converted into a symbol sequence sheet formIt is expressed； Step 3, analytical expression Value, the value of decision expression formula of analytical Calculation conditional expression are distinguished according to symbol sequence list； Step 4, judge that attribute value constrains Judge whether attribute value meets attribute value the constraint relationship expression formula according to the value of conditional expression and the value of decision expression formula； Geospatial database attribute value the constraint relationship is existed between a data Table Properties value in geospatial databaseThe relationship that mutually limits of one kind；
A tables of data in the geospatial database is the collection of a kind of geographical space elementIt closes, a referred to as element collection；
A record in tables of data indicates a geographical space element, and geographical sky is shown in a data listBetween element an attribute.


2. the expression parsing method according to claim 1 towards geospatial database attribute value constraint checking,Be characterized in that, the definition mode of functional operation symbol are as follows:
 by function ID, function name, number of parameters, function execute entrance comeDefine the functional operation symbol.

3. the expression parsing method according to claim 1 towards geospatial database attribute value constraint checking,It is characterized in that, the symbol sequence list is the operation that attribute value the constraint relationship expression formula is successively taken out according to sequence from left to rightSymbol element and operand element addition sequence table generate.

4. the expression parsing method according to claim 1 towards geospatial database attribute value constraint checking,It is characterized in that, the step 3 includes the following steps:

Step 3.1;
initialization operation accords with stack OperatorStack and operand stack OperandStack, and is set to sky；Step 3.2;
traversal symbol sequence list judges current sign type；Step 3.3;
according to the judging result of step 3.2;If current sign is operand, by the operand push operation number stack OperandStack and 3.2 readings are entered stepNext symbol； If current sign is operator, 3.4 are thened follow the steps； Step 3.4;
if operator stack OperatorStack is sky, current sign push operation being accorded with into stackOperatorStack；
Otherwise, the stack top element of read operation symbol stack OperatorStack carries out priority with active operatorCompare;If the priority of active operator is higher than stack top element, active operator push operation is accorded with into stack OperatorStack,And read next symbol； If active operator priority is lower than stack top element, the stack top element of operator stack OperatorStack is popped, and according toIt according to stack top element, takes out corresponding operation number and is calculated, and by calculated result push operation number stack OperandStack； If active operator priority is equal to stack top element, the stack top element of operator stack OperatorStack is popped, and is judgedThe operator elements popped whether be functional operation symbol function name, if so, according to functional operation symbol number of parameters by graspingThe stack OperandStack that counts carries out Pop operations and obtains parameter, carries out function calculating, and by calculated result push operation number stackOperandStack； Step 3.5;
step 3.4 is repeated, until the priority of active operator is higher than stack top element；Step 3.6;
repeating and execute step 3.2 to 3.5, until upto symbol sequence list is empty；Step 3.7;
if operator stack is sky, thening follow the steps 3.8；
Otherwise, then enable operator stack OperatorStack stack top firstElement is popped, judge the operator elements popped whether be functional operation symbol function name;If the operator elements popped are the function names of functional operation symbol, according to the number of parameters of functional operation symbol by operandStack OperandStack carries out Pop operations and obtains parameter, carries out function calculating, and by calculated result push operation number stackOperandStack；
Otherwise, then it takes out corresponding operation number to be calculated, and by calculated result push operation number stackOperandStack；Step 3.7 is repeated, until operator stack is sky； Step 3.8;
if operator stack OperatorStack is empty and operand stack OperandStack only one element,Using the stack top element of operand stack OperandStack as calculated result, the i.e. value of attribute value the constraint relationship expression formula；
Otherwise,Then determine that attribute value the constraint relationship expression formula is illegal.


5. the expression parsing method according to claim 4 towards geospatial database attribute value constraint checking,It is characterized in that, the operator priority is defined as:

The priority of functional operation symbol is the first priority； The priority that multiplication operator, division arithmetic accord with is the second priority； Adding operator, subtraction operator priority be third priority； The priority of relational operator is the 4th priority； The priority of logical operator is the 5th priority； Wherein, the first priority, the second priority, third priority, the 4th priority, the prioritylevel of the 5th priority according toSecondary reduction.


6. the expression parsing method according to claim 1 towards geospatial database attribute value constraint checking,It is characterized in that, the step 4 includes the following steps:

Step 4.1;
whether the calculated result of Rule of judgment expression formula is true, otherwise then determines to belong to if so, carrying out step 4.2Property value meets attribute value the constraint relationship；Step 4.2;
judge whether decision expression formula is true, if so, determine that attribute value meets attribute value the constraint relationship, otherwise,Then determine that attribute value is unsatisfactory for attribute value the constraint relationship.


7. the expression parsing method according to claim 1 towards geospatial database attribute value constraint checking,It is characterized in that, further includes following steps:
Step 5, the judging result of step 4 is shown, wherein marked to the attribute value for being unsatisfactory for attribute value the constraint relationship expression formulaNote display.
Specification(s)