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

Transition from DTD/EBNF to RELAX NG Compact schema #18

Merged
merged 20 commits into from
Feb 22, 2017

Conversation

rakhimov
Copy link
Member

@rakhimov rakhimov commented Dec 11, 2016

As presented at the workshop,
RelaxNG Compact (RNC) is a modern and convenient schema language
capable of fully describing features of the MEF
unlike the DTD.

The RNC syntax is very much the BNF-like readable,
leveraging regular expression operators.
The transition from the DTD to the RNC
should ease introduction of new MEF features.

The MEF schema in the RNC language is already provided
thanks to the early effort in the SCRAM project.
Only work necessary was to swap the schema in the Appendix B,
and update the wording in Chapter 2: Introduction.

The only current minor-drawback
is that syntax highlighter Pygments
doesn't yet provide support for RNC,
so it looks like a plain text or the EBNF.

(Available with Pygments 2.2)

Closes #11

@rakhimov rakhimov added this to the v2.1.0 milestone Dec 11, 2016
@rakhimov rakhimov self-assigned this Dec 11, 2016
@rakhimov rakhimov changed the title Transition from DTD to RelaxNG Compact schema Transition from DTD/EBNF to RELAX NG Compact schema Dec 14, 2016
@rakhimov
Copy link
Member Author

Syntax highlighting will be provided in upcoming Pygments 2.2

@rakhimov
Copy link
Member Author

A good tutorial for reviewers of this PR: http://relaxng.org/compact-tutorial-20030326.html
This tutorial is also referenced in the MEF instead of giving its own custom one.

@rakhimov rakhimov force-pushed the dtd-to-rnc branch 3 times, most recently from cd84231 to 7005a26 Compare December 15, 2016 03:24
@rakhimov
Copy link
Member Author

The work on conversion to RELAX NG Compact (RNC) is complete.
The EBNF and DTD are removed in favor of the RNC.
As a result, the grammar-to-schema synchronization burden is eliminated altogether.
Pesky errors in the ENBF are gone for good.
The redundant appendix of the full MEF EBNF is removed.

Thanks to excellent tutorials of the RNC and its self-descriptiveness,
the MEF specification is free from the burden of inventing its own tutorials.
Thus, the tutorial appendix is gone.

Following the Single Point of Truth (SPOT) principle,
all the grammar specifications inside of the MEF
are automatically compiled into the final RNC XML schema of the MEF.
It is always up-to-date.

Moreover, there's a requirement for all the schemas in the specification
to be correct and complete.
In other words, no more sketches or partial grammars.
Each construct requires its own full grammar to be presented with its section/description.

To bomb the last Appendix with the full schema of the MEF,
the schema (or rather schemas in various formats)
is provided in the special repository referenced by the standard.
Furthermore, the reference schema in the RNC format
is provided together with the standard in the zip file.

This work removes a lot of accidental complexity out of the standardization process.
The goal is for the community to have easier (less error-prone) time working on the MEF.

This PR is ready to be merged.

@rakhimov
Copy link
Member Author

The resulting html/pdf can be seen at https://rakhimov.github.io/mef-rnc/

As presented at the workshop,
RelaxNG Compact (RNC) is a modern and convenient schema language
capable of fully describing features of the MEF
unlike the DTD.

The RNC syntax is very much the BNF-like readable,
leveraging regular expression operators.
The transition from the DTD to the RNC
should ease introduction of new MEF features.

The MEF schema in the RNC language is already provided
thanks to the early effort in the SCRAM project.
Only work necessary was to swap the schema in the Appendix B,
and update the wording in Chapter 2: Introduction.

The only current minor-drawback
is that syntax highlighter Pygments
doesn't yet provide support for RNC,
so it looks like a plain text or the EBNF.

Closes open-psa#11
An excellent tutorial is provided by the specification community.
There's no need for the MEF to have any redundant material,
wasting its effort.
Besides, the RNC language is very self-descriptive.
This is no longer as the representation moves to the RNC.
The RNC is worded to be the presentation language for the constructs.
The appendix is redundant
since the schema is already available for the whole MEF.
Start separating the schema snippets into files
in schema subdirectory.
The RNC schemas for fault tree and formula are separated
into two files.
The schema is full including other yet-undefined constructs.
CCF group and substitution definitions are placed
into separate schema files.
Initiating events, event tree, instructions
are separated into RNC files.
- Consequence groups
- Missions and phases
- Models

The redundant representation/grouping of all containers
is removed.
It can be referenced and available in respective parts.
This approach simplifies the management of schemas.

Should it be required in future,
the grouping could be reintroduced.
- Sum of products
- Statistical measure
- Curves
- Boolean operations
- Built-ins
- Conditional operations
- Expressions
- Numerical operations
- Test events
- Stochastic layer
- Random deviates
This schema combines all the schemas into the start grammar.
This major schema can be used for validation of input files.

Note that this major schema leverages RELAX NG include feature
instead of performing simple textual inclusion.
This allow a modular development of the schema
and provides conformance to SPOT principle.
This schema can be in various formats
can be obtained from the schemas repository.
Since now the specification contains full schemas
(no more sketches or drafts in the formal specification!),
the specification text itself already contains the full schema
that can be cherry-picked by the implementers.

The Appendix is redundant.
The schemas are all contained within this repository.
They will be the up-to-date standard schema
following the changing in this repository.

The external 'schemas' repository is only provided
for schemas in various other formats.
This tests validate
that the schema successfully converts to RNG and XSD.
In addition, a some test runs on example input files
from the mef-examples repository.
This archive can be downloaded from the website.
It includes the contents of the mef/schema directory.
The lower-boundary expression was omitted in the schema.
Requires Pygments 2.2 version.
Copy link
Contributor

@mhibti mhibti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is Ok for me. Thanks

@rakhimov rakhimov merged commit a3a3970 into open-psa:master Feb 22, 2017
@rakhimov
Copy link
Member Author

Thanks @mhibti !

@rakhimov rakhimov deleted the dtd-to-rnc branch February 22, 2017 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants