The technical story of how ChemAxon supports InChI and RInChI in its products. A brief presentation about the challenges of connecting Java applications with native C and C++ libraries focusing on the native libraries released by the InChI Trust(https://www.inchi-trust.org/
2. We are your scientific partner to build a
sustainable future through innovating
best-in-class software solutions for
chemistry and biology.
About ChemAxon
3. About me
Name: István Őri
Job title: Technical Lead
Company: ChemAxon
Team: Representation & IO
5. Why?
Basically, because InChI and InChIKey are working.
They are useful identifiers which can represent chemical
structures in a canonical form, in a compact,
machine-friendly way.
7. Access InChI software from Java
● Option A:
Expect the user to install and configure the InChI library and use it in a
process from Java
● Option B:
Wrap the native libraries within the Java application and access it via JNI or
JNA as an API
8. Option A
Pros:
● No extra trick required, can be used as a command line tool.
Cons:
● It is inconvenient for the user
● Handling of different versions of the InChI software is required
● The API offers more than the command line interface.
9. Option B
Pros:
● The API offers more than the command line interface.
● It is more convenient for the user
● Full control over the version of the library
Cons:
● It is inconvenient for the developer
● It is quite easy to work with C libraries in Java, but in case of C++ libraries it
can be difficult to manage complex data structures
10. Option B - Inconveniences
● Memory management in C/C++ and Java is very different
● It is relatively easy to manage structs and primitive variables, but the
management of class instances is on a whole other level
Option B - Weapon of choice
● JNI or JNA?
11. Option B - Solutions
● Memory management in C/C++ and Java is very different
Get used to it!
● It is relatively easy to manage structs and primitive variables, but the
management of class instances is on a whole other level
Use the subset of the API where structs and primitive variables are enough.
12. DTOs for Java API JNA Structs for C API InChI v1.05
Toolkits and services
Data transformations in Option B (InChI)
13. Data transformations in Option B (RInChI)
DTOs for Java API JNA String from C++ API
RInChI v1.00
Toolkits and services
RXN Export JNA String for C++ API
Fallback to InChI workflow