Date post: | 21-Jan-2015 |
Category: |
Technology |
Upload: | nomos-software |
View: | 545 times |
Download: | 11 times |
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
Find out more: contact [email protected]
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
XML to MongoDb BSON Requirements
XML MongoDbSourceBSON
Insert to MongoDbcollections
Validate
Enrich
Query
Preserve types
Preserve relationships
API Platform
Messaging Bus
Etc
BSONBSON
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Overview of RuleX from Nomos Software
RuleX RuleX MongoDb FlavorGenerates java librariesthat validate, enrich and query XML based on high level rules
fast to build, easy to maintain, high performance, ultra lightweight java libraries
Generates java librariesthat validate, enrich and query….
Returns detailed error informationerror descriptions & locations : line numbers & Xpath, autocorrected XML fragments etc
Returns query results in BSON
Preserves XML types
Preserves XML relationships
XML to BSON Challenges
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
XML to BSON – Challenge 1
BSON has 18 primitive types : http://docs.mongodb.org/manual/reference/bson-types/
XML Schema has over 40 primitive types : http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
Need to map dates, times, integers etc correctly
Otherwise, useful operations such as date comparisons and numeric computations cannot be executed on the MongoDb BSON collections
Preserving XML primitive type information in BSON
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
XML to BSON – Challenge 2
This is an XML string primitive type, but needs to be treated as an integer
Preserving XML simple type information in BSON
If not mapped correctly, useful operations such as date comparisons and numeric computations cannot be executed on the MongoDb BSON collections
This is an XML integer primitive type, but needs to be treated as a date
Example from ISO 20022: http://www.iso20022.org/
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
XML to BSON – Challenge 3
Relationships are identified in XML using keys, keyrefs, ids, idrefs, hrefs etc(marked up XML)
Preserving XML relationships
Example from FpML: http://www.fpml.org/
Any hrefs using ‘party1’ are referring to the ‘party1’ at end of file.
Need to preserve the information about the relationships in the generated BSON.
RuleX MongoDb Flavor
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Generated Java
Libraries
RuleX Technical Overview
Generated Java
Libraries
SOAP, Rest or Java API
XML
XML Schema
RuleX flavor forMongoDb
Requirements as Rules
Deploy Generated Library
+
Documentation
BSON
BSONBSON
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Generated Java
Libraries
Java Libraries are fully functional and 100% autogenerated by Nomos RuleX product.
Generated code is java readable source code.
No additional coding required.
XML to BSON via RuleX Java Libraries
Java Libraries generated by RuleX
SOAP, Rest or Java API
XML MongoDbSourceBSON
BSONBSON
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Analyst or developer authors rules, e.g. to extract all payment transactions in a file
individually
Building ‘XML to BSON’ Libraries with RuleX
Generated Java
Library
Single click generation.
Transforms any XML conformant with the schema into BSON, in accordance with the
rules.
RuleX Flavorfor MongoDb
XML Schema Rules
BSONXMLBSON
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Example query rules on XML
Query Name Query Description
GetHighPaymentTypeInformation
self.PmtInf.PmtTpInf->select(a | a.InstrPrty='HIGH')
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*.
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
RuleX MongoDb Flavor
RuleX generated java libraries
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
MongoDb
BSON Collection of PmtInfs
DocumentHeader (GrpHdr)Payment (PmtInf)Payment (PmtInf)…
XML
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Example – Building a MongoDb Flavor Library
Generated Java
Library
ISO 20022 SEPA Payments XML, pain.001.001.003
Single click generation
Returns BSON document for each cheque payment, and connects to MongoDb instance
via java driver and adds to MongoDbcollections
Schema Pain.001.001.003.xsd
PmtInf->select(a |a.PmtMtd = ‘CHK’))
Custom Query Rule:Select every payment (PmtInf) found in the XML document that uses Payment Method
(PmtMtd) cheque (CHK)
RuleX Flavorfor MongoDb
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Example – Building a Library
Single Click Generation with RuleX Eclipse Plugin
PmtInf->select(a |a.PmtMtd = ‘CHK’))
Spreadsheet containing one rule:“paymentsWhoseMtdIsChk”
XML Schema
Java Readable Source CodeINPUT
OUTPUT
www.nomos-software.comCopyright © Nomoséire Limited 2014 trading as Nomos Software nomossoftware
Running the Library
Input : ISO 20022 SEPA XML File Result: Updated collections in MongoDb
Screenshot shows results of find statement executed on mongoDb instance
Find out more?
http://nomos-software.com/contact
nomossoftware https://www.linkedin.com/company/nomos-software