Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ability to save/restore Grammar #8

Closed
mbeckerle opened this issue Nov 11, 2022 · 3 comments
Closed

Feature request: Ability to save/restore Grammar #8

mbeckerle opened this issue Nov 11, 2022 · 3 comments

Comments

@mbeckerle
Copy link

I have large XSD (hundreds of quite large XSD files, 10+ Megabytes of XSD).

I need to use schema-aware EXI, both with and without the compression option.

The time taken to create the Grammar from these XSD is significant.

The Grammar objects are currently not serializable.

Could they be so that one could compile the XSD to a grammar once, save to a file, then reload from file to reuse?

@danielpeintner
Copy link
Member

I see your argument and their were some ideas to specify how a pre-processed EXI grammars exchange format might look like. Having said that, it never made it to be standardized.
What you are asking is a way to store EXI grammars with Serializable in Java. In other projects I did not make good experience with it since new Java Version might break the way a thing is serialized. Moreover, one can process the XSD once it is required and re-use it for any subsequent call the EXI encoding / decoding process requires it. This might be an alternative.

Note1: I believe this issue belongs to https://github.com/EXIficient/exificient-grammars
Note2: https://github.com/EXIficient/exificient-grammars#exchange-of-exi-grammars has some information how exchange can be done otherwise .. but I assume loading the XSD directly (once) in most of the cases is not really slower..

@mbeckerle
Copy link
Author

Thank you for this information.

Should I re-create this ticket on the exificient-grammars repo?

Serializing the grammar to XML, or to JSON would likely solve my problem. I will investigate per the links you provided.

A standard and portable form for these grammars would be nice, but is not required, nor do we need the serialization of the grammar to be reusable across versions of Exificient nor versions of Java.

There are actually two reasons why a serialized grammar is needed.

(1) performance - the penalty of converting a large XSD into a grammar at startup

(2) resolver - eliminate the need to have multiple things to use the schema-aware EXI file: (a) entire schema and (b) software linked to our URI resolver (Apache Daffodil has a specific resolver that uses XML Catalogs, relative paths, and classpath search of directories/jars - which enables packaging XSD schemas into jar files like any reusable software module.)

@danielpeintner
Copy link
Member

Moved to EXIficient/exificient-grammars#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants