CN103164421A - Extensive markup language (XML) coding method based on preorder position-descendant numbers - Google Patents

Extensive markup language (XML) coding method based on preorder position-descendant numbers Download PDF

Info

Publication number
CN103164421A
CN103164421A CN2011104133437A CN201110413343A CN103164421A CN 103164421 A CN103164421 A CN 103164421A CN 2011104133437 A CN2011104133437 A CN 2011104133437A CN 201110413343 A CN201110413343 A CN 201110413343A CN 103164421 A CN103164421 A CN 103164421A
Authority
CN
China
Prior art keywords
xml
node
descendant
numbers
coding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011104133437A
Other languages
Chinese (zh)
Inventor
曹耀钦
宋建社
孙睿
曹继平
赵霜
郭军
袁春霞
李晓燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
No2 Inst Of Artillery Engineering Cpla
Original Assignee
No2 Inst Of Artillery Engineering Cpla
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by No2 Inst Of Artillery Engineering Cpla filed Critical No2 Inst Of Artillery Engineering Cpla
Priority to CN2011104133437A priority Critical patent/CN103164421A/en
Publication of CN103164421A publication Critical patent/CN103164421A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a simple extensive markup language (XML) coding method easy to achieve in the XML data base technical field. The XML coding method based on preorder position-descendant numbers is characterized in that relational storage of an XML document is achieved by adopting a binary coding scheme based on combination of preorder traversal values and node descendant numbers. The XML coding method based on preorder position-descendant numbers comprises the following steps: firstly, adopting a preorder traversal algorithm to calculate preorder traversal value of each XML document node, then calculating the descendant numbers (containing self node), and constructing XML document coding by using two-tuples (the preorder traversal values and the descendant numbers); based on the XML document coding, designing a data storage mode based on a relational data base, and then achieving relational storage of the XML document. Supporting of standard query language XML Path (XPath) of XML can be achieved only based on simple add-subtract operation, and XML information update operation under the relational storage can be conveniently supported, and structured query language (SQL) database query language is supported. The XML coding method based on preorder position-descendant numbers has the advantages of being reasonable in coding, clear in code physical significance, simple and convenient to operate, easy to achieve and the like, and the XML coding method based on preorder position-descendant numbers has important practical value of achieving the relational storage of the XML.

Description

