nomossoftware nomos-software.com XML to MongoDb BSON XML to BSON Requirements Overview of RuleX & RuleX MongoDb Flavor XML to BSON Challenges RuleX MongoDb Flavor Explained Worked Example: ISO 20022 XML inserted to MongoDb Find out more: contact [email protected]
MongoDb stores data in BSON (binary JSON) format. A primary use case for MongoDb is to store JSON data.
But what If you want to insert XML data. BSON and XML support more data types than JSON, and it can useful to maintain the fidelity of the XML type information when you insert data to MongoDb.
These slides explain some of the challenges in inserting XML data to MongoDb, and give an overview of how the RuleX product from Nomos Software can be used to map XML to BSON.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
nomossoftware nomos-software.com
XML to MongoDb BSONXML to BSON Requirements
Overview of RuleX & RuleX MongoDb FlavorXML to BSON Challenges
RuleX MongoDb Flavor ExplainedWorked Example: ISO 20022 XML inserted to MongoDb
Return all payment type information who have an instruction authority set to High
GetAllChkPaymentsself.PmtInf->select(a | a.PmtMtd='CHK' and a.NbOfTxs.toInteger() > 0)
Return all payments transaction type is cheque and whose number of transactions exceed 0
GetAllCorkPostalCodesself.PstlAdr->select(a | a.Ctry = 'IRL' and a.PstCd = 'CORK')
Return all Postal Address whose Country is Ireland and who post code is Cork
* Validation and query rules are based on the OCL standard: http://www.omg.org/spec/OCL/2.3.1/Rules language has been extended to support support enrichment (action) rules, as well as additional functions for specific domains.
Examples of Rules
RuleX generates java code for each rule.
RuleX supports validation, query and enrichment rules*.
Unmarshall XML to com.mongoDb.DBObject java classes
Run query rules on the java classes returning results as BSON
Preserve XML type information mapping XML primitive types to BSON primitive types
mapping XML simple types to BSON primitive types
Preserve XML relationships preserving the semantics of XML hrefs, keys etc
Example:
Building a MongoDb Flavor library
The library:- takes an XML document containing multiple payment transactions - generates BSON for each ‘cheque’ payment- connects to a MongoDb instance via the java driver