CN102937992A - Object mapping transformation design method based on Java and X extensive makeup language (XML) database - Google Patents

Object mapping transformation design method based on Java and X extensive makeup language (XML) database Download PDF

Info

Publication number
CN102937992A
CN102937992A CN2012104321943A CN201210432194A CN102937992A CN 102937992 A CN102937992 A CN 102937992A CN 2012104321943 A CN2012104321943 A CN 2012104321943A CN 201210432194 A CN201210432194 A CN 201210432194A CN 102937992 A CN102937992 A CN 102937992A
Authority
CN
China
Prior art keywords
java
xml
method based
database
configuration
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
CN2012104321943A
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.)
FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
Original Assignee
FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
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 FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD filed Critical FOUNDER DIGITAL PUBLISHING TECHNOLOGY (SHANGHAI) CO LTD
Priority to CN2012104321943A priority Critical patent/CN102937992A/en
Publication of CN102937992A publication Critical patent/CN102937992A/en
Pending legal-status Critical Current

Links

Abstract

Disclosed is an object mapping transformation design method based on a Java and X extensive makeup language (XML) database. The method includes the steps of step one, defining configuration files; step two, generating character strings which accord with the XML standards by a specific language XQUERY of the XML database through XQuery for Java (XQJ); step three, generating a Java object through a configured mapping relation, or generating a series data by configuring extensible stylesheet language (XSL); and step four, searching Xquery sentences in the configuration files by an XML path language (xpath), acquiring return types of the configuration files, and finally returning required data.

Description