A kind ofly put-the XML coding method of descendants's number based on first tagmeme
Technical field
The present invention relates to a kind of XML coding method that is simple and easy to realize in the XML database technical field, its core technology is to have realized the relational storage of XML document by a kind of binary coding scheme that combines with node descendants number based on the preorder traversal value.This coding method is a kind of coding method based on interval value, be widely used based on the information inquiry of the storage of the XML document of relational database, XML-based, in upgrading operation and message exchange, realizing in Military Information System that particularly the Information Interoperability field has important application value in army.
Background technology
In recent years, XML become gradually distribute to calculate with service application in the standard format of data representation and exchanges data.Be the potential of performance XML, effective storage of XML document data is the gordian techniquies that must research and solve.In the specific (special) requirements in different application field, make the storage problem of XML be difficult to so far find a kind of general " the best " solution due to the semi-structured property of XML data, the document of XML/data duality and versatility and XML.This causes there is no so far with " XML database " that XML is stored as core the key point of final conclusion just.Present solution can be summed up as two large classes: the first is to expand corresponding function on existing relational database or object-oriented database basis, and the data processing work that can be competent at XML is referred to as XML enable data storehouse.Another kind method be for database that the XML data are made to measure be pure XML database.Pure XML database fully takes into account the characteristics of XML data, come the processing XML data in a kind of natural mode, can support well from every side storage and the inquiry of XML, and can reach effect preferably, but pure XML database will move to maturity and also have very long road.Because relational database technology is quite ripe, how to utilize relational database to realize the efficient storage of XML document, for the usefulness of giving full play to existing relational database, realization is based on interconnecting and interoperability between the infosystem of relational database, and its key problem is based on the XML coding method of relational database.Therefore, the present invention is to the existing very strong theory significance of efficiently utilizing of XML document and using value.
Summary of the invention
Technical matters to be solved by this invention is for the deficiencies in the prior art, a kind of XML coding method that is simple and easy to realize is provided, the method has realized the first tagmeme of XML document is put-Region Coding Schemes of descendants's number, and to the relation data library storage of XML document coding, realized on this basis the inquiry of XML document and upgraded operation, for the relational database operation of XML document provides a kind of simple and effective method.
For solving the relational database efficient operation problem of XML document, the invention provides a kind of first tagmeme puts and the Binary XML coding method of its node descendants number for coding, the binary tree that the method forms by preorder traversal file structure figure, obtain the preorder traversal value of each node, realize the orderly coding of each XML document node, then by calculating descendants's number of each node, realized the sign of file structure by descendants's number of node, thereby realized the XML document coding.Specifically, establishing exactly the XML document tree is T, node set V={V1, V2 ... Vn}, the binary Interval Coding based on preorder traversal value and descendants's number is<numorder, sum 〉, wherein: numorder is the preorder traversal numbering of node, sum is all nodes of the subtree take this node as root node, i.e. descendants's number of this node (containing self node).
Of the present invention based on first tagmeme put-the XML coding method of descendants's number comprises the following steps:
(1) XML document is carried out the binary Interval Coding:
1. adopt the preorder traversal algorithm that XML is traveled through, obtain corresponding preorder traversal value numorder;
2. calculate descendants corresponding to each node and count sum (containing self node), descendants's number (sum) of leaf node is 1;
3. numorder and the sum with correspondence forms two tuples, forms the XML document coding;
(2) the relational storage pattern of design XML
The relational storage pattern of XML document is exactly to adopt relational database to realize the storage of XML document information, inquiry and renewal operation.Its core is the suitable relation schema of design, and what obtain after document is resolved stores in relational database for information about.
1. a concordance list is set up in set to resource document, and each record of this concordance list is a tlv triple (docID, URL, ResourceType).
Wherein:
DocID is the document identification of this node place document;
URL is the address of document resources;
ResourceType is the type of resource.
2. set up an element index table for the identical node of each mark, each record of this concordance list be one hexa-atomic group (docID, numorder, sum, parentorder,, nodeType, depth, name).
Wherein:
DocID is the document identification of this node place document;
Numorder is the preorder traversal value of this node in document tree;
Sum is descendants's number of node;
Parentorder is the numbering of its father node;
NodeType is the type of node, and its value is got EE, ET and EN, and the content of representative element node is daughter element, text and sky respectively.
Depth represents the level that this node is positioned in document tree.
Because the child of node in general tree construction is out-of-order, and the node in the XML document tree should be orderly, still can be the document tree organization definition a kind of tree construction of expansion, the child of node order is according to from left to right arranged sequentially, thereby determined in fact the position of this node in document tree for No. NodeNum
3. all token names in the XML document tree are set up a concordance list, each record of this concordance list is a four-tuple (docID, numorder, Tagname, ConType).
Wherein:
DocID is the document identification of this node place document;
Numorder is the numbering of this node;
Tagname is the mark of all elements node and attribute node;
ConType is the content type of this node.
4. for all text nodes and attribute node, need to set up a value concordance list, each record of this table is a four-tuple (docID, numorder, value, valueType).
Wherein:
DocID is the document identification of this node place document;
Numorder is the numbering of this node;
Value is the text deposited with character string forms or the value of attribute node;
ValueType is used for the original data type of declared attribute value or content of text.
Accordingly, can design the relational storage pattern of XML document as follows:
Documen t(docID,URL,ResourceType)
Tagname(docID,numorder,Tagname,ConType)
Value(docID,numorder,value,valueType)
Elem-Tagname(docID,numorder,sum,parentorder,nodeType,depth,name)
(3) based on the XML information inquiry of relational storage
XPath is an XML query language, and it is used for being described in an enquiry navigation in the XML document tree, and it is a kind of relatively simple query language that W3C recommends.Simultaneously, XPath is also compulsory, and various XML query languages all must be supported it.
For query function, XPath has defined 13 inquiry axles, realizes the inquiry of relevant information in XML document.These 13 inquiry axles are respectively:
Child axle: the child who selects context node.
Descendant axle: the descendant who selects context node.
Parent axle: the father node of selecting context node.
Ancestor axle: the ancestors that select context node.
The following-sibling axle: select context node all thereafter the node on (right side).
Preceding-sibling axle: select all nodes on (left side) before it of context node.
The following axle: select context node all thereafter and get rid of its all descendants' node.
The preceding axle: select context node all before it and get rid of its all ancestors' node.
Attribute axle: the attribute of selecting context node.
Namespace axle: the NameSpace of selecting context node.
Self axle: select context node self.
Descendant-or-self axle: select context node self and descendant thereof.
Ancestor-or-self axle: select context node self and ancestors thereof.
Encoding scheme of the present invention can be supported the XPath inquiry comprehensively, also namely supports 13 inquiry axles of XPath.
(4) the XML information deletion under relational storage
Needing deletion of node in document tree is v, when its parent node is u, can be divided into following several situation:
1. the node v of deletion is a leaf node, is also sum (v)=1.
In this case, can realize by following steps:
A. the descendant number of the parent node u of node v subtracts 1, i.e. sum (u)=sum (u)-1;
B. in document tree, all are than the large node p of node v numbering, and its numbering subtracts 1, i.e. numorder (p)=numorder (p)-1;
C. the descendant number of all ancestor nodes of node u (sum) all subtracts 1.All ancestors x of node u satisfy numorder (x)<numorder (u) and numorder (x)+sum (x)≤numorder (u), namely when node x satisfies numorder (x)<numorder (u) and numorder (u)≤numorder (x)+sum (x), sum (x)=sum (x)-1.
2. the node v of deletion is not leaf node, is sum (v) ≠ 1 yet.
In this case, can realize by following steps:
A. the descendant number of node u subtracts 1, i.e. sum (u)=sum (u)-1;
B. the number of plies-1 of all descendant's nodes of node v.All descendant x of node v satisfy numorder (v)+sum (v) 〉=numorder (x) and numorder (v)<numorder (x), namely when node x satisfies numorder (v)+sum (v) 〉=numorder (x) and numorder (v)<numorder (x), depth (x)=depth (x)-1.
C. in document tree, all are than the large node p of node v numbering, and its numbering subtracts 1, i.e. numorder (p)=numorder (p)-1.
D. the child nodes of node v is x, and its parent node is revised as numorder (u), if namely node x satisfies: numorder (v)=parentorder (x), parentorder (x)=numorder (u).
(5) sql like language of information updating is realized
Based on the method for giving in (3) and (4), can realize easily the XML information inquiry by the sql like language of database, upgrade operation.
Advantage of the present invention is: the present invention is by the thought of preorder traversal algorithm, by having formed together the coding method of a kind of XML with node descendants number, has coding rationally, the node physical significance is clear, easy and simple to handle, be easy to the advantages such as realization, the relational storage of XML is realized having important practical value.
Description of drawings
Below in conjunction with accompanying drawing, the present invention is described in further detail.
Fig. 1 is the document tree that an XML document consists of.
Fig. 2 is coding of the present invention and the contrast that has XML coding commonly used now.
Fig. 3 is that the present invention is to the support method of the inquiry axle of XPath.
Embodiment
Below in conjunction with accompanying drawing, embodiments of the present invention are described further technical scheme of the present invention in order better to illustrate.
Referring to Fig. 1, the document tree that certain XML document fragment consists of as shown in the figure.At first according to the preorder traversal method, the first order of arrangement that can obtain node put in order into: 1,2,3,4,5,6,7,8.Then the descendants's number that calculates each node is respectively: 8,3,1,1,1,3,1,1.The binary coding of its formation is: (1,8), (2,3), (3,1), (4,1), (5,1), (6,3), (7,1), (8,1).
Referring to Fig. 2, according to the given document tree of Fig. 1, can obtain the formed code tree of the present invention, provided the code tree of other several common methods in Fig. 2.
Participate in Fig. 3, the present invention is very simple to the support of the standard query language XPath of XML, only has and will can realize by simple plus and minus calculation.As the child v of query node u, can pass through judgement: numorder (u)=parentorder (v) gets final product.
The present invention is to the support of data library standard query language SQL following (the first situation of the XML information deletion under the relational storage is the program that realizes of example explanation SQL):
The numbering of // acquisition node v and parent node numbering
select numorder,parentorder
into:vorder,:vparentorder
from B
where Name=’v’;
// deletion of node v
delete from B
where numorder=:vorder;
// with the descendant number-1 of node u
update B
set sum=sum-1
where numrder=:vparentorder;
// with the numbering-1 of all numberings greater than the node of v
update B
set numorder=numorder-1
where numorder>:vorder;
The descendant number of all ancestor nodes of // node u (num) all subtracts 1
update B
set sum=sum-1
where numorder>:vparentorder and :vparentorder<numorder+sum;

