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

Remove 'include' in favor of XInclude #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 9 additions & 30 deletions mef/model_organization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,23 @@ For even medium size PSA models this assumption not compatible with Quality Cont
Moreover, such a monolithic organization of data would be very hard to manage
when several persons work together on the same model.

A first way to split the model into several files is to use the XML notion of entities:
in any XML file, it is possible to declare file entities in the preamble,
and to include them in the body of the document.
This mechanism is exemplified below.

.. code-block:: xml

<?xml version="1.0" ?>

<!DOCTYPE SMRF [
<!ENTITY file1 SYSTEM "file1.xml">
<!ENTITY file2 SYSTEM "file2.xml">
]>
<smrf>
...
&file1;
...
&file2;
...
</smrf>

This mechanism, however, has the drawback
that XML tools have to actually include the files into the document,
hence, making its manipulation heavier.

The Model Exchange Format proposes another simple mechanism to achieve the same goal:
the tag include.
The Model Exchange Format utilizes XInclude_,
general purpose XML Include (W3C Candidate Recommendation),
which allows splitting the model in flexible and unconstrained ways.
This tag can be inserted at any place in a document.
Its effect is to load the content of the given file into the model.
Its effect is to include the content of the given file into the model.

.. code-block:: xml

<opsa-mef>
<opsa-mef xmlns:xi="http://www.w3.org/2001/XInclude">
...
<include file="basic-events.xml"/>
<xi:include href="basic-events.xml"/>
...
</opsa-mef>

.. _XInclude: https://www.w3.org/TR/xinclude/


Organization of a Model
=======================

Expand Down
9 changes: 3 additions & 6 deletions mef/schema/fault_tree.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ fault-tree-definition =
| CCF-group-definition
| event-definition
| component-definition
| parameter-definition
| include-directive)*
| parameter-definition)*
}

component-definition =
Expand All @@ -21,8 +20,7 @@ component-definition =
| CCF-group-definition
| event-definition
| component-definition
| parameter-definition
| include-directive)*
| parameter-definition)*
}

role = attribute role { "private" | "public" }
Expand All @@ -31,8 +29,7 @@ model-data =
element model-data {
(house-event-definition
| basic-event-definition
| parameter-definition
| include-directive)*
| parameter-definition)*
}

event-definition =
Expand Down
5 changes: 0 additions & 5 deletions mef/schema/mef.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ reference =
xsd:NCName { pattern = "([^\-.]+(-[^\-.]+)*)(\.\i[^\-.]*(-[^\-.]+)*)*" }
}

include-directive =
element include {
attribute file { xsd:string }
}

include "model.rnc"
include "label_and_attributes.rnc"

Expand Down
3 changes: 1 addition & 2 deletions mef/schema/model.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ model =
| initiating-event-definition
| fault-tree-definition
| substitution-definition
| CCF-group-definition
| include-directive)*
| CCF-group-definition)*
}