A kind of object map conversion designs method based on Java and XML database
Technical field
The present invention relates to a kind of object map conversion designs method, particularly a kind of object map conversion designs method based on Java and XML database.
Background technology
Object Relation Mapping (Object/Relation Mapping is called for short ORM) produces along with OO software development methodology development.OO development approach is the main flow development approach in the current enterprise-level application development environment, and relational database is the mainstream data storage system of permanent store data in the enterprise-level application environment.Object and relation data are two kinds of forms of expression of Business Entity, and Business Entity shows as object in internal memory, show as relation data in database.Have association and inheritance between the object in the internal memory, and in database, relation data can't directly be expressed multi-to-multi association and inheritance.Therefore, Object Relation Mapping (ORM) system generally exists with the form of middleware, realizes that mainly program object is to the mapping of relation data database data.
Object-oriented is that the basis from soft project cardinal rule (such as coupling, polymerization, encapsulation) grows up, and relational database then develops from mathematical theory, and there is significant difference in two cover theories.In order to solve this unmatched phenomenon, the Object Relation Mapping technology is arisen at the historic moment, and Object Relation Mapping has had a lot of successful stories in relational database.But do not have this solution at the XML database, so on the demand of XML database development, in the urgent need to a kind of method that solves mapping relations between XML database and the object.
Summary of the invention
The present invention is directed to the prior art above shortcomings, a kind of object map conversion designs method based on Java and XML database is provided, thereby the physical layer interface that makes the user can be indifferent to XQJ is realized, only need by simple configuration, just can realize the objectification programming, thereby reach the minimizing learning cost, the purpose of Speeding up development speed.
The present invention is achieved through the following technical solutions:
A kind of object map conversion designs method based on Java and XML database, adopt following steps:
S1, definition configuration file;
S2, use the language-specific XQUERY query generation of XML database to meet the character string of XML standard by XQJ;
S3, the mapping relations generation Java object by configuring are perhaps by providing configuration XSL to generate a series of data;
S4, by the Xquery statement in the xpath retrieval configuration file, and obtain return type in the configuration file, return at last needed data.
Better, the mapping relations by configuration generate the Java object and comprise by the XQUERY statement and directly generate the Java object.
Better, configuration file comprises master configuration file and sub-configuration file.
Better, dispose the path of global parameter, sub-configuration file and the realization class definition of database XQJ in the master configuration file.
Better, a series of data comprise HTML, XML and PDF data.
Better, generating in the JAVA object in the mapping relations by configuration, mapping relations adopt the configuration style of XStream.
Better, or by providing configuration XSL to generate in a series of data, comprise the path of direct configuration one XSL.
Better, or by providing configuration XSL to generate in a series of data, comprise and import an XSL into.
Description of drawings
Fig. 1 is the code sequential chart of a preferred embodiment of the present invention;
Fig. 2 is relational database process flow diagram under development;
Fig. 3 is the process flow diagram of the present invention in the XML database development.
Embodiment
Below in conjunction with embodiment the present invention is elaborated, the present embodiment is implemented under take technical solution of the present invention as prerequisite, has provided detailed embodiment, but protection scope of the present invention is not limited to following embodiment.
JDBC is JSR(Java Specification Requests, the Java specification request) a cover standard of definition is the mutual a kind of method of relational database and java, in the XML database in, XQJ also is the cover standard that JSR formulates, and is the mutual a kind of method of XML database and java.In the ORM of traditional sense, depend on JDBC, generate record by SQL statement, then by the configuration returning an object value.
In the XML database, the present invention propose by XQJ use the XML database language-specific XQUERY query generation one or more meet the character string of XML standard, mapping relations by the configuration file configuration generate the Java object, perhaps by configuration XSL(Extensible Stylesheet Language (XSL), EXtensible Stylesheet Language are provided) a series of specific data (for example, the HTML of generation, XML, PDF), wherein, XSL is a kind of language for present the XML data with readable format; Like this, the user only need pass through the XQUERY statement, just can realize directly generating the Java object, is generating in a series of data such as HTML, XML, PDF by configuration XSL, and here, configuration XSL can be the path of an XSL of direct configuration, perhaps imports an XSL into; Then, a language of in the documents such as XML, searching information by xpath(xpath, navigate by element and attribute) retrieve the Xquery statement in the configuration file, and obtain the return type in the configuration file, return at last the data that the user needs.
Wherein, configuration file is divided into master configuration file and sub-configuration file.
Master configuration file comprises: self-defined global parameter, and sub-Profile Path, XQJ realizes the definition of class, for example can realize by following statement:
Figure BDA00002346670700031
Wherein, the Configuration element is root element, the Properties element is custom parameter, the Include element can comprise a .properties file, the Propertie element can directly define a sub-configuration file, xqueryMap is sub-Profile Path, and the resultClass element is the serializing class in the return type.
Sub-configuration file for example can be realized by following statement:
Figure BDA00002346670700041
Wherein, entry_collection among the $ [entry_collection] is the global variable that defines in the configuration file, { name} is the key among the parameterClass to $, #{age} also is the key among the parameterClass, difference is that { name} is a kind of alternative patterns to $, and #{age} is based on a kind of injection mode of XQJ.
Described injection mode has two kinds, and the first is substitute mode, is specially the character string alternative patterns; Another kind is based on the compiling injection mode of XQJ, because first kind of way is the mode of substitute character string, in the engineering of substitute character string, might write the code with logic, cause data to reveal or Missing data, and inject by second way compiling, can effectively avoid this problem, guaranteed the security of data.
In java, pass through:
List<Booklet〉and list=queryForList ("/system/queryLet ", map); Inquire object for the user.
The below provides one embodiment of the invention, in order to understand:
Please refer to Fig. 1, define first master configuration file a: CommConfig.xml.In this configuration file, configured sub-configuration file and the global variable at query statement place, this configuration file for example can be realized by following statement:
List<Booklet>list=queryForList("/system/queryLet",map);
Then, the user adopts identifier to pass through ConfigManager(configuration file management class) search out dynamic XQUERY statement, then send the dynamic XQUERY statement that searches out to the XML database by XQJ, and return the character string that meets the XML standard, by ConfigManager(configuration file management class) the type of return results and object serialization kit be back into the Java object that the user needs.Wherein, XStream is a kind of kit that is used for XML and java object map of increasing income.
Please refer to Fig. 2 and Fig. 3.Fig. 2 is relational database process flow diagram under development, in relational database, the user uses SQL statement to generate record by JDBC, is back into the Java object that the user needs by the object serialization kit again, could generate a series of specific data by technology such as JSP at last.Fig. 3 is the process flow diagram of the present invention in the XML database development, can find by contrast, the present invention propose by XQJ use the XML database language-specific XQUERY query generation one or more meet the character string of XML standard, mapping relations by configuration generate the Java object, perhaps by configuration XSL(EXtensible Stylesheet Language is provided) a series of specific data (HTML of generation, XML, PDF), the user uses the method can realize inquiring about fast, and do not need to pay close attention to the realization of the physical layer interface of XQJ, only need by simple configuration, just can realize the objectification programming, generate faster and more easily the needed data of user, realized fast Development, the target of Cost reduction.
Above disclosed be the application's preferred embodiment only, but the application is not limited thereto, the changes that any person skilled in the art can think of all should drop in the application's the protection domain.

Claims (8)

1. the object map conversion designs method based on Java and XML database is characterized in that, adopts following steps:
S1, definition configuration file;
S2, use the language-specific XQUERY query generation of XML database to meet the character string of XML standard by XQJ;
S3, the mapping relations generation Java object by configuring are perhaps by providing configuration XSL to generate a series of data;
S4, by the Xquery statement in the xpath retrieval configuration file, and obtain return type in the configuration file, return at last needed data.
2. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, directly generate the Java object described comprising by the XQUERY statement by the mapping relations generation Java object that configures.
3. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, described configuration file comprises master configuration file and sub-configuration file.
4. the object map conversion designs method based on Java and XML database as claimed in claim 3 is characterized in that, disposes the path of global parameter, sub-configuration file and the realization class definition of database XQJ in the described master configuration file.
5. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, described a series of data comprise HTML, XML and PDF data.
6. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, generates in the JAVA object in described mapping relations by configuration, and described mapping relations adopt the configuration style of XStream.
7. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, described or by provide the configuration XSL generate in a series of data, comprise the path of direct configuration one XSL.
8. the object map conversion designs method based on Java and XML database as claimed in claim 1 is characterized in that, described or by provide the configuration XSL generate in a series of data, comprise and import an XSL into.
CN2012104321943A 2012-11-01 2012-11-01 Object mapping transformation design method based on Java and X extensive makeup language (XML) database Pending CN102937992A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012104321943A CN102937992A (en) 2012-11-01 2012-11-01 Object mapping transformation design method based on Java and X extensive makeup language (XML) database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012104321943A CN102937992A (en) 2012-11-01 2012-11-01 Object mapping transformation design method based on Java and X extensive makeup language (XML) database

Publications (1)

Publication Number Publication Date
CN102937992A true CN102937992A (en) 2013-02-20

Family

ID=47696889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012104321943A Pending CN102937992A (en) 2012-11-01 2012-11-01 Object mapping transformation design method based on Java and X extensive makeup language (XML) database

Country Status (1)