Claims (1)

1. put-the XML coding method of descendants's number based on first tagmeme for one kind, it is characterized in that comprising following concrete steps: (1) adopts preorder traversal to calculate volume value of going through of each node in the XML document tree, calculate again descendants's number (containing self node) of the node of getting married, form the binary coding of XML document; (2) put-one group of relational storage pattern of the coding method of descendants's number design XML document based on first tagmeme; (3) based on first tagmeme put-the XML coding method of descendants's number is to the support method of the standard query language XPath of XML; (4) based on first tagmeme put-the relational storage pattern of descendants's number encoder method is to the support method of information updating; (5) based on first tagmeme put-the relational storage pattern of descendants's number encoder method is to the support method of SQL query language.
CN2011104133437A 2011-12-12 2011-12-12 Extensive markup language (XML) coding method based on preorder position-descendant numbers Pending CN103164421A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011104133437A CN103164421A (en) 2011-12-12 2011-12-12 Extensive markup language (XML) coding method based on preorder position-descendant numbers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011104133437A CN103164421A (en) 2011-12-12 2011-12-12 Extensive markup language (XML) coding method based on preorder position-descendant numbers

Publications (1)

Publication Number Publication Date
CN103164421A true CN103164421A (en) 2013-06-19

Family

ID=48587516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011104133437A Pending CN103164421A (en) 2011-12-12 2011-12-12 Extensive markup language (XML) coding method based on preorder position-descendant numbers