Country Link
CN (1) CN102937992A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104270453A (en) * 2014-10-11 2015-01-07 苏州科达科技股份有限公司 Method for data communication between multilevel servers and servers
CN104462091A (en) * 2013-09-13 2015-03-25 方正信息产业控股有限公司 XML (extensive markup language) data operating method and device
CN106886390A (en) * 2015-12-15 2017-06-23 大唐软件技术股份有限公司 A kind of Java object generation and conversion method and Java object generation and conversion equipment
CN107678806A (en) * 2017-09-30 2018-02-09 北京酷我科技有限公司 A kind of object type switchs to the method for type of database
CN108874944A (en) * 2018-06-04 2018-11-23 刘洋 A kind of isomeric data mapped system and method based on XSL language conversion
CN112035707A (en) * 2020-08-17 2020-12-04 深圳市中盛瑞达科技有限公司 Operation conversion method and system
CN114995877A (en) * 2022-08-03 2022-09-02 平安银行股份有限公司 Variable configuration method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040044687A1 (en) * 2002-08-30 2004-03-04 Thomas Vachuska Apparatus and method using pre-described patterns and reflection to generate a database schema
CN101419611A (en) * 2007-10-22 2009-04-29 软件股份公司 Method for performing an operation on an XML database
CN101699397A (en) * 2009-10-09 2010-04-28 上海宝信软件股份有限公司 Method for binding Java and XML data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040044687A1 (en) * 2002-08-30 2004-03-04 Thomas Vachuska Apparatus and method using pre-described patterns and reflection to generate a database schema
CN101419611A (en) * 2007-10-22 2009-04-29 软件股份公司 Method for performing an operation on an XML database
CN101699397A (en) * 2009-10-09 2010-04-28 上海宝信软件股份有限公司 Method for binding Java and XML data

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
余俊新等: "J2EE中对象关系映射的研究与实现", 《计算机技术与发展》 *
雷明强等: "基于Toplink的对象-XML映射", 《中国科技论文在线》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462091A (en) * 2013-09-13 2015-03-25 方正信息产业控股有限公司 XML (extensive markup language) data operating method and device
CN104270453A (en) * 2014-10-11 2015-01-07 苏州科达科技股份有限公司 Method for data communication between multilevel servers and servers
CN104270453B (en) * 2014-10-11 2018-02-13 苏州科达科技股份有限公司 Data communications method and server between a kind of multistage server
CN106886390A (en) * 2015-12-15 2017-06-23 大唐软件技术股份有限公司 A kind of Java object generation and conversion method and Java object generation and conversion equipment
CN107678806A (en) * 2017-09-30 2018-02-09 北京酷我科技有限公司 A kind of object type switchs to the method for type of database
CN108874944A (en) * 2018-06-04 2018-11-23 刘洋 A kind of isomeric data mapped system and method based on XSL language conversion
CN108874944B (en) * 2018-06-04 2022-06-03 刘洋 XSL language transformation-based heterogeneous data mapping system and method
CN112035707A (en) * 2020-08-17 2020-12-04 深圳市中盛瑞达科技有限公司 Operation conversion method and system
CN112035707B (en) * 2020-08-17 2021-03-30 深圳市中盛瑞达科技有限公司 Operation conversion method and system
CN114995877A (en) * 2022-08-03 2022-09-02 平安银行股份有限公司 Variable configuration method and device

Similar Documents

Publication Publication Date Title
CN102937992A (en) Object mapping transformation design method based on Java and X extensive makeup language (XML) database
Astrova et al. Storing OWL ontologies in SQL relational databases
Patel-Schneider Analyzing schema. org
CN102609255A (en) Generation method for Spring IOC (Inversion of Control) configuration file
Li et al. Transforming UML class diagrams into HBase based on meta-model
CN102810114A (en) Personal computer resource management system based on body
CN103019689A (en) Universal object serialization realizing method
CN106407302A (en) Method for supporting function of calling specific functions of middleware database through simple SQL
CN103927385A (en) Unifying method and device of data model
CN103853759A (en) Self-adaptive form generation method and self-adaptive form generation system
Grandi Dynamic class hierarchy management for multi-version ontology-based personalization
CN112256927A (en) Method and device for processing knowledge graph data based on attribute graph
CN110717014B (en) Ontology knowledge base dynamic construction method
CN105550176A (en) Basic mapping method for relational database and XML
Lassila et al. Graph? Yes! Which one? Help!
Rajugan et al. XML views: Part 1
Yang et al. Transforming XML to RDF (S) with temporal information
Grandi Dynamic multi-version ontology-based personalization
Zhang et al. An extended hybrid ontology approach to data integration
Zhang et al. Automatic extraction rules generation based on xpath pattern learning
Peng et al. A folksonomy-ontology-based digital gazetteer service
Rishe et al. Semantic wrapper: concise semantic querying of legacy relational databases
De Vries et al. In support of mesodata in database management systems
Yétongnon et al. A web-centric semantic mediation approach for spatial information systems
Johnson Sustainability= separation: Keeping database structure, domain structure, and interface separate

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130220