Country Status (1)

Country Link
CN (1) CN103164421A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107251537A (en) * 2015-02-10 2017-10-13 瑞典爱立信有限公司 Method and apparatus for data agent

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183385A (en) * 2007-12-04 2008-05-21 西安交通大学 XML enquire method based on multi-modality indexes structure
CN101887458A (en) * 2010-07-06 2010-11-17 江苏大学 Path coding-based XML document index method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183385A (en) * 2007-12-04 2008-05-21 西安交通大学 XML enquire method based on multi-modality indexes structure
CN101887458A (en) * 2010-07-06 2010-11-17 江苏大学 Path coding-based XML document index method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
曹耀钦等: "基于O-D的XML编码及对信息查询与更新的支持", 《计算机工程》, vol. 33, no. 5, 31 March 2007 (2007-03-31) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107251537A (en) * 2015-02-10 2017-10-13 瑞典爱立信有限公司 Method and apparatus for data agent
CN107251537B (en) * 2015-02-10 2020-07-14 瑞典爱立信有限公司 Method and apparatus for data mediation

Similar Documents

Publication Publication Date Title
EP3066585B1 (en) Generic indexing for efficiently supporting ad-hoc query over hierarchically marked-up data
US7634498B2 (en) Indexing XML datatype content system and method
US8209352B2 (en) Method and mechanism for efficient storage and query of XML documents based on paths
CN100541493C (en) The apparatus and method that are used for structured document management
US9576011B2 (en) Indexing hierarchical data
Stadler et al. Making interoperability persistent: A 3D geo database based on CityGML
US20070174309A1 (en) Mtreeini: intermediate nodes and indexes
CN102646039A (en) Software interface generating system and method based on extensible markup language (XML) Schema
US20060173861A1 (en) Method and apparatus for incremental evaluation of schema-directed XML publishing
US20060288021A1 (en) Information processor, schema definition method and program
AU2012327168B2 (en) Amethod and structure for managing multiple electronic forms and their records using a static database
CN102426587A (en) Method for customizing and inquiring heterogeneous BOM (Bill of Materiel) based on complex product
CN103246704A (en) Mapping method for describing entity and relational data based on conventional data structure
Qtaish et al. XAncestor: An efficient mapping approach for storing and querying XML documents in relational database using path-based technique
US7895190B2 (en) Indexing and querying XML documents stored in a relational database
Thalheim Extended Entity-Relationship Model.
CN103164421A (en) Extensive markup language (XML) coding method based on preorder position-descendant numbers
US20050060307A1 (en) System, method, and service for datatype caching, resolving, and escalating an SQL template with references
CN101566948A (en) Form system data source data-binding method
JP2008176771A (en) Retrieval program, method, and device
Zhu et al. A Complex XML Schema to Map the XML Documents of Distance Education Technical Specifications into Relational Database
Brahmia et al. High-level Operations for Changing Temporal Schema, Conventional Schema and Annotations, in the τXSchema Framework
Subramaniam et al. Mapping and labeling XML data for dynamic update
Amin et al. Labeling schemes to support dynamic updates on XML trees: A technical review
CN100338609C (en) Maintenance method for package device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
DD01 Delivery of document by public notice

Addressee: No.2 Inst. of Artillery Engineering, CPLA

Document name: the First Notification of an Office Action

C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130619