Giter Club home page Giter Club logo

pyecore's Introduction

PyEcore: A Pythonic Implementation of the Eclipse Modeling Framework

pypi-version master-build coverage code-quality license

PyEcore is a Model Driven Engineering (MDE) framework written for Python. Precisely, it is an implementation of EMF/Ecore for Python, and it tries to give an API which is compatible with the original EMF Java implementation.

PyEcore allows you to handle models and metamodels (structured data model), and gives the key you need for building MDE-based tools and other applications based on a structured data model. It supports out-of-the-box:

  • Data inheritance,
  • Two-ways relationship management (opposite references),
  • XMI (de)serialization,
  • JSON (de)serialization,
  • Notification system,
  • Reflexive API...

Let's see how we can create a very simple "dynamic" metamodel (as opposed to static ones, see the documentation for more details):

>>> from pyecore.ecore import EClass, EAttribute, EString, EObject
>>> Graph = EClass('Graph')  # We create a 'Graph' concept
>>> Node = EClass('Node')  # We create a 'Node' concept
>>>
>>> # We add a "name" attribute to the Graph concept
>>> Graph.eStructuralFeatures.append(EAttribute('name', EString,
                                                default_value='new_name'))
>>> # And one on the 'Node' concept
>>> Node.eStructuralFeatures.append(EAttribute('name', EString))
>>>
>>> # We now introduce a containment relation between Graph and Node
>>> contains_nodes = EReference('nodes', Node, upper=-1, containment=True)
>>> Graph.eStructuralFeatures.append(contains_nodes)
>>> # We add an opposite relation between Graph and Node
>>> Node.eStructuralFeatures.append(EReference('owned_by', Graph, eOpposite=contains_nodes))

With this code, we have defined two concepts: Graph and Node. Both have a name, and there exists a containment relationship between them. This relation is bi-directional, which means that each time a Node object is added to the nodes relationship of a Graph, the owned_by relation of the Node is also updated (it also works the other way around).

Let's create some instances of our freshly created metamodel:

>>> # We create a Graph
>>> g1 = Graph(name='Graph 1')
>>> g1
<pyecore.ecore.Graph at 0x7f0055554dd8>
>>>
>>> # And two node instances
>>> n1 = Node(name='Node 1')
>>> n2 = Node(name='Node 2')
>>> n1, n2
(<pyecore.ecore.Node at 0x7f0055550588>,
 <pyecore.ecore.Node at 0x7f00555502b0>)
>>>
>>> # We add them to the Graph
>>> g1.nodes.extend([n1, n2])
>>> g1.nodes
EOrderedSet([<pyecore.ecore.Node object at 0x7f0055550588>,
             <pyecore.ecore.Node object at 0x7f00555502b0>])
>>>
>>> # bi-directional references are updated
>>> n1.owned_by
<pyecore.ecore.Graph at 0x7f0055554dd8>

This example gives a quick overview of some of the features you get for free when using PyEcore.

The project slowly grows and it still requires more love.

Installation

PyEcore is available on pypi, you can simply install it using pip:

$ pip install pyecore

The installation can also be performed manually (better in a virtualenv):

$ python setup.py install

Documentation

You can read the documentation at this address:

https://pyecore.readthedocs.io/en/latest/

Dependencies

The dependencies required by pyecore are:

  • ordered-set which is used for the ordered and unique collections expressed in the metamodel,
  • lxml which is used for the XMI parsing.

These dependencies are directly installed if you choose to use pip.

Run the Tests

The tests use py.test and 'coverage'. Everything is driven by Tox, so in order to run the tests simply run:

$ tox

Liberty Regarding the Java EMF Implementation

  • There is some meta-property that could be missing inside PyEcore. If you see one missing, please open a new ticket!
  • Proxies are not "removed" once resolved as in the the Java version, instead they act as transparent proxies and redirect all calls to the 'proxied' object.
  • PyEcore is able to automatically load some model/metamodel dependencies on its own.

State

In the current state, the project implements:

  • the dynamic/static metamodel definitions,
  • reflexive API,
  • inheritance,
  • enumerations,
  • abstract metaclasses,
  • runtime typechecking,
  • attribute/reference creations,
  • collections (attribute/references with upper bound set to -1),
  • reference eopposite,
  • containment reference,
  • introspection,
  • select/reject on collections,
  • Eclipse XMI import (partially, only single root models),
  • Eclipse XMI export (partially, only single root models),
  • simple notification/Event system,
  • EOperations support,
  • code generator for the static part,
  • EMF proxies (first version),
  • object deletion (first version),
  • EMF commands (first version),
  • EMF basic command stack,
  • EMF very basic Editing Domain,
  • JSON import (simple JSON format),
  • JSON export (simple JSON format),
  • introduce behavior @runtime,
  • resources auto-load for some cross-references,
  • derived collections,
  • multiple roots resources,
  • xsi:schemaLocation support for XMI resources,
  • URI mapper like,
  • EGeneric support (first simple version),
  • URI converter like

The things that are in the roadmap:

  • new implementation of EOrderedSet, EList, ESet and EBag,
  • new implementation of EStringToStringMapEntry and EFeatureMapEntry,
  • improve documentation,
  • copy/paste (?).

Existing Projects

There aren't too many projects proposing to handle models and metamodels in Python. The only projects I found are:

PyEMOF proposes an implementation of the OMG's EMOF in Python. The project targets Python2, only supports Class/Primitive Types (no Enumeration), XMI import/export and does not provide a reflexion layer. The project didn't move since 2005.

EMF4CPP proposes a C++ implementation of EMF. This implementation also introduces Python scripts to call the generated C++ code from a Python environment. It seems that the EMF4CPP does not provide a reflexive layer either.

PyEMOFUC proposes, like PyEMOF, a pure Python implementation of the OMG's EMOF. If we stick to a kind of EMF terminology, PyEMOFUC only supports dynamic metamodels and seems to provide a reflexive layer. The project does not appear to have moved since a while.

Contributors

Thanks for making PyEcore better!

Additional Resources

  • This article on the blog of Professor Jordi Cabot gives more information and implementation details about PyEcore.

pyecore's People

Contributors

4ekin avatar aacebedo avatar annighoefer avatar aranega avatar arrys avatar cdrabek avatar cfandy avatar danyeaw avatar ewoudwerkman avatar jamoralp avatar marvingreenberg avatar moltob avatar pablo-campillo avatar terrykingston avatar ubmarco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyecore's Issues

Issue deserializing '' for eattribute

I ran into this with some ecore data I generated out of Enterprise Architect.

An example of the ecore I'm trying to parse would be something like:

<eClassifiers 
      xsi:type="ecore:EClass"
      name="LineFault"
      eSuperTypes="#//IEC61970/Base/Faults/Fault">
  <eStructuralFeatures 
      xsi:type="ecore:EAttribute"
      eType="#//IEC61970/Base/Domain/Length"
      name="lengthFromTerminal1"
      lowerBound="0"
      upperBound="1"
      transient="false"
      derived="false"
      ordered="false"
      changeable="true"
      defaultValueLiteral="" />
</eClassifiers>

The key issue is that the value of defaultValueLiteral has been set to "" by my ecore exporter, and when pyecore tries to deserialize this it fails because it expects there to be an integer:

Traceback (most recent call last):
  File "/home/alodder/Development/.virtualenvs/PyCIM/bin/pyecoregen", line 11, in <module>
    sys.exit(main())
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecoregen/cli.py", line 15, in main
    generate_from_cli(sys.argv[1:])  # nocover
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecoregen/cli.py", line 57, in generate_from_cli
    model = load_model(parsed_args.ecore_model)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecoregen/cli.py", line 88, in load_model
    resource = rset.get_resource(uri_implementation(ecore_model_path))
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/resource.py", line 86, in get_resource
    resource.load(options=options)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 60, in load
    self._decode_eobject(child, modelroot)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 169, in _decode_eobject
    self._decode_eobject(child, eobject)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 169, in _decode_eobject
    self._decode_eobject(child, eobject)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 169, in _decode_eobject
    self._decode_eobject(child, eobject)
  [Previous line repeated 1 more time]
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 153, in _decode_eobject
    self._decode_eattribute_value(eobject, eattribute, value, from_tag)
  File "/home/alodder/Development/.virtualenvs/PyCIM/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 144, in _decode_eattribute_value
    val = eattribute.eType.from_string(value)
ValueError: invalid literal for int() with base 10: ''

The specific failure point is here.

I think this would be easy to fix and I'd be willing to contribute the work, but I don't know if what I'm experiencing is a bug or if it is expected behaviour and my ecore is just badly formed.

How to consider eAnnotation name of the attribute of EClass instead of Feature name

We are trying to load xmi file after registering the dynamic ecore meta model as like mentioned in documentation .

When it loads the file, I am getting this error
ValueError: Feature "nW-PACKAGES" is unknown for NETWORK

Whereas, in my EClass, there is feature named "nWPACKAGES" linked through extended meta Data Annotation with the name "NW-PACKAGES"

Is there any way to make pyecore to consider annotation name instead of feature name

Below is my EClass
<eClassifiers xsi:type="ecore:EClass" name="NETWORK">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="NETWORK"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="nWPACKAGES" Type="#//NWPACKAGESType1" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="NW-PACKAGES"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>

Generate Static Metamodel Code with eGenericSuperTypes

I want to generate a static metamodel in python from an .ecore file. But when I try to generate the python code with the pyecoregenerator, I get the following error message:

Traceback (most recent call last):
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\Scripts\pyecoregen-script.py", line 11, in
load_entry_point('pyecoregen==0.4.3', 'console_scripts', 'pyecoregen')()
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecoregen-0.4.3-py3.5.egg\pyecoregen\cli.py", line 15, in main
generate_from_cli(sys.argv[1:]) # nocover
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecoregen-0.4.3-py3.5.egg\pyecoregen\cli.py", line 57, in generate_from_cli
model = load_model(parsed_args.ecore_model)
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecoregen-0.4.3-py3.5.egg\pyecoregen\cli.py", line 88, in load_model
resource = rset.get_resource(uri_implementation(ecore_model_path))
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecore-0.9.0-py3.5.egg\pyecore\resources\resource.py", line 86, in get_resource
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecore-0.9.0-py3.5.egg\pyecore\resources\xmi.py", line 60, in load
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecore-0.9.0-py3.5.egg\pyecore\resources\xmi.py", line 169, in _decode_eobject
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecore-0.9.0-py3.5.egg\pyecore\resources\xmi.py", line 148, in _decode_eobject
File "C:\Users\RBO7SI\AppData\Local\Programs\Python\Python35\lib\site-packages\pyecore-0.9.0-py3.5.egg\pyecore\resources\xmi.py", line 183, in _decode_node
ValueError: Feature "eGenericSuperTypes" is unknown for EClass, line 24

Are there any options to solve this issue? Is it possible to extend / adapt the generator to work with 'eGenericSuperTypes'?

Here is my .ecore file (testecore.ecore):

<?xml version="1.0" encoding="UTF-8"?> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testecore" nsURI="http://www.example.org/testecore" nsPrefix="testecore"> <eClassifiers xsi:type="ecore:EClass" name="Owner"> <eStructuralFeatures xsi:type="ecore:EReference" name="buildings" upperBound="-1" eType="#//Building"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Building" abstract="true"> <eTypeParameters name="T"/> <eStructuralFeatures xsi:type="ecore:EReference" name="test" upperBound="-1" containment="true"> <eGenericType eTypeParameter="#//Building/T"/> </eStructuralFeatures> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="House" eSuperTypes="#//Building"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="rooms" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Test"> <eTypeParameters name="T"/> <eStructuralFeatures xsi:type="ecore:EReference" name="hallo" upperBound="-1" containment="true"> <eGenericType eTypeParameter="#//Test/T"/> </eStructuralFeatures> <eGenericSuperTypes eClassifier="#//Building"> <eTypeArguments eTypeParameter="#//Test/T"/> </eGenericSuperTypes> </eClassifiers> </ecore:EPackage>

testecore.zip

Issue with serializing EString EAttributes with upperBound="-1"

Hello @aranega

It appears there is an issue with serializing EAttributes which are a list of strings.
For example, in testing with the following EClass EAttribute

<eStructuralFeatures xsi:type="ecore:EAttribute" 
  eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" 
  upperBound="-1" 
  name="myStringList"/>

In a resource generated based on the metamodel, the attribute is an EOrderedSet (because of the upperBound="-1") which is good, then strings are added to it and then the resource is saved, resulting in:

<myClass
  ...
  myStringList="E O r d e r e d S e t ( [ ' s t r i n g    o n e ' ,   ' s t r i n g   t w o ' , ] )"

There's always the possibility that I'm just doing it wrong, But this brings the question of the correct way of defining a list of strings in XML. It appears the string values, specifying the xmi:ids, are space-delimited on the EResource attributes. I'm guessing the space-delimination is probably also being applied here. Does mean EString EAttributes should have escaped space characters when they are not meant to delimit strings in the list? Please help me understand the correct way to add a list of string values in the XML.

Thanks,

Code generator not producing correct Python types for all ECore Integer types

Hi,

first of all: this is a great project. I was looking for something like this for quite a while and did not take on the effort to implement it myself. I am thrilled to see the level of features you have already working and would love to use this in my own projects.

When starting to play with this library I also tried the generator via genmycode and noticed that a few integer types are not properly translated, e.g. EIntegerObject:

major = EAttribute(eType=EIntegerObject)
minor = EAttribute(eType=EIntegerObject)

This generated code does not compile as the literally copied type name is not defined in the library as meta -meta type...

I am happy to update the generator via PR if you like, just let me know. If you're accepting PRs, I'd also fix a few other things like Python keyword collisions at some later point.

Would this work for you?

Best,
Mike

install_issubclass_patch conflict with typing.py's check

Hi Vincent @aranega
install_issubclass_patch patches the bulitin.issubclass . But typing code will validate the package name of your patched function, like following code for GenericType:

    def __subclasscheck__(self, cls):
        if self.__origin__ is not None:
            if sys._getframe(1).f_globals['__name__'] not in ['abc', 'functools']:
                raise TypeError("Parameterized generics cannot be used with class "
                                "or instance checks")
            return False
        if self is Generic:
            raise TypeError("Class %r cannot be used with class "
                            "or instance checks" % self)
        return super().__subclasscheck__(cls)

Is there a way to solve this conflict?
-Andy

EAttribute with value 0 does not serialize

Hello,

When serializing a class in our metamodel, I've found that an EAttribute with type EDouble and with value 0 does not appear in the serialized result. I would have expected the field to appear, with the value set to 0, but it appears that the entire field is not serialized when it's either 0 or when it's the same as the default value.

The definition of the EAttribute is as follows:
emission = EAttribute(eType=EDouble, derived=False, changeable=True, default_value=0.0)

Is this behaviour as intended? I ran into this problem when parsing the file in another application that doesn't use PyEcore, where I assumed I would have the field as I explicitly set it (with a value of 0).

Thanks in advance.

Target Python Version?

Which target version should PR's target? I noticed you implemented a custom enum class. Python 3.4 has this built-in and the feature is actually backported even to Python 2 (as library enum34). Just as an example.

If you really target Python 3 only, do you have a string opinion that it is required to keep old Python 3 versions supported? Python 3.6 for instance has performance improvements out of the box, and upgrading from Python 3.x to 3.6 should not be that much of an issue...

Please let me know.

ValueError: Feature iD does not exists for type EAttribute

Hi,

When I try to run the following

pyecoregen -e schema.ecore -o your_output_path

I did the following error.

pyecoregen -e schema.ecore -o your_output_path
Traceback (most recent call last):
  File "/Users/$USER/miniconda2/envs/python3-env/bin/pyecoregen", line 11, in <module>
    sys.exit(main())
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 12, in main
    generate_from_cli(sys.argv[1:])  # nocover
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 40, in generate_from_cli
    model = load_model(parsed_args.ecore_model)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecoregen/cli.py", line 59, in load_model
    resource = rset.get_resource(pyecore.resources.URI(ecore_model_path))
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/resource.py", line 41, in get_resource
    resource.load()
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 38, in load
    self._decode_eobject(child, modelroot)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 134, in _decode_eobject
    self._decode_eobject(child, eobject)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 109, in _decode_eobject
    eobject_info = self._decode_node(parent_eobj, current_node)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 186, in _decode_node
    feature = self._decode_attribute(eobject, key, value)
  File "/Users/$USER/miniconda2/envs/python3-env/lib/python3.6/site-packages/pyecore/resources/xmi.py", line 215, in _decode_attribute
    .format(att_name, owner.eClass.name))
ValueError: Feature iD does not exists for type EAttribute

Any suggestions on how I can go about debugging this?

Performance issue with big datasets

Hi,

we're facing a performance issue with our application based on PyEcore. After some profiling it seems that there is a big overhead when loading a timeseries into an object.

Here the generated code:

class TimeSeries(Value):
    scalingFactor = EAttribute(eType=EInt)
    value = EAttribute(eType=EDouble, upper=-1)
    unit = EReference(containment=True)

    def __init__(self, unit=None, scalingFactor=None, value=None, **kwargs):
        super(TimeSeries, self).__init__(**kwargs)
        if scalingFactor is not None:
            self.scalingFactor = scalingFactor
        if value:
            self.value.extend(value)
        if unit is not None:
            self.unit = unit

value will be a big list of floats (we can't pass a numpy array because of if value but thats another minor issue).
When we're calling the extend function we're in fact triggering a logic which is adding the elements of the list one by one to an OrderedSet and also doing checks on every element.

One possible solution i was figuring out to handle this is to replace that
self.value.extend(value)
with
self.value.items = value
although I don't know if I'm missing something important on the logic behind.

Thanks

Unexpected proxy object

While implementing the Python generator I am loading the library model from examples as sample model. For some reason I get a proxy object for the EInt type. I don't understand why...

This code reproduces the error, shown here as the failing assertion in the end:

def test__load_issue():
    rset = ResourceSet()
    resource = rset.get_resource(URI('../../examples/library.ecore'))
    library_model = resource.contents[0]
    rset.metamodel_registry[library_model.nsURI] = library_model

    book_class = library_model.getEClassifier('Book')
    pages_feature = book_class.findEStructuralFeature('pages')

    assert not isinstance(pages_feature.eType, EProxy)

Am I missing something during the load of the model?

Thanks!

Experiment a better XMI Resource using objectify from lxml

The current XMI parser/resource uses the basic etree API from lxml. This works at the moment, but there is many operations that are performed 'manually' by the XMIResource. It seems that the objectify API from lxml could be very useful to handle XML/XMI and to provide a quicker/more efficient XMIResource.
I don't know if I will have time to check this soon, but I guess performances would be better and will improve the loading of huge XMI (currently, about 11s for a 12Mbytes XMI composed of 115.000 elements).

References in model instances are not found

In my Ecore model, I defined the 'id' attribute as ID in EMF. When referencing to another element in my instance, it cannot find the id of the element as it does not use xmi:id (I use an XMLResource in EMF instead of an XMIResource) or uuid-attribute. Why is pyEcore not checking if an element has an ID-field defined and use that, since it supports defining an attribute as an ID?
Or did I configure something wrong?

AttributeError in new version 0.8.0

hi aranega,
when I use the version 0.7.16, create notation tree and save to file, it runs well; when I changed nothing but updated the version to 0.8.0, I met an error like this when I save to file.

Traceback (most recent call last):
  File "usecase.py", line 28, in <module>
    resource.save(options={XMIOptions.SERIALIZE_DEFAULT_VALUES: True})
  File "/home/suntao/PY3ENV/local/lib/python3.4/site-packages/pyecore/resources/xmi.py", line 323, in save
    tmp_xmi_root = self._go_across(root, serialize_default)
  File "/home/suntao/PY3ENV/local/lib/python3.4/site-packages/pyecore/resources/xmi.py", line 428, in _go_across
    frag, is_crossref = self._build_path_from(value)
  File "/home/suntao/PY3ENV/local/lib/python3.4/site-packages/pyecore/resources/resource.py", line 426, in _build_path_from
    uri_fragment = obj._xmiid
AttributeError: 'Structure' object has no attribute '_xmiid'

do you know what's wrong with that. if the problem isn't clear please let me know.

Support for visitor/doSwitch-like feature

Following a discussion on twitter with @tarelli, it would indeed be great that PyEcore proposes a solution that is the equivalent of the doSwitch.

I give it a though, and it seems that the logic behind the doSwitch is almost equivalent to the @singledispatch decorator from the functools lib (and there is a backport for Python 2.7). To match the behavior, I could be able to produce a decorator, e.g: @object_visitor (whatever the name), that could be used like this (in a metamodel with A, B, and C metaclasses):

class MyVisitor(object):
  @object_visitor
  def fun(self, arg):
    print('fallback for', arg)

  @fun.register(A)
  def caseA(self, arg):
    print('In case for A', arg)

  @fun.register(B)
  def caseB(self, arg):
    print('in case for B', arg)

And you would use it a little bit like the one in EMF (let say we have a root):

visitor = MyVisistor()
for obj in root.eAllContents():
  visitor.fun(obj)

This solution could also be used as base for a ComposedSwitch like the one in EMF. Currently, the advantages I see are that it relies on a standard library, and it would work in a same way for dynamic and static metamodels (which is great), However, a drawback is that you have to add the default fun function yourself and cannot inherit it from another component and should have the same name (not obligatory, but will help for ComposedSwitch, this could be enforce anyway).

@tarelli Would a doSwitch functionnality like this do the job?

Generate parameterized __init__ for meta model classes

I am trying to use the generated classes. Obviously I am noticing things.... :-)

When instantiating meta-model classes manually, I would greatly appreciate to have the ability to specify some attributes directly in the class call. So instead of writing

c = mm.MyClass()
c.feature1 = '...'
c.feature2 = '...'

I'd like to write

c = mm.MyClass(feature1='...', feature2='...')

On top of it I'd like to see code completion for this, as in this screenshot (FModel is a metaclass with features name, imports, interfaces and so on):

image

Is that something you planned to do or would be willing to PR-accept? If I'd tackle this in the generator, I'd probably generate initializers like this:

class FModel(EObject, metaclass=MetaEClass):
    name = EAttribute(eType=EString)
    imports = EReference(upper=-1, containment=True)
    interfaces = EReference(upper=-1, containment=True)
    typeCollections = EReference(upper=-1, containment=True)

    def __init__(self, name=None, *, imports=(), interfaces=(), typeCollections=()):
        super().__init__()
        self.name = name or None
        for e in imports:
            self.imports.append(e)
        for e in interfaces:
            self.interfaces.append(e)
        for e in typeCollections:
            self.typeCollections.append(e)

For attributes the default value would be taken from the actual default (here Nonefor the string attribute).

What do you think?

Drop Python 3.3 support?

I saw that the last version of pytest (3.3.0) drops Python 3.3 and 2.6 support. Moreover, many major distribution tends to include at least Python 3.4 as basic version.

So... should we drop Python 3.3 support for PyEcore? Unless there is some Python 3.3 afficionados, I would be in favor of dropping it, but still, I prefer asking before.

ImportError while using Python setup.py install

Hi,

I was trying to install pyecore and I am using python34. I tried to use "python setup.py install" but it throws this error:

python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
from setuptools import setup
ImportError: cannot import name 'setup'

I tried to look around this issue and found this : https://pypi.org/project/ez_setup/

I tried to install ez_setup but issue:

$ pip install ez_setup
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
ImportError: cannot import name 'main'

I even tried "$ pip install pyecore" which throws same:

$ pip install ez_setup
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\pip.exe\__main__.py", line 5, in <module>
ImportError: cannot import name 'main'

Missing timezone in datetime parser

Hi @aranega,

I've found an issue in the datetime parsing when timezone information is included.
When you want to parse an ISO 8601-based date (e.g. from an XMI generated in Eclipse, such as 2014-01-01T00:00:00.000+0100 or 2014-01-01T00:00:00.000Z or 2014-01-01T00:00:00.000+01:00) the parser of pyEcore generates an error, because the supported formats do not contain timezone information, i.e. the UTC offset.

Look at innerutils.py at the end:

def parse_date(str_date):
    try:
        return datetime.fromisoformat(str_date)
    except Exception:
        formats = ('%Y-%m-%dT%H:%M:%S.%f',
                   '%Y-%m-%dT%H:%M:%S.%f',
                   '%Y-%m-%dT%H:%M:%S',
                   '%Y-%m-%dT%H:%M',
                   '%Y-%m-%d %H:%M:%S.%f',
                   '%Y-%m-%d %H:%M:%S.%f',
                   '%Y-%m-%d %H:%M:%S',
                   '%Y-%m-%d %H:%M',
                   '%Y-%m-%d',)
        for format in formats:
            with ignored(ValueError):
                return datetime.strptime(str_date, format)
raise ValueError('Date format is unknown')

The timezone directive is %z, but is missing here. (Keep in mind that this directive is added in python 3). Furthermore the 2nd and 5th of formats is duplicated from the previous format, probably you intended to add the %z here?

How can I create a dynamic model with Epackage?

Hi, could you give an example of how to create a dynamic model with an Epackage?. I don't know how to add EClass to my Epackage.

Many thanks and congratulations to the creator for a great job

Improving error description in BadValueError

If you do a wrong assignment of the specified datatype of an attribute, you get a BadValueError. In most of the errors they are described as follows:

pyecore.valuecontainer.BadValueError: Expected type 
      <pyecore.ecore.EProxy object at 0x05EA6130>, but got type int with value 0 instead

As you can see it only shows the EProxy and not the datatype the EProxy is proxying. My suggestion is to change the following:

class BadValueError(TypeError):
    def __init__(self, got=None, expected=None):
        msg = "Expected type {0}, but got type {1} with value {2} instead"
        msg = msg.format(expected, type(got).__name__, got)
        super().__init__(msg)

in

msg = msg.format(expected.name, type(got).__name__, got)

assuming that expected is always EClass-based (and the name attribute is available). Now you get errors like:

pyecore.valuecontainer.BadValueError: Expected type EDouble, but got type int with value 0 instead

Am I correct?

textX + PyEcore

Note: In this issue, are reported discussions and experiments around the association of textX and PyEcore. Progress can be found here and it currently requires the PyEcore version from the develop branch. (follows discussion from textX/textX#41 and textX/textX#42)

TextX is a meta-language, inspired by Xtext which allows you to easily generate a parser and an metamodel/model-based AST for a textual language. The metamodel based AST created by textX is not yet compatible with the Ecore API. This POC tries to bring PyEcore, so Ecore, to textX in order to be able to handle an Ecore compatible model and metamodel.

This addition could open a way of interoperability between Java-EMF and Python-EMF (PyEcore) through the xmi/ecore file format. Moreover, using pyecoregen, it could enable a full Python T2M (Text to Model), and M2T (Model to Text) experience.

The goal of this POC is to see if PyEcore can be integrated inside textX following three scenarios:

  1. from a textX grammar, an Ecore metamodel is automatically generated, and the generated parser + metamodel can be directly used to build the AST.
  2. using existing dynamic Ecore metamodel (built in memory) and a textX grammar, textX uses the defined dynamic Ecore metamodel to build the AST.
  3. using a first compilation phase: a textX grammar is used for generating the Python Ecore metamodel code (through the textX cli). Then the generated Python code is used by textX to build the AST.

This latter scenario allows the user to easily add behavior to the metaclasses instances.

The scenario 2 had been already validated. This implied minor modifications of how textX create instances and init them (no need to init instances anymore as PyEcore does it), and a biggest modifications on how the cross-references are resolved.

The scenario 1 and 3 relies on the same principle: the Ecore metamodel must be generated on-the-fly from the textX grammar. Consequently, the isses and challenges are not the same as in scenario 2.

Here what's have been validated so far and the future features to add:

  • Replace textX metaclasses creation by EClass instances
  • Add EAttribute/EReference support for EClass
  • Reference eOpposite support for static and dynamic Ecore metamodel (not automatically generated at the moment)
  • Deal with EClass inheritance
  • Deal with abstract classes
  • EPackage creation for a grammar/metamodel
  • Detection of rules that define EDataType
  • Creation of EDataType
  • Detection of rules that define EEnum (currently not bullet-proof)
  • Creation/Filling of EEnum
  • Basic data types support (should be modified)
  • Management of split grammar (defined in many files)
  • Management of multiple namespace/EPackage
  • Detect 'match' and 'non-match' rule call in the same rule definition as semantic errors
  • Better support for multiple grammars relative paths
  • Find a common way of dealing with basic EDataType and textX builtin basic types
  • Deal with split grammar/metamodel generation (generations and imports)
  • Add a cli option to generate the PyEcore metamodel using pyecoregen
  • Add special parameter to pass an existing EPackage as user-classes
  • Add a kind of "switch" for PyEcore activation in textX
  • Add better multiple metamodel generation support (currently, some imports are missing)
  • Add documentation! (obviously)

As a complement of this list, preferably, the PyEcore integration is optional and can be activated using a parameter in textX. Also, another idea would be to add a dedicated keyword to introduce eOpposite from grammar.

The generation of the metamodel Python code using the cli also implies the question of re-generation and perservation of manually inserted modifications. This issue is more general and could be addressed in pyecoregen or pymultigen.

File handling (in unittests?) not working on Windows

I am considering further cleanup suggestions, e.g. marking class methods as such etc. I may also at some point suggest one or another modification to the use of decorators and the meta class.

However, before I start doing any of this I need to have green unit tests. Setting this up showed that the current use of resources and their file paths does not seem to be compatible with Windows (which is my main platform right now).

Therefore I have 26 of the current 175 tests failing, most of them being confused about '' or Windows drive letters.

As you are probably not working on Windows I can offer to generalize. But please let me know if I'm on the right track and that the core of the issue is not something completely different.

customizable resource URI

@aranega
do you think we can add customizable uri for the href in xmi
for example

<element xsi:type="domain:component" href="copy://_H4Ai4JDiEeiB-JBBIoiN_w/HWDemo2/test/level2_function.mdl#__yYxgJDfEeiB-JBBIoiN_w"/>

Here, I used "copy" prefix as a special hint for other purpose and _H4Ai4JDiEeiB-JBBIoiN_w is a UUID for compiler.
the only valid resource uri is "./HWDemo2/test/level2_function.mdl"
The existing EProxy logic in pyecore will mess this totally up and fail to load right resource.
Could you give me some hint on how to make it work with minor modificatoin on the pyecore code. I can add a dynmic patch locally as we are using python.
Thanks!
-Andy

Saved XMI format has issues with non-containment references in Eclipse

Thanks for all the great work. I really appreciate this project. I found two minor issues when working with both, Eclipse and pyecore, which are easy to fix in my opinion:

  1. When storing non-containment references an '@' seems missing before single element references. The stored XMI files cannot be opened in Eclipse EMF, because it always skips the first letter.

Temporary fix:
ecore.py -> eURIFragment() -> line 267:
return '{0}/@{1}'.format(parent.eURIFragment(), name) #BA added '@' for being compatible to Eclipse

  1. When using id attributes as references, it is not checked for malformed id values. E.g. a space in the id attribute’s value creates errors the next time the file is loaded because it looks like multiple references to be loaded (split at the spaces). However, none of the partial ids will exist.

Temporary fix:
resource.py -> _build_path_from() -> line 521:
if id_att_value is not None and ' ' not in id_att_value: #BA prevent ids with spaces from being used

Python-based code generator

While the provided option of using the Acceleo-based generator is terrific, in particular since you can use genmymodel instead of Eclipse, I'd like to see a programmatic (and Python-based) option as well. This would be even more approachable by the Python community and can be greatly integrated into the automatic test-suite, which is not really possible with genmymodel etc., in particular in an offline test scenario.

You already agreed a number of times that this would be a useful feature. Please let me know whether you have this on the agenda already (maybe it's even almost done), or whether this would be a good thing for me to offer as contribution. Obviously this is a bit more work than tuning a few MTL template features and I would mainly doing this in private time, so it'll take a bit. Just want to make sure you generally share my view this is useful and did not do it yet.

If so, we'll use this ticket for discussion about things I might have to ask or get your opinion on. I'd design the generator in an extensible way, so we can ship a built-in one reproducing the current MTL-generated code, but users should be able to hook in their own templates as well to produce whatever they want.

Let me know.

Errors in value check of Boolean type

I got the following error: pyecore.valuecontainer.BadValueError: Expected type EBoolean(bool), but got type str with value true instead for feature <EAttribute abstract: EBoolean(bool)> of <EClass name="EClass"> when I tried to load xmi file and looks like pyecore cannot distinguish between string 'true' and boolean True?

<?xml version="1.0" encoding="ASCII"?>
<railway:RailwayContainer xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:railway="http://www.semanticweb.org/ontologies/2015/trainbenchmark">
  <routes id="3" active="true" requires="//@regions.0/@sensors.0 //@regions.0/@sensors.1 //@regions.0/@sensors.2 //@regions.0/@sensors.3 //@regions.0/@sensors.4 //@regions.0/@sensors.5 //@regions.0/@sensors.6" entry="//@regions.4/@elements.1/@semaphores.0" exit="//@regions.0/@elements.1/@semaphores.0">
    <follows id="48" target="//@regions.0/@elements.0"/>
  </routes>
  <routes id="50" active="true" requires="//@regions.1/@sensors.0 //@regions.1/@sensors.1" entry="//@regions.0/@elements.1/@semaphores.0" exit="//@regions.1/@elements.1/@semaphores.0">
    <follows id="65" position="STRAIGHT" target="//@regions.1/@elements.0"/>
  </routes>
  <routes id="67" active="true" requires="//@regions.2/@sensors.0 //@regions.2/@sensors.1 //@regions.2/@sensors.2 //@regions.2/@sensors.3 //@regions.2/@sensors.4 //@regions.2/@sensors.5 //@regions.2/@sensors.6 //@regions.2/@sensors.7 //@regions.2/@sensors.8 //@regions.2/@sensors.9 //@regions.2/@sensors.10 //@regions.2/@sensors.11 //@regions.2/@sensors.12 //@regions.2/@sensors.13 //@regions.2/@sensors.14 //@regions.2/@sensors.15 //@regions.2/@sensors.16 //@regions.2/@sensors.17 //@regions.2/@sensors.18 //@regions.2/@sensors.19 //@regions.2/@sensors.20 //@regions.2/@sensors.21" entry="//@regions.1/@elements.1/@semaphores.0" exit="//@regions.2/@elements.1/@semaphores.0">
    <follows id="112" target="//@regions.2/@elements.0"/>
    <follows id="132" position="DIVERGING" target="//@regions.2/@elements.36"/>
    <follows id="170" position="DIVERGING" target="//@regions.2/@elements.52"/>
    <follows id="208" position="DIVERGING" target="//@regions.2/@elements.83"/>
  </routes>
  <routes id="210" active="true" requires="//@regions.3/@sensors.0 //@regions.3/@sensors.1 //@regions.3/@sensors.2 //@regions.3/@sensors.3 //@regions.3/@sensors.4 //@regions.3/@sensors.5 //@regions.3/@sensors.6 //@regions.3/@sensors.7 //@regions.3/@sensors.8 //@regions.3/@sensors.9 //@regions.3/@sensors.10 //@regions.3/@sensors.11 //@regions.3/@sensors.12 //@regions.3/@sensors.13 //@regions.3/@sensors.14 //@regions.3/@sensors.15 //@regions.3/@sensors.16 //@regions.3/@sensors.17 //@regions.3/@sensors.18 //@regions.3/@sensors.19 //@regions.3/@sensors.20 //@regions.3/@sensors.21 //@regions.3/@sensors.22 //@regions.3/@sensors.23 //@regions.3/@sensors.24 //@regions.3/@sensors.25 //@regions.3/@sensors.26 //@regions.3/@sensors.27 //@regions.3/@sensors.28 //@regions.3/@sensors.29 //@regions.3/@sensors.30 //@regions.3/@sensors.31 //@regions.3/@sensors.32 //@regions.3/@sensors.33 //@regions.3/@sensors.34 //@regions.3/@sensors.35 //@regions.3/@sensors.36 //@regions.3/@sensors.37 //@regions.3/@sensors.38 //@regions.3/@sensors.39 //@regions.3/@sensors.40 //@regions.3/@sensors.41 //@regions.3/@sensors.42 //@regions.3/@sensors.43 //@regions.3/@sensors.44 //@regions.3/@sensors.45 //@regions.3/@sensors.46 //@regions.3/@sensors.47 //@regions.3/@sensors.48 //@regions.3/@sensors.49 //@regions.3/@sensors.50 //@regions.3/@sensors.51 //@regions.3/@sensors.52 //@regions.3/@sensors.53 //@regions.3/@sensors.54 //@regions.3/@sensors.55 //@regions.3/@sensors.56 //@regions.3/@sensors.57 //@regions.3/@sensors.58 //@regions.3/@sensors.59 //@regions.3/@sensors.60 //@regions.3/@sensors.61 //@regions.3/@sensors.62" entry="//@regions.2/@elements.1/@semaphores.0" exit="//@regions.3/@elements.1/@semaphores.0">
    <follows id="267" position="DIVERGING" target="//@regions.3/@elements.0"/>
    <follows id="281" position="STRAIGHT" target="//@regions.3/@elements.46"/>
    <follows id="301" position="DIVERGING" target="//@regions.3/@elements.57"/>
    <follows id="309" target="//@regions.3/@elements.73"/>
    <follows id="335" target="//@regions.3/@elements.79"/>
    <follows id="355" position="DIVERGING" target="//@regions.3/@elements.100"/>
    <follows id="399" target="//@regions.3/@elements.116"/>
    <follows id="455" position="DIVERGING" target="//@regions.3/@elements.152"/>
    <follows id="505" position="STRAIGHT" target="//@regions.3/@elements.198"/>
    <follows id="531" target="//@regions.3/@elements.239"/>
    <follows id="563" position="STRAIGHT" target="//@regions.3/@elements.260"/>
    <follows id="577" position="STRAIGHT" target="//@regions.3/@elements.286"/>
    <follows id="591" position="STRAIGHT" target="//@regions.3/@elements.297"/>
    <follows id="617" target="//@regions.3/@elements.308"/>
  </routes>
  <routes id="618" active="true" requires="//@regions.4/@sensors.0 //@regions.4/@sensors.1 //@regions.4/@sensors.2 //@regions.4/@sensors.3 //@regions.4/@sensors.4 //@regions.4/@sensors.5 //@regions.4/@sensors.6 //@regions.4/@sensors.7 //@regions.4/@sensors.8 //@regions.4/@sensors.9 //@regions.4/@sensors.10 //@regions.4/@sensors.11 //@regions.4/@sensors.12 //@regions.4/@sensors.13 //@regions.4/@sensors.14 //@regions.4/@sensors.15 //@regions.4/@sensors.16 //@regions.4/@sensors.17" entry="//@regions.3/@elements.1/@semaphores.0" exit="//@regions.4/@elements.1/@semaphores.0">
    <follows id="627" target="//@regions.4/@elements.0"/>
    <follows id="671" target="//@regions.4/@elements.6"/>
    <follows id="691" position="DIVERGING" target="//@regions.4/@elements.42"/>
    <follows id="729" position="DIVERGING" target="//@regions.4/@elements.58"/>
    <follows id="737" target="//@regions.4/@elements.89"/>
  </routes>
  <regions id="4">
    <sensors id="6" monitors="//@regions.0/@elements.0 //@regions.0/@elements.1 //@regions.0/@elements.2 //@regions.0/@elements.3 //@regions.0/@elements.4 //@regions.0/@elements.5"/>
    <sensors id="12" monitors="//@regions.0/@elements.0 //@regions.0/@elements.6 //@regions.0/@elements.7 //@regions.0/@elements.8 //@regions.0/@elements.9 //@regions.0/@elements.10"/>
    <sensors id="18" monitors="//@regions.0/@elements.0 //@regions.0/@elements.11 //@regions.0/@elements.12 //@regions.0/@elements.13 //@regions.0/@elements.14 //@regions.0/@elements.15"/>
    <sensors id="24" monitors="//@regions.0/@elements.0 //@regions.0/@elements.16 //@regions.0/@elements.17 //@regions.0/@elements.18 //@regions.0/@elements.19 //@regions.0/@elements.20"/>
    <sensors id="30" monitors="//@regions.0/@elements.0 //@regions.0/@elements.21 //@regions.0/@elements.22 //@regions.0/@elements.23 //@regions.0/@elements.24 //@regions.0/@elements.25"/>
    <sensors id="36" monitors="//@regions.0/@elements.0 //@regions.0/@elements.26 //@regions.0/@elements.27 //@regions.0/@elements.28 //@regions.0/@elements.29 //@regions.0/@elements.30"/>
    <sensors id="42" monitors="//@regions.0/@elements.0 //@regions.0/@elements.31 //@regions.0/@elements.32 //@regions.0/@elements.33 //@regions.0/@elements.34 //@regions.0/@elements.35"/>
    <elements xsi:type="railway:Switch" id="5" monitoredBy="//@regions.0/@sensors.0 //@regions.0/@sensors.1 //@regions.0/@sensors.2 //@regions.0/@sensors.3 //@regions.0/@sensors.4 //@regions.0/@sensors.5 //@regions.0/@sensors.6" connectsTo="//@regions.0/@elements.1" positions="//@routes.0/@follows.0"/>
    <elements xsi:type="railway:Segment" id="7" monitoredBy="//@regions.0/@sensors.0" connectsTo="//@regions.0/@elements.2" length="504">
      <semaphores id="2" signal="GO"/>
    </elements>
    <elements xsi:type="railway:Segment" id="8" monitoredBy="//@regions.0/@sensors.0" connectsTo="//@regions.0/@elements.3" length="776"/>
    <elements xsi:type="railway:Segment" id="9" monitoredBy="//@regions.0/@sensors.0" connectsTo="//@regions.0/@elements.4" length="60"/>
    <elements xsi:type="railway:Segment" id="10" monitoredBy="//@regions.0/@sensors.0" connectsTo="//@regions.0/@elements.5" length="808"/>
    <elements xsi:type="railway:Segment" id="11" monitoredBy="//@regions.0/@sensors.0" connectsTo="//@regions.0/@elements.6" length="576"/>
    <elements xsi:type="railway:Segment" id="13" monitoredBy="//@regions.0/@sensors.1" connectsTo="//@regions.0/@elements.7" length="358"/>
    <elements xsi:type="railway:Segment" id="14" monitoredBy="//@regions.0/@sensors.1" connectsTo="//@regions.0/@elements.8" length="335"/>
    <elements xsi:type="railway:Segment" id="15" monitoredBy="//@regions.0/@sensors.1" connectsTo="//@regions.0/@elements.9" length="461"/>
    <elements xsi:type="railway:Segment" id="16" monitoredBy="//@regions.0/@sensors.1" connectsTo="//@regions.0/@elements.10" length="439"/>
    <elements xsi:type="railway:Segment" id="17" monitoredBy="//@regions.0/@sensors.1" connectsTo="//@regions.0/@elements.11" length="879"/>
    <elements xsi:type="railway:Segment" id="19" monitoredBy="//@regions.0/@sensors.2" connectsTo="//@regions.0/@elements.12" length="90"/>
    <elements xsi:type="railway:Segment" id="20" monitoredBy="//@regions.0/@sensors.2" connectsTo="//@regions.0/@elements.13" length="829"/>
    <elements xsi:type="railway:Segment" id="21" monitoredBy="//@regions.0/@sensors.2" connectsTo="//@regions.0/@elements.14" length="395"/>
    <elements xsi:type="railway:Segment" id="22" monitoredBy="//@regions.0/@sensors.2" connectsTo="//@regions.0/@elements.15" length="732"/>
    <elements xsi:type="railway:Segment" id="23" monitoredBy="//@regions.0/@sensors.2" connectsTo="//@regions.0/@elements.16" length="134"/>
    <elements xsi:type="railway:Segment" id="25" monitoredBy="//@regions.0/@sensors.3" connectsTo="//@regions.0/@elements.17" length="857"/>
    <elements xsi:type="railway:Segment" id="26" monitoredBy="//@regions.0/@sensors.3" connectsTo="//@regions.0/@elements.18" length="376"/>
    <elements xsi:type="railway:Segment" id="27" monitoredBy="//@regions.0/@sensors.3" connectsTo="//@regions.0/@elements.19" length="803"/>
    <elements xsi:type="railway:Segment" id="28" monitoredBy="//@regions.0/@sensors.3" connectsTo="//@regions.0/@elements.20" length="505"/>
    <elements xsi:type="railway:Segment" id="29" monitoredBy="//@regions.0/@sensors.3" connectsTo="//@regions.0/@elements.21" length="137"/>
    <elements xsi:type="railway:Segment" id="31" monitoredBy="//@regions.0/@sensors.4" connectsTo="//@regions.0/@elements.22" length="294"/>
    <elements xsi:type="railway:Segment" id="32" monitoredBy="//@regions.0/@sensors.4" connectsTo="//@regions.0/@elements.23" length="494"/>
    <elements xsi:type="railway:Segment" id="33" monitoredBy="//@regions.0/@sensors.4" connectsTo="//@regions.0/@elements.24" length="306"/>
    <elements xsi:type="railway:Segment" id="34" monitoredBy="//@regions.0/@sensors.4" connectsTo="//@regions.0/@elements.25" length="979"/>
    <elements xsi:type="railway:Segment" id="35" monitoredBy="//@regions.0/@sensors.4" connectsTo="//@regions.0/@elements.26" length="597"/>
    <elements xsi:type="railway:Segment" id="37" monitoredBy="//@regions.0/@sensors.5" connectsTo="//@regions.0/@elements.27" length="815"/>
    <elements xsi:type="railway:Segment" id="38" monitoredBy="//@regions.0/@sensors.5" connectsTo="//@regions.0/@elements.28" length="396"/>
    <elements xsi:type="railway:Segment" id="39" monitoredBy="//@regions.0/@sensors.5" connectsTo="//@regions.0/@elements.29" length="813"/>
    <elements xsi:type="railway:Segment" id="40" monitoredBy="//@regions.0/@sensors.5" connectsTo="//@regions.0/@elements.30" length="518"/>
    <elements xsi:type="railway:Segment" id="41" monitoredBy="//@regions.0/@sensors.5" connectsTo="//@regions.0/@elements.31" length="831"/>
    <elements xsi:type="railway:Segment" id="43" monitoredBy="//@regions.0/@sensors.6" connectsTo="//@regions.0/@elements.32" length="730"/>
    <elements xsi:type="railway:Segment" id="44" monitoredBy="//@regions.0/@sensors.6" connectsTo="//@regions.0/@elements.33" length="127"/>
    <elements xsi:type="railway:Segment" id="45" monitoredBy="//@regions.0/@sensors.6" connectsTo="//@regions.0/@elements.34" length="968"/>
    <elements xsi:type="railway:Segment" id="46" monitoredBy="//@regions.0/@sensors.6" connectsTo="//@regions.0/@elements.35" length="974"/>
    <elements xsi:type="railway:Segment" id="47" monitoredBy="//@regions.0/@sensors.6" connectsTo="//@regions.1/@elements.0" length="197"/>
  </regions>
  <regions id="51">
    <sensors id="53" monitors="//@regions.1/@elements.0 //@regions.1/@elements.1 //@regions.1/@elements.2 //@regions.1/@elements.3 //@regions.1/@elements.4 //@regions.1/@elements.5"/>
    <sensors id="59" monitors="//@regions.1/@elements.0 //@regions.1/@elements.6 //@regions.1/@elements.7 //@regions.1/@elements.8 //@regions.1/@elements.9 //@regions.1/@elements.10"/>
    <elements xsi:type="railway:Switch" id="52" monitoredBy="//@regions.1/@sensors.0 //@regions.1/@sensors.1" connectsTo="//@regions.1/@elements.1" currentPosition="STRAIGHT" positions="//@routes.1/@follows.0"/>
    <elements xsi:type="railway:Segment" id="54" monitoredBy="//@regions.1/@sensors.0" connectsTo="//@regions.1/@elements.2" length="324">
      <semaphores id="49" signal="GO"/>
    </elements>
    <elements xsi:type="railway:Segment" id="55" monitoredBy="//@regions.1/@sensors.0" connectsTo="//@regions.1/@elements.3" length="324"/>
    <elements xsi:type="railway:Segment" id="56" monitoredBy="//@regions.1/@sensors.0" connectsTo="//@regions.1/@elements.4" length="996"/>
    <elements xsi:type="railway:Segment" id="57" monitoredBy="//@regions.1/@sensors.0" connectsTo="//@regions.1/@elements.5" length="645"/>
    <elements xsi:type="railway:Segment" id="58" monitoredBy="//@regions.1/@sensors.0" connectsTo="//@regions.1/@elements.6" length="455"/>
    <elements xsi:type="railway:Segment" id="60" monitoredBy="//@regions.1/@sensors.1" connectsTo="//@regions.1/@elements.7" length="517"/>
    <elements xsi:type="railway:Segment" id="61" monitoredBy="//@regions.1/@sensors.1" connectsTo="//@regions.1/@elements.8" length="582"/>
    <elements xsi:type="railway:Segment" id="62" monitoredBy="//@regions.1/@sensors.1" connectsTo="//@regions.1/@elements.9" length="641"/>
    <elements xsi:type="railway:Segment" id="63" monitoredBy="//@regions.1/@sensors.1" connectsTo="//@regions.1/@elements.10" length="683"/>
    <elements xsi:type="railway:Segment" id="64" monitoredBy="//@regions.1/@sensors.1" connectsTo="//@regions.2/@elements.0" length="639"/>
  </regions>
  <regions id="68">
    <sensors id="70" monitors="//@regions.2/@elements.0 //@regions.2/@elements.1 //@regions.2/@elements.2 //@regions.2/@elements.3 //@regions.2/@elements.4 //@regions.2/@elements.5"/>
    <sensors id="76" monitors="//@regions.2/@elements.0 //@regions.2/@elements.6 //@regions.2/@elements.7 //@regions.2/@elements.8 //@regions.2/@elements.9 //@regions.2/@elements.10"/>
    <sensors id="82" monitors="//@regions.2/@elements.0 //@regions.2/@elements.11 //@regions.2/@elements.12 //@regions.2/@elements.13 //@regions.2/@elements.14 //@regions.2/@elements.15"/>
    <sensors id="88" monitors="//@regions.2/@elements.0 //@regions.2/@elements.16 //@regions.2/@elements.17 //@regions.2/@elements.18 //@regions.2/@elements.19 //@regions.2/@elements.20"/>
    <sensors id="94" monitors="//@regions.2/@elements.0 //@regions.2/@elements.21 //@regions.2/@elements.22 //@regions.2/@elements.23 //@regions.2/@elements.24 //@regions.2/@elements.25"/>
    <sensors id="100" monitors="//@regions.2/@elements.0 //@regions.2/@elements.26 //@regions.2/@elements.27 //@regions.2/@elements.28 //@regions.2/@elements.29 //@regions.2/@elements.30"/>
    <sensors id="106" monitors="//@regions.2/@elements.0 //@regions.2/@elements.31 //@regions.2/@elements.32 //@regions.2/@elements.33 //@regions.2/@elements.34 //@regions.2/@elements.35"/>
    <sensors id="114" monitors="//@regions.2/@elements.36 //@regions.2/@elements.37 //@regions.2/@elements.38 //@regions.2/@elements.39 //@regions.2/@elements.40 //@regions.2/@elements.41"/>
    <sensors id="120" monitors="//@regions.2/@elements.36 //@regions.2/@elements.42 //@regions.2/@elements.43 //@regions.2/@elements.44 //@regions.2/@elements.45 //@regions.2/@elements.46"/>
    <sensors id="126" monitors="//@regions.2/@elements.36 //@regions.2/@elements.47 //@regions.2/@elements.48 //@regions.2/@elements.49 //@regions.2/@elements.50 //@regions.2/@elements.51"/>
    <sensors id="134" monitors="//@regions.2/@elements.52 //@regions.2/@elements.53 //@regions.2/@elements.54 //@regions.2/@elements.55 //@regions.2/@elements.56 //@regions.2/@elements.57"/>
    <sensors id="140" monitors="//@regions.2/@elements.52 //@regions.2/@elements.58 //@regions.2/@elements.59 //@regions.2/@elements.60 //@regions.2/@elements.61 //@regions.2/@elements.62"/>
    <sensors id="146" monitors="//@regions.2/@elements.52 //@regions.2/@elements.63 //@regions.2/@elements.64 //@regions.2/@elements.65 //@regions.2/@elements.66 //@regions.2/@elements.67"/>
    <sensors id="152" monitors="//@regions.2/@elements.52 //@regions.2/@elements.68 //@regions.2/@elements.69 //@regions.2/@elements.70 //@regions.2/@elements.71 //@regions.2/@elements.72"/>
    <sensors id="158" monitors="//@regions.2/@elements.52 //@regions.2/@elements.73 //@regions.2/@elements.74 //@regions.2/@elements.75 //@regions.2/@elements.76 //@regions.2/@elements.77"/>
    <sensors id="164" monitors="//@regions.2/@elements.52 //@regions.2/@elements.78 //@regions.2/@elements.79 //@regions.2/@elements.80 //@regions.2/@elements.81 //@regions.2/@elements.82"/>
    <sensors id="172" monitors="//@regions.2/@elements.83 //@regions.2/@elements.84 //@regions.2/@elements.85 //@regions.2/@elements.86 //@regions.2/@elements.87 //@regions.2/@elements.88"/>
    <sensors id="178" monitors="//@regions.2/@elements.83 //@regions.2/@elements.89 //@regions.2/@elements.90 //@regions.2/@elements.91 //@regions.2/@elements.92 //@regions.2/@elements.93"/>
    <sensors id="184" monitors="//@regions.2/@elements.83 //@regions.2/@elements.94 //@regions.2/@elements.95 //@regions.2/@elements.96 //@regions.2/@elements.97 //@regions.2/@elements.98"/>
    <sensors id="190" monitors="//@regions.2/@elements.83 //@regions.2/@elements.99 //@regions.2/@elements.100 //@regions.2/@elements.101 //@regions.2/@elements.102 //@regions.2/@elements.103"/>
    <sensors id="196" monitors="//@regions.2/@elements.83 //@regions.2/@elements.104 //@regions.2/@elements.105 //@regions.2/@elements.106 //@regions.2/@elements.107 //@regions.2/@elements.108"/>
    <sensors id="202" monitors="//@regions.2/@elements.83 //@regions.2/@elements.109 //@regions.2/@elements.110 //@regions.2/@elements.111 //@regions.2/@elements.112 //@regions.2/@elements.113"/>
    <elements xsi:type="railway:Switch" id="69" monitoredBy="//@regions.2/@sensors.0 //@regions.2/@sensors.1 //@regions.2/@sensors.2 //@regions.2/@sensors.3 //@regions.2/@sensors.4 //@regions.2/@sensors.5 //@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.1" positions="//@routes.2/@follows.0"/>
    <elements xsi:type="railway:Segment" id="71" monitoredBy="//@regions.2/@sensors.0" connectsTo="//@regions.2/@elements.2" length="212">
      <semaphores id="66" signal="GO"/>
    </elements>
    <elements xsi:type="railway:Segment" id="72" monitoredBy="//@regions.2/@sensors.0" connectsTo="//@regions.2/@elements.3" length="852"/>
    <elements xsi:type="railway:Segment" id="73" monitoredBy="//@regions.2/@sensors.0" connectsTo="//@regions.2/@elements.4" length="994"/>
    <elements xsi:type="railway:Segment" id="74" monitoredBy="//@regions.2/@sensors.0" connectsTo="//@regions.2/@elements.5" length="931"/>
    <elements xsi:type="railway:Segment" id="75" monitoredBy="//@regions.2/@sensors.0" connectsTo="//@regions.2/@elements.6" length="472"/>
    <elements xsi:type="railway:Segment" id="77" monitoredBy="//@regions.2/@sensors.1" connectsTo="//@regions.2/@elements.7" length="367"/>
    <elements xsi:type="railway:Segment" id="78" monitoredBy="//@regions.2/@sensors.1" connectsTo="//@regions.2/@elements.8" length="679"/>
    <elements xsi:type="railway:Segment" id="79" monitoredBy="//@regions.2/@sensors.1" connectsTo="//@regions.2/@elements.9" length="180"/>
    <elements xsi:type="railway:Segment" id="80" monitoredBy="//@regions.2/@sensors.1" connectsTo="//@regions.2/@elements.10" length="745"/>
    <elements xsi:type="railway:Segment" id="81" monitoredBy="//@regions.2/@sensors.1" connectsTo="//@regions.2/@elements.11" length="629"/>
    <elements xsi:type="railway:Segment" id="83" monitoredBy="//@regions.2/@sensors.2" connectsTo="//@regions.2/@elements.12" length="711"/>
    <elements xsi:type="railway:Segment" id="84" monitoredBy="//@regions.2/@sensors.2" connectsTo="//@regions.2/@elements.13" length="633"/>
    <elements xsi:type="railway:Segment" id="85" monitoredBy="//@regions.2/@sensors.2" connectsTo="//@regions.2/@elements.14" length="733"/>
    <elements xsi:type="railway:Segment" id="86" monitoredBy="//@regions.2/@sensors.2" connectsTo="//@regions.2/@elements.15" length="542"/>
    <elements xsi:type="railway:Segment" id="87" monitoredBy="//@regions.2/@sensors.2" connectsTo="//@regions.2/@elements.16" length="449"/>
    <elements xsi:type="railway:Segment" id="89" monitoredBy="//@regions.2/@sensors.3" connectsTo="//@regions.2/@elements.17" length="655"/>
    <elements xsi:type="railway:Segment" id="90" monitoredBy="//@regions.2/@sensors.3" connectsTo="//@regions.2/@elements.18" length="549"/>
    <elements xsi:type="railway:Segment" id="91" monitoredBy="//@regions.2/@sensors.3" connectsTo="//@regions.2/@elements.19" length="988"/>
    <elements xsi:type="railway:Segment" id="92" monitoredBy="//@regions.2/@sensors.3" connectsTo="//@regions.2/@elements.20" length="567"/>
    <elements xsi:type="railway:Segment" id="93" monitoredBy="//@regions.2/@sensors.3" connectsTo="//@regions.2/@elements.21" length="483"/>
    <elements xsi:type="railway:Segment" id="95" monitoredBy="//@regions.2/@sensors.4" connectsTo="//@regions.2/@elements.22" length="234"/>
    <elements xsi:type="railway:Segment" id="96" monitoredBy="//@regions.2/@sensors.4" connectsTo="//@regions.2/@elements.23" length="636"/>
    <elements xsi:type="railway:Segment" id="97" monitoredBy="//@regions.2/@sensors.4" connectsTo="//@regions.2/@elements.24" length="132"/>
    <elements xsi:type="railway:Segment" id="98" monitoredBy="//@regions.2/@sensors.4" connectsTo="//@regions.2/@elements.25" length="849"/>
    <elements xsi:type="railway:Segment" id="99" monitoredBy="//@regions.2/@sensors.4" connectsTo="//@regions.2/@elements.26" length="421"/>
    <elements xsi:type="railway:Segment" id="101" monitoredBy="//@regions.2/@sensors.5" connectsTo="//@regions.2/@elements.27" length="345"/>
    <elements xsi:type="railway:Segment" id="102" monitoredBy="//@regions.2/@sensors.5" connectsTo="//@regions.2/@elements.28" length="429"/>
    <elements xsi:type="railway:Segment" id="103" monitoredBy="//@regions.2/@sensors.5" connectsTo="//@regions.2/@elements.29" length="771"/>
    <elements xsi:type="railway:Segment" id="104" monitoredBy="//@regions.2/@sensors.5" connectsTo="//@regions.2/@elements.30" length="892"/>
    <elements xsi:type="railway:Segment" id="105" monitoredBy="//@regions.2/@sensors.5" connectsTo="//@regions.2/@elements.31" length="387"/>
    <elements xsi:type="railway:Segment" id="107" monitoredBy="//@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.32" length="149"/>
    <elements xsi:type="railway:Segment" id="108" monitoredBy="//@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.33" length="313"/>
    <elements xsi:type="railway:Segment" id="109" monitoredBy="//@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.34" length="209"/>
    <elements xsi:type="railway:Segment" id="110" monitoredBy="//@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.35" length="814"/>
    <elements xsi:type="railway:Segment" id="111" monitoredBy="//@regions.2/@sensors.6" connectsTo="//@regions.2/@elements.36" length="721"/>
    <elements xsi:type="railway:Switch" id="113" monitoredBy="//@regions.2/@sensors.7 //@regions.2/@sensors.8 //@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.37" currentPosition="DIVERGING" positions="//@routes.2/@follows.1"/>
    <elements xsi:type="railway:Segment" id="115" monitoredBy="//@regions.2/@sensors.7" connectsTo="//@regions.2/@elements.38" length="26"/>
    <elements xsi:type="railway:Segment" id="116" monitoredBy="//@regions.2/@sensors.7" connectsTo="//@regions.2/@elements.39" length="436"/>
    <elements xsi:type="railway:Segment" id="117" monitoredBy="//@regions.2/@sensors.7" connectsTo="//@regions.2/@elements.40" length="99"/>
    <elements xsi:type="railway:Segment" id="118" monitoredBy="//@regions.2/@sensors.7" connectsTo="//@regions.2/@elements.41" length="818"/>
    <elements xsi:type="railway:Segment" id="119" monitoredBy="//@regions.2/@sensors.7" connectsTo="//@regions.2/@elements.42" length="853"/>
    <elements xsi:type="railway:Segment" id="121" monitoredBy="//@regions.2/@sensors.8" connectsTo="//@regions.2/@elements.43" length="153"/>
    <elements xsi:type="railway:Segment" id="122" monitoredBy="//@regions.2/@sensors.8" connectsTo="//@regions.2/@elements.44" length="560"/>
    <elements xsi:type="railway:Segment" id="123" monitoredBy="//@regions.2/@sensors.8" connectsTo="//@regions.2/@elements.45" length="872"/>
    <elements xsi:type="railway:Segment" id="124" monitoredBy="//@regions.2/@sensors.8" connectsTo="//@regions.2/@elements.46" length="190"/>
    <elements xsi:type="railway:Segment" id="125" monitoredBy="//@regions.2/@sensors.8" connectsTo="//@regions.2/@elements.47" length="340"/>
    <elements xsi:type="railway:Segment" id="127" monitoredBy="//@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.48" length="764"/>
    <elements xsi:type="railway:Segment" id="128" monitoredBy="//@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.49" length="35"/>
    <elements xsi:type="railway:Segment" id="129" monitoredBy="//@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.50" length="872"/>
    <elements xsi:type="railway:Segment" id="130" monitoredBy="//@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.51" length="193"/>
    <elements xsi:type="railway:Segment" id="131" monitoredBy="//@regions.2/@sensors.9" connectsTo="//@regions.2/@elements.52" length="515"/>
    <elements xsi:type="railway:Switch" id="133" monitoredBy="//@regions.2/@sensors.10 //@regions.2/@sensors.11 //@regions.2/@sensors.12 //@regions.2/@sensors.13 //@regions.2/@sensors.14 //@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.53" currentPosition="DIVERGING" positions="//@routes.2/@follows.2"/>
    <elements xsi:type="railway:Segment" id="135" monitoredBy="//@regions.2/@sensors.10" connectsTo="//@regions.2/@elements.54" length="141"/>
    <elements xsi:type="railway:Segment" id="136" monitoredBy="//@regions.2/@sensors.10" connectsTo="//@regions.2/@elements.55" length="11"/>
    <elements xsi:type="railway:Segment" id="137" monitoredBy="//@regions.2/@sensors.10" connectsTo="//@regions.2/@elements.56" length="288"/>
    <elements xsi:type="railway:Segment" id="138" monitoredBy="//@regions.2/@sensors.10" connectsTo="//@regions.2/@elements.57" length="994"/>
    <elements xsi:type="railway:Segment" id="139" monitoredBy="//@regions.2/@sensors.10" connectsTo="//@regions.2/@elements.58" length="852"/>
    <elements xsi:type="railway:Segment" id="141" monitoredBy="//@regions.2/@sensors.11" connectsTo="//@regions.2/@elements.59" length="715"/>
    <elements xsi:type="railway:Segment" id="142" monitoredBy="//@regions.2/@sensors.11" connectsTo="//@regions.2/@elements.60" length="933"/>
    <elements xsi:type="railway:Segment" id="143" monitoredBy="//@regions.2/@sensors.11" connectsTo="//@regions.2/@elements.61" length="232"/>
    <elements xsi:type="railway:Segment" id="144" monitoredBy="//@regions.2/@sensors.11" connectsTo="//@regions.2/@elements.62" length="692"/>
    <elements xsi:type="railway:Segment" id="145" monitoredBy="//@regions.2/@sensors.11" connectsTo="//@regions.2/@elements.63" length="901"/>
    <elements xsi:type="railway:Segment" id="147" monitoredBy="//@regions.2/@sensors.12" connectsTo="//@regions.2/@elements.64" length="590"/>
    <elements xsi:type="railway:Segment" id="148" monitoredBy="//@regions.2/@sensors.12" connectsTo="//@regions.2/@elements.65" length="530"/>
    <elements xsi:type="railway:Segment" id="149" monitoredBy="//@regions.2/@sensors.12" connectsTo="//@regions.2/@elements.66" length="896"/>
    <elements xsi:type="railway:Segment" id="150" monitoredBy="//@regions.2/@sensors.12" connectsTo="//@regions.2/@elements.67" length="494"/>
    <elements xsi:type="railway:Segment" id="151" monitoredBy="//@regions.2/@sensors.12" connectsTo="//@regions.2/@elements.68" length="325"/>
    <elements xsi:type="railway:Segment" id="153" monitoredBy="//@regions.2/@sensors.13" connectsTo="//@regions.2/@elements.69" length="273"/>
    <elements xsi:type="railway:Segment" id="154" monitoredBy="//@regions.2/@sensors.13" connectsTo="//@regions.2/@elements.70" length="800"/>
    <elements xsi:type="railway:Segment" id="155" monitoredBy="//@regions.2/@sensors.13" connectsTo="//@regions.2/@elements.71" length="137"/>
    <elements xsi:type="railway:Segment" id="156" monitoredBy="//@regions.2/@sensors.13" connectsTo="//@regions.2/@elements.72" length="813"/>
    <elements xsi:type="railway:Segment" id="157" monitoredBy="//@regions.2/@sensors.13" connectsTo="//@regions.2/@elements.73" length="137"/>
    <elements xsi:type="railway:Segment" id="159" monitoredBy="//@regions.2/@sensors.14" connectsTo="//@regions.2/@elements.74" length="975"/>
    <elements xsi:type="railway:Segment" id="160" monitoredBy="//@regions.2/@sensors.14" connectsTo="//@regions.2/@elements.75" length="53"/>
    <elements xsi:type="railway:Segment" id="161" monitoredBy="//@regions.2/@sensors.14" connectsTo="//@regions.2/@elements.76" length="386"/>
    <elements xsi:type="railway:Segment" id="162" monitoredBy="//@regions.2/@sensors.14" connectsTo="//@regions.2/@elements.77" length="633"/>
    <elements xsi:type="railway:Segment" id="163" monitoredBy="//@regions.2/@sensors.14" connectsTo="//@regions.2/@elements.78" length="220"/>
    <elements xsi:type="railway:Segment" id="165" monitoredBy="//@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.79" length="697"/>
    <elements xsi:type="railway:Segment" id="166" monitoredBy="//@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.80" length="929"/>
    <elements xsi:type="railway:Segment" id="167" monitoredBy="//@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.81" length="586"/>
    <elements xsi:type="railway:Segment" id="168" monitoredBy="//@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.82" length="152"/>
    <elements xsi:type="railway:Segment" id="169" monitoredBy="//@regions.2/@sensors.15" connectsTo="//@regions.2/@elements.83" length="45"/>
    <elements xsi:type="railway:Switch" id="171" monitoredBy="//@regions.2/@sensors.16 //@regions.2/@sensors.17 //@regions.2/@sensors.18 //@regions.2/@sensors.19 //@regions.2/@sensors.20 //@regions.2/@sensors.21" connectsTo="//@regions.2/@elements.84" currentPosition="DIVERGING" positions="//@routes.2/@follows.3"/>
    <elements xsi:type="railway:Segment" id="173" monitoredBy="//@regions.2/@sensors.16" connectsTo="//@regions.2/@elements.85" length="886"/>
    <elements xsi:type="railway:Segment" id="174" monitoredBy="//@regions.2/@sensors.16" connectsTo="//@regions.2/@elements.86" length="85"/>
    <elements xsi:type="railway:Segment" id="175" monitoredBy="//@regions.2/@sensors.16" connectsTo="//@regions.2/@elements.87" length="23"/>
    <elements xsi:type="railway:Segment" id="176" monitoredBy="//@regions.2/@sensors.16" connectsTo="//@regions.2/@elements.88" length="246"/>
    <elements xsi:type="railway:Segment" id="177" monitoredBy="//@regions.2/@sensors.16" connectsTo="//@regions.2/@elements.89" length="245"/>
    <elements xsi:type="railway:Segment" id="179" monitoredBy="//@regions.2/@sensors.17" connectsTo="//@regions.2/@elements.90" length="246"/>
    <elements xsi:type="railway:Segment" id="180" monitoredBy="//@regions.2/@sensors.17" connectsTo="//@regions.2/@elements.91" length="239"/>
    <elements xsi:type="railway:Segment" id="181" monitoredBy="//@regions.2/@sensors.17" connectsTo="//@regions.2/@elements.92" length="437"/>
    <elements xsi:type="railway:Segment" id="182" monitoredBy="//@regions.2/@sensors.17" connectsTo="//@regions.2/@elements.93" length="544"/>
    <elements xsi:type="railway:Segment" id="183" monitoredBy="//@regions.2/@sensors.17" connectsTo="//@regions.2/@elements.94" length="375"/>
    <elements xsi:type="railway:Segment" id="185" monitoredBy="//@regions.2/@sensors.18" connectsTo="//@regions.2/@elements.95" length="398"/>
    <elements xsi:type="railway:Segment" id="186" monitoredBy="//@regions.2/@sensors.18" connectsTo="//@regions.2/@elements.96" length="942"/>
    <elements xsi:type="railway:Segment" id="187" monitoredBy="//@regions.2/@sensors.18" connectsTo="//@regions.2/@elements.97" length="191"/>
    <elements xsi:type="railway:Segment" id="188" monitoredBy="//@regions.2/@sensors.18" connectsTo="//@regions.2/@elements.98" length="18"/>
    <elements xsi:type="railway:Segment" id="189" monitoredBy="//@regions.2/@sensors.18" connectsTo="//@regions.2/@elements.99" length="1000"/>
    <elements xsi:type="railway:Segment" id="191" monitoredBy="//@regions.2/@sensors.19" connectsTo="//@regions.2/@elements.100" length="488"/>
    <elements xsi:type="railway:Segment" id="192" monitoredBy="//@regions.2/@sensors.19" connectsTo="//@regions.2/@elements.101" length="301"/>
    <elements xsi:type="railway:Segment" id="193" monitoredBy="//@regions.2/@sensors.19" connectsTo="//@regions.2/@elements.102" length="559"/>
    <elements xsi:type="railway:Segment" id="194" monitoredBy="//@regions.2/@sensors.19" connectsTo="//@regions.2/@elements.103" length="437"/>
    <elements xsi:type="railway:Segment" id="195" monitoredBy="//@regions.2/@sensors.19" connectsTo="//@regions.2/@elements.104" length="997"/>
    <elements xsi:type="railway:Segment" id="197" monitoredBy="//@regions.2/@sensors.20" connectsTo="//@regions.2/@elements.105" length="511"/>
    <elements xsi:type="railway:Segment" id="198" monitoredBy="//@regions.2/@sensors.20" connectsTo="//@regions.2/@elements.106" length="494"/>
    <elements xsi:type="railway:Segment" id="199" monitoredBy="//@regions.2/@sensors.20" connectsTo="//@regions.2/@elements.107" length="625"/>
    <elements xsi:type="railway:Segment" id="200" monitoredBy="//@regions.2/@sensors.20" connectsTo="//@regions.2/@elements.108" length="23"/>
    <elements xsi:type="railway:Segment" id="201" monitoredBy="//@regions.2/@sensors.20" connectsTo="//@regions.2/@elements.109" length="111"/>
    <elements xsi:type="railway:Segment" id="203" monitoredBy="//@regions.2/@sensors.21" connectsTo="//@regions.2/@elements.110" length="578"/>
    <elements xsi:type="railway:Segment" id="204" monitoredBy="//@regions.2/@sensors.21" connectsTo="//@regions.2/@elements.111" length="757"/>
    <elements xsi:type="railway:Segment" id="205" monitoredBy="//@regions.2/@sensors.21" connectsTo="//@regions.2/@elements.112" length="893"/>
    <elements xsi:type="railway:Segment" id="206" monitoredBy="//@regions.2/@sensors.21" connectsTo="//@regions.2/@elements.113" length="711"/>
    <elements xsi:type="railway:Segment" id="207" monitoredBy="//@regions.2/@sensors.21" connectsTo="//@regions.3/@elements.0" length="227"/>
  </regions>
  <regions id="211">
    <sensors id="213" monitors="//@regions.3/@elements.0 //@regions.3/@elements.1 //@regions.3/@elements.2 //@regions.3/@elements.3 //@regions.3/@elements.4 //@regions.3/@elements.5"/>
    <sensors id="219" monitors="//@regions.3/@elements.0 //@regions.3/@elements.6 //@regions.3/@elements.7 //@regions.3/@elements.8 //@regions.3/@elements.9 //@regions.3/@elements.10"/>
    <sensors id="225" monitors="//@regions.3/@elements.0 //@regions.3/@elements.11 //@regions.3/@elements.12 //@regions.3/@elements.13 //@regions.3/@elements.14 //@regions.3/@elements.15"/>
    <sensors id="231" monitors="//@regions.3/@elements.0 //@regions.3/@elements.16 //@regions.3/@elements.17 //@regions.3/@elements.18 //@regions.3/@elements.19 //@regions.3/@elements.20"/>
    <sensors id="237" monitors="//@regions.3/@elements.0 //@regions.3/@elements.21 //@regions.3/@elements.22 //@regions.3/@elements.23 //@regions.3/@elements.24 //@regions.3/@elements.25"/>
    <sensors id="243" monitors="//@regions.3/@elements.0 //@regions.3/@elements.26 //@regions.3/@elements.27 //@regions.3/@elements.28 //@regions.3/@elements.29 //@regions.3/@elements.30"/>
    <sensors id="249" monitors="//@regions.3/@elements.0 //@regions.3/@elements.31 //@regions.3/@elements.32 //@regions.3/@elements.33 //@regions.3/@elements.34 //@regions.3/@elements.35"/>
    <sensors id="255" monitors="//@regions.3/@elements.0 //@regions.3/@elements.36 //@regions.3/@elements.37 //@regions.3/@elements.38 //@regions.3/@elements.39 //@regions.3/@elements.40"/>
    <sensors id="261" monitors="//@regions.3/@elements.0 //@regions.3/@elements.41 //@regions.3/@elements.42 //@regions.3/@elements.43 //@regions.3/@elements.44 //@regions.3/@elements.45"/>
    <sensors id="269" monitors="//@regions.3/@elements.46 //@regions.3/@elements.47 //@regions.3/@elements.48 //@regions.3/@elements.49 //@regions.3/@elements.50 //@regions.3/@elements.51"/>
    <sensors id="275" monitors="//@regions.3/@elements.46 //@regions.3/@elements.52 //@regions.3/@elements.53 //@regions.3/@elements.54 //@regions.3/@elements.55 //@regions.3/@elements.56"/>
    <sensors id="283" monitors="//@regions.3/@elements.57 //@regions.3/@elements.58 //@regions.3/@elements.59 //@regions.3/@elements.60 //@regions.3/@elements.61 //@regions.3/@elements.62"/>
    <sensors id="289" monitors="//@regions.3/@elements.57 //@regions.3/@elements.63 //@regions.3/@elements.64 //@regions.3/@elements.65 //@regions.3/@elements.66 //@regions.3/@elements.67"/>
    <sensors id="295" monitors="//@regions.3/@elements.57 //@regions.3/@elements.68 //@regions.3/@elements.69 //@regions.3/@elements.70 //@regions.3/@elements.71 //@regions.3/@elements.72"/>
    <sensors id="303" monitors="//@regions.3/@elements.73 //@regions.3/@elements.74 //@regions.3/@elements.75 //@regions.3/@elements.76 //@regions.3/@elements.77 //@regions.3/@elements.78"/>
    <sensors id="311" monitors="//@regions.3/@elements.79 //@regions.3/@elements.80 //@regions.3/@elements.81 //@regions.3/@elements.82 //@regions.3/@elements.83 //@regions.3/@elements.84"/>
    <sensors id="317" monitors="//@regions.3/@elements.79 //@regions.3/@elements.85 //@regions.3/@elements.86 //@regions.3/@elements.87 //@regions.3/@elements.88 //@regions.3/@elements.89"/>
    <sensors id="323" monitors="//@regions.3/@elements.79 //@regions.3/@elements.90 //@regions.3/@elements.91 //@regions.3/@elements.92 //@regions.3/@elements.93 //@regions.3/@elements.94"/>
    <sensors id="329" monitors="//@regions.3/@elements.79 //@regions.3/@elements.95 //@regions.3/@elements.96 //@regions.3/@elements.97 //@regions.3/@elements.98 //@regions.3/@elements.99"/>
    <sensors id="337" monitors="//@regions.3/@elements.100 //@regions.3/@elements.101 //@regions.3/@elements.102 //@regions.3/@elements.103 //@regions.3/@elements.104 //@regions.3/@elements.105"/>
    <sensors id="343" monitors="//@regions.3/@elements.100 //@regions.3/@elements.106 //@regions.3/@elements.107 //@regions.3/@elements.108 //@regions.3/@elements.109 //@regions.3/@elements.110"/>
    <sensors id="349" monitors="//@regions.3/@elements.100 //@regions.3/@elements.111 //@regions.3/@elements.112 //@regions.3/@elements.113 //@regions.3/@elements.114 //@regions.3/@elements.115"/>
    <sensors id="357" monitors="//@regions.3/@elements.116 //@regions.3/@elements.117 //@regions.3/@elements.118 //@regions.3/@elements.119 //@regions.3/@elements.120 //@regions.3/@elements.121"/>
    <sensors id="363" monitors="//@regions.3/@elements.116 //@regions.3/@elements.122 //@regions.3/@elements.123 //@regions.3/@elements.124 //@regions.3/@elements.125 //@regions.3/@elements.126"/>
    <sensors id="369" monitors="//@regions.3/@elements.116 //@regions.3/@elements.127 //@regions.3/@elements.128 //@regions.3/@elements.129 //@regions.3/@elements.130 //@regions.3/@elements.131"/>
    <sensors id="375" monitors="//@regions.3/@elements.116 //@regions.3/@elements.132 //@regions.3/@elements.133 //@regions.3/@elements.134 //@regions.3/@elements.135 //@regions.3/@elements.136"/>
    <sensors id="381" monitors="//@regions.3/@elements.116 //@regions.3/@elements.137 //@regions.3/@elements.138 //@regions.3/@elements.139 //@regions.3/@elements.140 //@regions.3/@elements.141"/>
    <sensors id="387" monitors="//@regions.3/@elements.116 //@regions.3/@elements.142 //@regions.3/@elements.143 //@regions.3/@elements.144 //@regions.3/@elements.145 //@regions.3/@elements.146"/>
    <sensors id="393" monitors="//@regions.3/@elements.116 //@regions.3/@elements.147 //@regions.3/@elements.148 //@regions.3/@elements.149 //@regions.3/@elements.150 //@regions.3/@elements.151"/>
    <sensors id="401" monitors="//@regions.3/@elements.152 //@regions.3/@elements.153 //@regions.3/@elements.154 //@regions.3/@elements.155 //@regions.3/@elements.156 //@regions.3/@elements.157"/>
    <sensors id="407" monitors="//@regions.3/@elements.152 //@regions.3/@elements.158 //@regions.3/@elements.159 //@regions.3/@elements.160 //@regions.3/@elements.161 //@regions.3/@elements.162"/>
    <sensors id="413" monitors="//@regions.3/@elements.152 //@regions.3/@elements.163 //@regions.3/@elements.164 //@regions.3/@elements.165 //@regions.3/@elements.166 //@regions.3/@elements.167"/>
    <sensors id="419" monitors="//@regions.3/@elements.152 //@regions.3/@elements.168 //@regions.3/@elements.169 //@regions.3/@elements.170 //@regions.3/@elements.171 //@regions.3/@elements.172"/>
    <sensors id="425" monitors="//@regions.3/@elements.152 //@regions.3/@elements.173 //@regions.3/@elements.174 //@regions.3/@elements.175 //@regions.3/@elements.176 //@regions.3/@elements.177"/>
    <sensors id="431" monitors="//@regions.3/@elements.152 //@regions.3/@elements.178 //@regions.3/@elements.179 //@regions.3/@elements.180 //@regions.3/@elements.181 //@regions.3/@elements.182"/>
    <sensors id="437" monitors="//@regions.3/@elements.152 //@regions.3/@elements.183 //@regions.3/@elements.184 //@regions.3/@elements.185 //@regions.3/@elements.186 //@regions.3/@elements.187"/>
    <sensors id="443" monitors="//@regions.3/@elements.152 //@regions.3/@elements.188 //@regions.3/@elements.189 //@regions.3/@elements.190 //@regions.3/@elements.191 //@regions.3/@elements.192"/>
    <sensors id="449" monitors="//@regions.3/@elements.152 //@regions.3/@elements.193 //@regions.3/@elements.194 //@regions.3/@elements.195 //@regions.3/@elements.196 //@regions.3/@elements.197"/>
    <sensors id="457" monitors="//@regions.3/@elements.198 //@regions.3/@elements.199 //@regions.3/@elements.200 //@regions.3/@elements.201 //@regions.3/@elements.202 //@regions.3/@elements.203"/>
    <sensors id="463" monitors="//@regions.3/@elements.198 //@regions.3/@elements.204 //@regions.3/@elements.205 //@regions.3/@elements.206 //@regions.3/@elements.207 //@regions.3/@elements.208"/>
    <sensors id="469" monitors="//@regions.3/@elements.198 //@regions.3/@elements.209 //@regions.3/@elements.210 //@regions.3/@elements.211 //@regions.3/@elements.212 //@regions.3/@elements.213"/>
    <sensors id="475" monitors="//@regions.3/@elements.198 //@regions.3/@elements.214 //@regions.3/@elements.215 //@regions.3/@elements.216 //@regions.3/@elements.217 //@regions.3/@elements.218"/>
    <sensors id="481" monitors="//@regions.3/@elements.198 //@regions.3/@elements.219 //@regions.3/@elements.220 //@regions.3/@elements.221 //@regions.3/@elements.222 //@regions.3/@elements.223"/>
    <sensors id="487" monitors="//@regions.3/@elements.198 //@regions.3/@elements.224 //@regions.3/@elements.225 //@regions.3/@elements.226 //@regions.3/@elements.227 //@regions.3/@elements.228"/>
    <sensors id="493" monitors="//@regions.3/@elements.198 //@regions.3/@elements.229 //@regions.3/@elements.230 //@regions.3/@elements.231 //@regions.3/@elements.232 //@regions.3/@elements.233"/>
    <sensors id="499" monitors="//@regions.3/@elements.198 //@regions.3/@elements.234 //@regions.3/@elements.235 //@regions.3/@elements.236 //@regions.3/@elements.237 //@regions.3/@elements.238"/>
    <sensors id="507" monitors="//@regions.3/@elements.239 //@regions.3/@elements.240 //@regions.3/@elements.241 //@regions.3/@elements.242 //@regions.3/@elements.243 //@regions.3/@elements.244"/>
    <sensors id="513" monitors="//@regions.3/@elements.239 //@regions.3/@elements.245 //@regions.3/@elements.246 //@regions.3/@elements.247 //@regions.3/@elements.248 //@regions.3/@elements.249"/>
    <sensors id="519" monitors="//@regions.3/@elements.239 //@regions.3/@elements.250 //@regions.3/@elements.251 //@regions.3/@elements.252 //@regions.3/@elements.253 //@regions.3/@elements.254"/>
    <sensors id="525" monitors="//@regions.3/@elements.239 //@regions.3/@elements.255 //@regions.3/@elements.256 //@regions.3/@elements.257 //@regions.3/@elements.258 //@regions.3/@elements.259"/>
    <sensors id="533" monitors="//@regions.3/@elements.260 //@regions.3/@elements.261 //@regions.3/@elements.262 //@regions.3/@elements.263 //@regions.3/@elements.264 //@regions.3/@elements.265"/>
    <sensors id="539" monitors="//@regions.3/@elements.260 //@regions.3/@elements.266 //@regions.3/@elements.267 //@regions.3/@elements.268 //@regions.3/@elements.269 //@regions.3/@elements.270"/>
    <sensors id="545" monitors="//@regions.3/@elements.260 //@regions.3/@elements.271 //@regions.3/@elements.272 //@regions.3/@elements.273 //@regions.3/@elements.274 //@regions.3/@elements.275"/>
    <sensors id="551" monitors="//@regions.3/@elements.260 //@regions.3/@elements.276 //@regions.3/@elements.277 //@regions.3/@elements.278 //@regions.3/@elements.279 //@regions.3/@elements.280"/>
    <sensors id="557" monitors="//@regions.3/@elements.260 //@regions.3/@elements.281 //@regions.3/@elements.282 //@regions.3/@elements.283 //@regions.3/@elements.284 //@regions.3/@elements.285"/>
    <sensors id="565" monitors="//@regions.3/@elements.286 //@regions.3/@elements.287 //@regions.3/@elements.288 //@regions.3/@elements.289 //@regions.3/@elements.290 //@regions.3/@elements.291"/>
    <sensors id="571" monitors="//@regions.3/@elements.286 //@regions.3/@elements.292 //@regions.3/@elements.293 //@regions.3/@elements.294 //@regions.3/@elements.295 //@regions.3/@elements.296"/>
    <sensors id="579" monitors="//@regions.3/@elements.297 //@regions.3/@elements.298 //@regions.3/@elements.299 //@regions.3/@elements.300 //@regions.3/@elements.301 //@regions.3/@elements.302"/>
    <sensors id="585" monitors="//@regions.3/@elements.297 //@regions.3/@elements.303 //@regions.3/@elements.304 //@regions.3/@elements.305 //@regions.3/@elements.306 //@regions.3/@elements.307"/>
    <sensors id="593" monitors="//@regions.3/@elements.308 //@regions.3/@elements.309 //@regions.3/@elements.310 //@regions.3/@elements.311 //@regions.3/@elements.312 //@regions.3/@elements.313"/>
    <sensors id="599" monitors="//@regions.3/@elements.308 //@regions.3/@elements.314 //@regions.3/@elements.315 //@regions.3/@elements.316 //@regions.3/@elements.317 //@regions.3/@elements.318"/>
    <sensors id="605" monitors="//@regions.3/@elements.308 //@regions.3/@elements.319 //@regions.3/@elements.320 //@regions.3/@elements.321 //@regions.3/@elements.322 //@regions.3/@elements.323"/>
    <sensors id="611" monitors="//@regions.3/@elements.308 //@regions.3/@elements.324 //@regions.3/@elements.325 //@regions.3/@elements.326 //@regions.3/@elements.327 //@regions.3/@elements.328"/>
    <elements xsi:type="railway:Switch" id="212" monitoredBy="//@regions.3/@sensors.0 //@regions.3/@sensors.1 //@regions.3/@sensors.2 //@regions.3/@sensors.3 //@regions.3/@sensors.4 //@regions.3/@sensors.5 //@regions.3/@sensors.6 //@regions.3/@sensors.7 //@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.1" currentPosition="DIVERGING" positions="//@routes.3/@follows.0"/>
    <elements xsi:type="railway:Segment" id="214" monitoredBy="//@regions.3/@sensors.0" connectsTo="//@regions.3/@elements.2" length="740">
      <semaphores id="209" signal="GO"/>
    </elements>
    <elements xsi:type="railway:Segment" id="215" monitoredBy="//@regions.3/@sensors.0" connectsTo="//@regions.3/@elements.3" length="145"/>
    <elements xsi:type="railway:Segment" id="216" monitoredBy="//@regions.3/@sensors.0" connectsTo="//@regions.3/@elements.4" length="242"/>
    <elements xsi:type="railway:Segment" id="217" monitoredBy="//@regions.3/@sensors.0" connectsTo="//@regions.3/@elements.5" length="789"/>
    <elements xsi:type="railway:Segment" id="218" monitoredBy="//@regions.3/@sensors.0" connectsTo="//@regions.3/@elements.6" length="840"/>
    <elements xsi:type="railway:Segment" id="220" monitoredBy="//@regions.3/@sensors.1" connectsTo="//@regions.3/@elements.7" length="456"/>
    <elements xsi:type="railway:Segment" id="221" monitoredBy="//@regions.3/@sensors.1" connectsTo="//@regions.3/@elements.8" length="284"/>
    <elements xsi:type="railway:Segment" id="222" monitoredBy="//@regions.3/@sensors.1" connectsTo="//@regions.3/@elements.9" length="434"/>
    <elements xsi:type="railway:Segment" id="223" monitoredBy="//@regions.3/@sensors.1" connectsTo="//@regions.3/@elements.10" length="546"/>
    <elements xsi:type="railway:Segment" id="224" monitoredBy="//@regions.3/@sensors.1" connectsTo="//@regions.3/@elements.11" length="613"/>
    <elements xsi:type="railway:Segment" id="226" monitoredBy="//@regions.3/@sensors.2" connectsTo="//@regions.3/@elements.12" length="977"/>
    <elements xsi:type="railway:Segment" id="227" monitoredBy="//@regions.3/@sensors.2" connectsTo="//@regions.3/@elements.13" length="801"/>
    <elements xsi:type="railway:Segment" id="228" monitoredBy="//@regions.3/@sensors.2" connectsTo="//@regions.3/@elements.14" length="824"/>
    <elements xsi:type="railway:Segment" id="229" monitoredBy="//@regions.3/@sensors.2" connectsTo="//@regions.3/@elements.15" length="386"/>
    <elements xsi:type="railway:Segment" id="230" monitoredBy="//@regions.3/@sensors.2" connectsTo="//@regions.3/@elements.16" length="395"/>
    <elements xsi:type="railway:Segment" id="232" monitoredBy="//@regions.3/@sensors.3" connectsTo="//@regions.3/@elements.17" length="769"/>
    <elements xsi:type="railway:Segment" id="233" monitoredBy="//@regions.3/@sensors.3" connectsTo="//@regions.3/@elements.18" length="608"/>
    <elements xsi:type="railway:Segment" id="234" monitoredBy="//@regions.3/@sensors.3" connectsTo="//@regions.3/@elements.19" length="380"/>
    <elements xsi:type="railway:Segment" id="235" monitoredBy="//@regions.3/@sensors.3" connectsTo="//@regions.3/@elements.20" length="829"/>
    <elements xsi:type="railway:Segment" id="236" monitoredBy="//@regions.3/@sensors.3" connectsTo="//@regions.3/@elements.21" length="230"/>
    <elements xsi:type="railway:Segment" id="238" monitoredBy="//@regions.3/@sensors.4" connectsTo="//@regions.3/@elements.22" length="619"/>
    <elements xsi:type="railway:Segment" id="239" monitoredBy="//@regions.3/@sensors.4" connectsTo="//@regions.3/@elements.23" length="609"/>
    <elements xsi:type="railway:Segment" id="240" monitoredBy="//@regions.3/@sensors.4" connectsTo="//@regions.3/@elements.24" length="620"/>
    <elements xsi:type="railway:Segment" id="241" monitoredBy="//@regions.3/@sensors.4" connectsTo="//@regions.3/@elements.25" length="486"/>
    <elements xsi:type="railway:Segment" id="242" monitoredBy="//@regions.3/@sensors.4" connectsTo="//@regions.3/@elements.26" length="181"/>
    <elements xsi:type="railway:Segment" id="244" monitoredBy="//@regions.3/@sensors.5" connectsTo="//@regions.3/@elements.27" length="921"/>
    <elements xsi:type="railway:Segment" id="245" monitoredBy="//@regions.3/@sensors.5" connectsTo="//@regions.3/@elements.28" length="54"/>
    <elements xsi:type="railway:Segment" id="246" monitoredBy="//@regions.3/@sensors.5" connectsTo="//@regions.3/@elements.29" length="329"/>
    <elements xsi:type="railway:Segment" id="247" monitoredBy="//@regions.3/@sensors.5" connectsTo="//@regions.3/@elements.30" length="745"/>
    <elements xsi:type="railway:Segment" id="248" monitoredBy="//@regions.3/@sensors.5" connectsTo="//@regions.3/@elements.31" length="703"/>
    <elements xsi:type="railway:Segment" id="250" monitoredBy="//@regions.3/@sensors.6" connectsTo="//@regions.3/@elements.32" length="322"/>
    <elements xsi:type="railway:Segment" id="251" monitoredBy="//@regions.3/@sensors.6" connectsTo="//@regions.3/@elements.33" length="763"/>
    <elements xsi:type="railway:Segment" id="252" monitoredBy="//@regions.3/@sensors.6" connectsTo="//@regions.3/@elements.34" length="369"/>
    <elements xsi:type="railway:Segment" id="253" monitoredBy="//@regions.3/@sensors.6" connectsTo="//@regions.3/@elements.35" length="890"/>
    <elements xsi:type="railway:Segment" id="254" monitoredBy="//@regions.3/@sensors.6" connectsTo="//@regions.3/@elements.36" length="591"/>
    <elements xsi:type="railway:Segment" id="256" monitoredBy="//@regions.3/@sensors.7" connectsTo="//@regions.3/@elements.37" length="736"/>
    <elements xsi:type="railway:Segment" id="257" monitoredBy="//@regions.3/@sensors.7" connectsTo="//@regions.3/@elements.38" length="547"/>
    <elements xsi:type="railway:Segment" id="258" monitoredBy="//@regions.3/@sensors.7" connectsTo="//@regions.3/@elements.39" length="836"/>
    <elements xsi:type="railway:Segment" id="259" monitoredBy="//@regions.3/@sensors.7" connectsTo="//@regions.3/@elements.40" length="257"/>
    <elements xsi:type="railway:Segment" id="260" monitoredBy="//@regions.3/@sensors.7" connectsTo="//@regions.3/@elements.41" length="746"/>
    <elements xsi:type="railway:Segment" id="262" monitoredBy="//@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.42" length="488"/>
    <elements xsi:type="railway:Segment" id="263" monitoredBy="//@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.43" length="830"/>
    <elements xsi:type="railway:Segment" id="264" monitoredBy="//@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.44" length="366"/>
    <elements xsi:type="railway:Segment" id="265" monitoredBy="//@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.45" length="754"/>
    <elements xsi:type="railway:Segment" id="266" monitoredBy="//@regions.3/@sensors.8" connectsTo="//@regions.3/@elements.46" length="638"/>
    <elements xsi:type="railway:Switch" id="268" monitoredBy="//@regions.3/@sensors.9 //@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.47" currentPosition="STRAIGHT" positions="//@routes.3/@follows.1"/>
    <elements xsi:type="railway:Segment" id="270" monitoredBy="//@regions.3/@sensors.9" connectsTo="//@regions.3/@elements.48" length="214"/>
    <elements xsi:type="railway:Segment" id="271" monitoredBy="//@regions.3/@sensors.9" connectsTo="//@regions.3/@elements.49" length="102"/>
    <elements xsi:type="railway:Segment" id="272" monitoredBy="//@regions.3/@sensors.9" connectsTo="//@regions.3/@elements.50" length="985"/>
    <elements xsi:type="railway:Segment" id="273" monitoredBy="//@regions.3/@sensors.9" connectsTo="//@regions.3/@elements.51" length="517"/>
    <elements xsi:type="railway:Segment" id="274" monitoredBy="//@regions.3/@sensors.9" connectsTo="//@regions.3/@elements.52" length="302"/>
    <elements xsi:type="railway:Segment" id="276" monitoredBy="//@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.53" length="785"/>
    <elements xsi:type="railway:Segment" id="277" monitoredBy="//@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.54" length="593"/>
    <elements xsi:type="railway:Segment" id="278" monitoredBy="//@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.55" length="566"/>
    <elements xsi:type="railway:Segment" id="279" monitoredBy="//@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.56" length="570"/>
    <elements xsi:type="railway:Segment" id="280" monitoredBy="//@regions.3/@sensors.10" connectsTo="//@regions.3/@elements.57" length="386"/>
    <elements xsi:type="railway:Switch" id="282" monitoredBy="//@regions.3/@sensors.11 //@regions.3/@sensors.12 //@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.58" currentPosition="DIVERGING" positions="//@routes.3/@follows.2"/>
    <elements xsi:type="railway:Segment" id="284" monitoredBy="//@regions.3/@sensors.11" connectsTo="//@regions.3/@elements.59" length="949"/>
    <elements xsi:type="railway:Segment" id="285" monitoredBy="//@regions.3/@sensors.11" connectsTo="//@regions.3/@elements.60" length="462"/>
    <elements xsi:type="railway:Segment" id="286" monitoredBy="//@regions.3/@sensors.11" connectsTo="//@regions.3/@elements.61" length="158"/>
    <elements xsi:type="railway:Segment" id="287" monitoredBy="//@regions.3/@sensors.11" connectsTo="//@regions.3/@elements.62" length="657"/>
    <elements xsi:type="railway:Segment" id="288" monitoredBy="//@regions.3/@sensors.11" connectsTo="//@regions.3/@elements.63" length="697"/>
    <elements xsi:type="railway:Segment" id="290" monitoredBy="//@regions.3/@sensors.12" connectsTo="//@regions.3/@elements.64" length="931"/>
    <elements xsi:type="railway:Segment" id="291" monitoredBy="//@regions.3/@sensors.12" connectsTo="//@regions.3/@elements.65" length="225"/>
    <elements xsi:type="railway:Segment" id="292" monitoredBy="//@regions.3/@sensors.12" connectsTo="//@regions.3/@elements.66" length="119"/>
    <elements xsi:type="railway:Segment" id="293" monitoredBy="//@regions.3/@sensors.12" connectsTo="//@regions.3/@elements.67" length="999"/>
    <elements xsi:type="railway:Segment" id="294" monitoredBy="//@regions.3/@sensors.12" connectsTo="//@regions.3/@elements.68" length="342"/>
    <elements xsi:type="railway:Segment" id="296" monitoredBy="//@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.69" length="490"/>
    <elements xsi:type="railway:Segment" id="297" monitoredBy="//@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.70" length="986"/>
    <elements xsi:type="railway:Segment" id="298" monitoredBy="//@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.71" length="392"/>
    <elements xsi:type="railway:Segment" id="299" monitoredBy="//@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.72" length="798"/>
    <elements xsi:type="railway:Segment" id="300" monitoredBy="//@regions.3/@sensors.13" connectsTo="//@regions.3/@elements.73" length="782"/>
    <elements xsi:type="railway:Switch" id="302" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.74" positions="//@routes.3/@follows.3"/>
    <elements xsi:type="railway:Segment" id="304" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.75" length="480"/>
    <elements xsi:type="railway:Segment" id="305" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.76" length="212"/>
    <elements xsi:type="railway:Segment" id="306" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.77" length="214"/>
    <elements xsi:type="railway:Segment" id="307" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.78" length="907"/>
    <elements xsi:type="railway:Segment" id="308" monitoredBy="//@regions.3/@sensors.14" connectsTo="//@regions.3/@elements.79" length="617"/>
    <elements xsi:type="railway:Switch" id="310" monitoredBy="//@regions.3/@sensors.15 //@regions.3/@sensors.16 //@regions.3/@sensors.17 //@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.80" positions="//@routes.3/@follows.4"/>
    <elements xsi:type="railway:Segment" id="312" monitoredBy="//@regions.3/@sensors.15" connectsTo="//@regions.3/@elements.81" length="118"/>
    <elements xsi:type="railway:Segment" id="313" monitoredBy="//@regions.3/@sensors.15" connectsTo="//@regions.3/@elements.82" length="772"/>
    <elements xsi:type="railway:Segment" id="314" monitoredBy="//@regions.3/@sensors.15" connectsTo="//@regions.3/@elements.83" length="533"/>
    <elements xsi:type="railway:Segment" id="315" monitoredBy="//@regions.3/@sensors.15" connectsTo="//@regions.3/@elements.84" length="981"/>
    <elements xsi:type="railway:Segment" id="316" monitoredBy="//@regions.3/@sensors.15" connectsTo="//@regions.3/@elements.85" length="510"/>
    <elements xsi:type="railway:Segment" id="318" monitoredBy="//@regions.3/@sensors.16" connectsTo="//@regions.3/@elements.86" length="186"/>
    <elements xsi:type="railway:Segment" id="319" monitoredBy="//@regions.3/@sensors.16" connectsTo="//@regions.3/@elements.87" length="298"/>
    <elements xsi:type="railway:Segment" id="320" monitoredBy="//@regions.3/@sensors.16" connectsTo="//@regions.3/@elements.88" length="324"/>
    <elements xsi:type="railway:Segment" id="321" monitoredBy="//@regions.3/@sensors.16" connectsTo="//@regions.3/@elements.89" length="372"/>
    <elements xsi:type="railway:Segment" id="322" monitoredBy="//@regions.3/@sensors.16" connectsTo="//@regions.3/@elements.90" length="881"/>
    <elements xsi:type="railway:Segment" id="324" monitoredBy="//@regions.3/@sensors.17" connectsTo="//@regions.3/@elements.91" length="219"/>
    <elements xsi:type="railway:Segment" id="325" monitoredBy="//@regions.3/@sensors.17" connectsTo="//@regions.3/@elements.92" length="740"/>
    <elements xsi:type="railway:Segment" id="326" monitoredBy="//@regions.3/@sensors.17" connectsTo="//@regions.3/@elements.93" length="822"/>
    <elements xsi:type="railway:Segment" id="327" monitoredBy="//@regions.3/@sensors.17" connectsTo="//@regions.3/@elements.94" length="897"/>
    <elements xsi:type="railway:Segment" id="328" monitoredBy="//@regions.3/@sensors.17" connectsTo="//@regions.3/@elements.95" length="521"/>
    <elements xsi:type="railway:Segment" id="330" monitoredBy="//@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.96" length="685"/>
    <elements xsi:type="railway:Segment" id="331" monitoredBy="//@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.97" length="750"/>
    <elements xsi:type="railway:Segment" id="332" monitoredBy="//@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.98" length="630"/>
    <elements xsi:type="railway:Segment" id="333" monitoredBy="//@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.99" length="250"/>
    <elements xsi:type="railway:Segment" id="334" monitoredBy="//@regions.3/@sensors.18" connectsTo="//@regions.3/@elements.100" length="809"/>
    <elements xsi:type="railway:Switch" id="336" monitoredBy="//@regions.3/@sensors.19 //@regions.3/@sensors.20 //@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.101" currentPosition="DIVERGING" positions="//@routes.3/@follows.5"/>
    <elements xsi:type="railway:Segment" id="338" monitoredBy="//@regions.3/@sensors.19" connectsTo="//@regions.3/@elements.102" length="579"/>
    <elements xsi:type="railway:Segment" id="339" monitoredBy="//@regions.3/@sensors.19" connectsTo="//@regions.3/@elements.103" length="77"/>
    <elements xsi:type="railway:Segment" id="340" monitoredBy="//@regions.3/@sensors.19" connectsTo="//@regions.3/@elements.104" length="39"/>
    <elements xsi:type="railway:Segment" id="341" monitoredBy="//@regions.3/@sensors.19" connectsTo="//@regions.3/@elements.105" length="719"/>
    <elements xsi:type="railway:Segment" id="342" monitoredBy="//@regions.3/@sensors.19" connectsTo="//@regions.3/@elements.106" length="91"/>
    <elements xsi:type="railway:Segment" id="344" monitoredBy="//@regions.3/@sensors.20" connectsTo="//@regions.3/@elements.107" length="796"/>
    <elements xsi:type="railway:Segment" id="345" monitoredBy="//@regions.3/@sensors.20" connectsTo="//@regions.3/@elements.108" length="963"/>
    <elements xsi:type="railway:Segment" id="346" monitoredBy="//@regions.3/@sensors.20" connectsTo="//@regions.3/@elements.109" length="894"/>
    <elements xsi:type="railway:Segment" id="347" monitoredBy="//@regions.3/@sensors.20" connectsTo="//@regions.3/@elements.110" length="802"/>
    <elements xsi:type="railway:Segment" id="348" monitoredBy="//@regions.3/@sensors.20" connectsTo="//@regions.3/@elements.111" length="951"/>
    <elements xsi:type="railway:Segment" id="350" monitoredBy="//@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.112" length="402"/>
    <elements xsi:type="railway:Segment" id="351" monitoredBy="//@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.113" length="718"/>
    <elements xsi:type="railway:Segment" id="352" monitoredBy="//@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.114" length="337"/>
    <elements xsi:type="railway:Segment" id="353" monitoredBy="//@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.115" length="942"/>
    <elements xsi:type="railway:Segment" id="354" monitoredBy="//@regions.3/@sensors.21" connectsTo="//@regions.3/@elements.116" length="59"/>
    <elements xsi:type="railway:Switch" id="356" monitoredBy="//@regions.3/@sensors.22 //@regions.3/@sensors.23 //@regions.3/@sensors.24 //@regions.3/@sensors.25 //@regions.3/@sensors.26 //@regions.3/@sensors.27 //@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.117" positions="//@routes.3/@follows.6"/>
    <elements xsi:type="railway:Segment" id="358" monitoredBy="//@regions.3/@sensors.22" connectsTo="//@regions.3/@elements.118" length="547"/>
    <elements xsi:type="railway:Segment" id="359" monitoredBy="//@regions.3/@sensors.22" connectsTo="//@regions.3/@elements.119" length="686"/>
    <elements xsi:type="railway:Segment" id="360" monitoredBy="//@regions.3/@sensors.22" connectsTo="//@regions.3/@elements.120" length="836"/>
    <elements xsi:type="railway:Segment" id="361" monitoredBy="//@regions.3/@sensors.22" connectsTo="//@regions.3/@elements.121" length="212"/>
    <elements xsi:type="railway:Segment" id="362" monitoredBy="//@regions.3/@sensors.22" connectsTo="//@regions.3/@elements.122" length="579"/>
    <elements xsi:type="railway:Segment" id="364" monitoredBy="//@regions.3/@sensors.23" connectsTo="//@regions.3/@elements.123" length="403"/>
    <elements xsi:type="railway:Segment" id="365" monitoredBy="//@regions.3/@sensors.23" connectsTo="//@regions.3/@elements.124" length="218"/>
    <elements xsi:type="railway:Segment" id="366" monitoredBy="//@regions.3/@sensors.23" connectsTo="//@regions.3/@elements.125" length="616"/>
    <elements xsi:type="railway:Segment" id="367" monitoredBy="//@regions.3/@sensors.23" connectsTo="//@regions.3/@elements.126" length="191"/>
    <elements xsi:type="railway:Segment" id="368" monitoredBy="//@regions.3/@sensors.23" connectsTo="//@regions.3/@elements.127" length="870"/>
    <elements xsi:type="railway:Segment" id="370" monitoredBy="//@regions.3/@sensors.24" connectsTo="//@regions.3/@elements.128" length="610"/>
    <elements xsi:type="railway:Segment" id="371" monitoredBy="//@regions.3/@sensors.24" connectsTo="//@regions.3/@elements.129" length="344"/>
    <elements xsi:type="railway:Segment" id="372" monitoredBy="//@regions.3/@sensors.24" connectsTo="//@regions.3/@elements.130" length="374"/>
    <elements xsi:type="railway:Segment" id="373" monitoredBy="//@regions.3/@sensors.24" connectsTo="//@regions.3/@elements.131" length="333"/>
    <elements xsi:type="railway:Segment" id="374" monitoredBy="//@regions.3/@sensors.24" connectsTo="//@regions.3/@elements.132" length="792"/>
    <elements xsi:type="railway:Segment" id="376" monitoredBy="//@regions.3/@sensors.25" connectsTo="//@regions.3/@elements.133" length="923"/>
    <elements xsi:type="railway:Segment" id="377" monitoredBy="//@regions.3/@sensors.25" connectsTo="//@regions.3/@elements.134" length="100"/>
    <elements xsi:type="railway:Segment" id="378" monitoredBy="//@regions.3/@sensors.25" connectsTo="//@regions.3/@elements.135" length="627"/>
    <elements xsi:type="railway:Segment" id="379" monitoredBy="//@regions.3/@sensors.25" connectsTo="//@regions.3/@elements.136" length="258"/>
    <elements xsi:type="railway:Segment" id="380" monitoredBy="//@regions.3/@sensors.25" connectsTo="//@regions.3/@elements.137" length="699"/>
    <elements xsi:type="railway:Segment" id="382" monitoredBy="//@regions.3/@sensors.26" connectsTo="//@regions.3/@elements.138" length="889"/>
    <elements xsi:type="railway:Segment" id="383" monitoredBy="//@regions.3/@sensors.26" connectsTo="//@regions.3/@elements.139" length="11"/>
    <elements xsi:type="railway:Segment" id="384" monitoredBy="//@regions.3/@sensors.26" connectsTo="//@regions.3/@elements.140" length="465"/>
    <elements xsi:type="railway:Segment" id="385" monitoredBy="//@regions.3/@sensors.26" connectsTo="//@regions.3/@elements.141" length="14"/>
    <elements xsi:type="railway:Segment" id="386" monitoredBy="//@regions.3/@sensors.26" connectsTo="//@regions.3/@elements.142" length="470"/>
    <elements xsi:type="railway:Segment" id="388" monitoredBy="//@regions.3/@sensors.27" connectsTo="//@regions.3/@elements.143" length="232"/>
    <elements xsi:type="railway:Segment" id="389" monitoredBy="//@regions.3/@sensors.27" connectsTo="//@regions.3/@elements.144" length="343"/>
    <elements xsi:type="railway:Segment" id="390" monitoredBy="//@regions.3/@sensors.27" connectsTo="//@regions.3/@elements.145" length="605"/>
    <elements xsi:type="railway:Segment" id="391" monitoredBy="//@regions.3/@sensors.27" connectsTo="//@regions.3/@elements.146" length="771"/>
    <elements xsi:type="railway:Segment" id="392" monitoredBy="//@regions.3/@sensors.27" connectsTo="//@regions.3/@elements.147" length="799"/>
    <elements xsi:type="railway:Segment" id="394" monitoredBy="//@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.148" length="288"/>
    <elements xsi:type="railway:Segment" id="395" monitoredBy="//@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.149" length="333"/>
    <elements xsi:type="railway:Segment" id="396" monitoredBy="//@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.150" length="964"/>
    <elements xsi:type="railway:Segment" id="397" monitoredBy="//@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.151" length="994"/>
    <elements xsi:type="railway:Segment" id="398" monitoredBy="//@regions.3/@sensors.28" connectsTo="//@regions.3/@elements.152" length="518"/>
    <elements xsi:type="railway:Switch" id="400" monitoredBy="//@regions.3/@sensors.29 //@regions.3/@sensors.30 //@regions.3/@sensors.31 //@regions.3/@sensors.32 //@regions.3/@sensors.33 //@regions.3/@sensors.34 //@regions.3/@sensors.35 //@regions.3/@sensors.36 //@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.153" currentPosition="DIVERGING" positions="//@routes.3/@follows.7"/>
    <elements xsi:type="railway:Segment" id="402" monitoredBy="//@regions.3/@sensors.29" connectsTo="//@regions.3/@elements.154" length="167"/>
    <elements xsi:type="railway:Segment" id="403" monitoredBy="//@regions.3/@sensors.29" connectsTo="//@regions.3/@elements.155" length="90"/>
    <elements xsi:type="railway:Segment" id="404" monitoredBy="//@regions.3/@sensors.29" connectsTo="//@regions.3/@elements.156" length="466"/>
    <elements xsi:type="railway:Segment" id="405" monitoredBy="//@regions.3/@sensors.29" connectsTo="//@regions.3/@elements.157" length="52"/>
    <elements xsi:type="railway:Segment" id="406" monitoredBy="//@regions.3/@sensors.29" connectsTo="//@regions.3/@elements.158" length="886"/>
    <elements xsi:type="railway:Segment" id="408" monitoredBy="//@regions.3/@sensors.30" connectsTo="//@regions.3/@elements.159" length="685"/>
    <elements xsi:type="railway:Segment" id="409" monitoredBy="//@regions.3/@sensors.30" connectsTo="//@regions.3/@elements.160" length="248"/>
    <elements xsi:type="railway:Segment" id="410" monitoredBy="//@regions.3/@sensors.30" connectsTo="//@regions.3/@elements.161" length="404"/>
    <elements xsi:type="railway:Segment" id="411" monitoredBy="//@regions.3/@sensors.30" connectsTo="//@regions.3/@elements.162" length="261"/>
    <elements xsi:type="railway:Segment" id="412" monitoredBy="//@regions.3/@sensors.30" connectsTo="//@regions.3/@elements.163" length="111"/>
    <elements xsi:type="railway:Segment" id="414" monitoredBy="//@regions.3/@sensors.31" connectsTo="//@regions.3/@elements.164" length="408"/>
    <elements xsi:type="railway:Segment" id="415" monitoredBy="//@regions.3/@sensors.31" connectsTo="//@regions.3/@elements.165" length="852"/>
    <elements xsi:type="railway:Segment" id="416" monitoredBy="//@regions.3/@sensors.31" connectsTo="//@regions.3/@elements.166" length="610"/>
    <elements xsi:type="railway:Segment" id="417" monitoredBy="//@regions.3/@sensors.31" connectsTo="//@regions.3/@elements.167" length="36"/>
    <elements xsi:type="railway:Segment" id="418" monitoredBy="//@regions.3/@sensors.31" connectsTo="//@regions.3/@elements.168" length="514"/>
    <elements xsi:type="railway:Segment" id="420" monitoredBy="//@regions.3/@sensors.32" connectsTo="//@regions.3/@elements.169" length="458"/>
    <elements xsi:type="railway:Segment" id="421" monitoredBy="//@regions.3/@sensors.32" connectsTo="//@regions.3/@elements.170" length="883"/>
    <elements xsi:type="railway:Segment" id="422" monitoredBy="//@regions.3/@sensors.32" connectsTo="//@regions.3/@elements.171" length="918"/>
    <elements xsi:type="railway:Segment" id="423" monitoredBy="//@regions.3/@sensors.32" connectsTo="//@regions.3/@elements.172" length="270"/>
    <elements xsi:type="railway:Segment" id="424" monitoredBy="//@regions.3/@sensors.32" connectsTo="//@regions.3/@elements.173" length="345"/>
    <elements xsi:type="railway:Segment" id="426" monitoredBy="//@regions.3/@sensors.33" connectsTo="//@regions.3/@elements.174" length="684"/>
    <elements xsi:type="railway:Segment" id="427" monitoredBy="//@regions.3/@sensors.33" connectsTo="//@regions.3/@elements.175" length="820"/>
    <elements xsi:type="railway:Segment" id="428" monitoredBy="//@regions.3/@sensors.33" connectsTo="//@regions.3/@elements.176" length="156"/>
    <elements xsi:type="railway:Segment" id="429" monitoredBy="//@regions.3/@sensors.33" connectsTo="//@regions.3/@elements.177" length="428"/>
    <elements xsi:type="railway:Segment" id="430" monitoredBy="//@regions.3/@sensors.33" connectsTo="//@regions.3/@elements.178" length="754"/>
    <elements xsi:type="railway:Segment" id="432" monitoredBy="//@regions.3/@sensors.34" connectsTo="//@regions.3/@elements.179" length="714"/>
    <elements xsi:type="railway:Segment" id="433" monitoredBy="//@regions.3/@sensors.34" connectsTo="//@regions.3/@elements.180" length="901"/>
    <elements xsi:type="railway:Segment" id="434" monitoredBy="//@regions.3/@sensors.34" connectsTo="//@regions.3/@elements.181" length="735"/>
    <elements xsi:type="railway:Segment" id="435" monitoredBy="//@regions.3/@sensors.34" connectsTo="//@regions.3/@elements.182" length="534"/>
    <elements xsi:type="railway:Segment" id="436" monitoredBy="//@regions.3/@sensors.34" connectsTo="//@regions.3/@elements.183" length="372"/>
    <elements xsi:type="railway:Segment" id="438" monitoredBy="//@regions.3/@sensors.35" connectsTo="//@regions.3/@elements.184" length="49"/>
    <elements xsi:type="railway:Segment" id="439" monitoredBy="//@regions.3/@sensors.35" connectsTo="//@regions.3/@elements.185" length="917"/>
    <elements xsi:type="railway:Segment" id="440" monitoredBy="//@regions.3/@sensors.35" connectsTo="//@regions.3/@elements.186" length="369"/>
    <elements xsi:type="railway:Segment" id="441" monitoredBy="//@regions.3/@sensors.35" connectsTo="//@regions.3/@elements.187" length="373"/>
    <elements xsi:type="railway:Segment" id="442" monitoredBy="//@regions.3/@sensors.35" connectsTo="//@regions.3/@elements.188" length="94"/>
    <elements xsi:type="railway:Segment" id="444" monitoredBy="//@regions.3/@sensors.36" connectsTo="//@regions.3/@elements.189" length="507"/>
    <elements xsi:type="railway:Segment" id="445" monitoredBy="//@regions.3/@sensors.36" connectsTo="//@regions.3/@elements.190" length="737"/>
    <elements xsi:type="railway:Segment" id="446" monitoredBy="//@regions.3/@sensors.36" connectsTo="//@regions.3/@elements.191" length="348"/>
    <elements xsi:type="railway:Segment" id="447" monitoredBy="//@regions.3/@sensors.36" connectsTo="//@regions.3/@elements.192" length="433"/>
    <elements xsi:type="railway:Segment" id="448" monitoredBy="//@regions.3/@sensors.36" connectsTo="//@regions.3/@elements.193" length="411"/>
    <elements xsi:type="railway:Segment" id="450" monitoredBy="//@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.194" length="149"/>
    <elements xsi:type="railway:Segment" id="451" monitoredBy="//@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.195" length="541"/>
    <elements xsi:type="railway:Segment" id="452" monitoredBy="//@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.196" length="773"/>
    <elements xsi:type="railway:Segment" id="453" monitoredBy="//@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.197" length="278"/>
    <elements xsi:type="railway:Segment" id="454" monitoredBy="//@regions.3/@sensors.37" connectsTo="//@regions.3/@elements.198" length="75"/>
    <elements xsi:type="railway:Switch" id="456" monitoredBy="//@regions.3/@sensors.38 //@regions.3/@sensors.39 //@regions.3/@sensors.40 //@regions.3/@sensors.41 //@regions.3/@sensors.42 //@regions.3/@sensors.43 //@regions.3/@sensors.44 //@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.199" currentPosition="STRAIGHT" positions="//@routes.3/@follows.8"/>
    <elements xsi:type="railway:Segment" id="458" monitoredBy="//@regions.3/@sensors.38" connectsTo="//@regions.3/@elements.200" length="70"/>
    <elements xsi:type="railway:Segment" id="459" monitoredBy="//@regions.3/@sensors.38" connectsTo="//@regions.3/@elements.201" length="565"/>
    <elements xsi:type="railway:Segment" id="460" monitoredBy="//@regions.3/@sensors.38" connectsTo="//@regions.3/@elements.202" length="809"/>
    <elements xsi:type="railway:Segment" id="461" monitoredBy="//@regions.3/@sensors.38" connectsTo="//@regions.3/@elements.203" length="883"/>
    <elements xsi:type="railway:Segment" id="462" monitoredBy="//@regions.3/@sensors.38" connectsTo="//@regions.3/@elements.204" length="160"/>
    <elements xsi:type="railway:Segment" id="464" monitoredBy="//@regions.3/@sensors.39" connectsTo="//@regions.3/@elements.205" length="415"/>
    <elements xsi:type="railway:Segment" id="465" monitoredBy="//@regions.3/@sensors.39" connectsTo="//@regions.3/@elements.206" length="744"/>
    <elements xsi:type="railway:Segment" id="466" monitoredBy="//@regions.3/@sensors.39" connectsTo="//@regions.3/@elements.207" length="136"/>
    <elements xsi:type="railway:Segment" id="467" monitoredBy="//@regions.3/@sensors.39" connectsTo="//@regions.3/@elements.208" length="461"/>
    <elements xsi:type="railway:Segment" id="468" monitoredBy="//@regions.3/@sensors.39" connectsTo="//@regions.3/@elements.209" length="640"/>
    <elements xsi:type="railway:Segment" id="470" monitoredBy="//@regions.3/@sensors.40" connectsTo="//@regions.3/@elements.210" length="224"/>
    <elements xsi:type="railway:Segment" id="471" monitoredBy="//@regions.3/@sensors.40" connectsTo="//@regions.3/@elements.211" length="267"/>
    <elements xsi:type="railway:Segment" id="472" monitoredBy="//@regions.3/@sensors.40" connectsTo="//@regions.3/@elements.212" length="857"/>
    <elements xsi:type="railway:Segment" id="473" monitoredBy="//@regions.3/@sensors.40" connectsTo="//@regions.3/@elements.213" length="94"/>
    <elements xsi:type="railway:Segment" id="474" monitoredBy="//@regions.3/@sensors.40" connectsTo="//@regions.3/@elements.214" length="933"/>
    <elements xsi:type="railway:Segment" id="476" monitoredBy="//@regions.3/@sensors.41" connectsTo="//@regions.3/@elements.215" length="627"/>
    <elements xsi:type="railway:Segment" id="477" monitoredBy="//@regions.3/@sensors.41" connectsTo="//@regions.3/@elements.216" length="976"/>
    <elements xsi:type="railway:Segment" id="478" monitoredBy="//@regions.3/@sensors.41" connectsTo="//@regions.3/@elements.217" length="773"/>
    <elements xsi:type="railway:Segment" id="479" monitoredBy="//@regions.3/@sensors.41" connectsTo="//@regions.3/@elements.218" length="644"/>
    <elements xsi:type="railway:Segment" id="480" monitoredBy="//@regions.3/@sensors.41" connectsTo="//@regions.3/@elements.219" length="493"/>
    <elements xsi:type="railway:Segment" id="482" monitoredBy="//@regions.3/@sensors.42" connectsTo="//@regions.3/@elements.220" length="519"/>
    <elements xsi:type="railway:Segment" id="483" monitoredBy="//@regions.3/@sensors.42" connectsTo="//@regions.3/@elements.221" length="273"/>
    <elements xsi:type="railway:Segment" id="484" monitoredBy="//@regions.3/@sensors.42" connectsTo="//@regions.3/@elements.222" length="643"/>
    <elements xsi:type="railway:Segment" id="485" monitoredBy="//@regions.3/@sensors.42" connectsTo="//@regions.3/@elements.223" length="699"/>
    <elements xsi:type="railway:Segment" id="486" monitoredBy="//@regions.3/@sensors.42" connectsTo="//@regions.3/@elements.224" length="207"/>
    <elements xsi:type="railway:Segment" id="488" monitoredBy="//@regions.3/@sensors.43" connectsTo="//@regions.3/@elements.225" length="293"/>
    <elements xsi:type="railway:Segment" id="489" monitoredBy="//@regions.3/@sensors.43" connectsTo="//@regions.3/@elements.226" length="157"/>
    <elements xsi:type="railway:Segment" id="490" monitoredBy="//@regions.3/@sensors.43" connectsTo="//@regions.3/@elements.227" length="60"/>
    <elements xsi:type="railway:Segment" id="491" monitoredBy="//@regions.3/@sensors.43" connectsTo="//@regions.3/@elements.228" length="620"/>
    <elements xsi:type="railway:Segment" id="492" monitoredBy="//@regions.3/@sensors.43" connectsTo="//@regions.3/@elements.229" length="718"/>
    <elements xsi:type="railway:Segment" id="494" monitoredBy="//@regions.3/@sensors.44" connectsTo="//@regions.3/@elements.230" length="905"/>
    <elements xsi:type="railway:Segment" id="495" monitoredBy="//@regions.3/@sensors.44" connectsTo="//@regions.3/@elements.231" length="553"/>
    <elements xsi:type="railway:Segment" id="496" monitoredBy="//@regions.3/@sensors.44" connectsTo="//@regions.3/@elements.232" length="453"/>
    <elements xsi:type="railway:Segment" id="497" monitoredBy="//@regions.3/@sensors.44" connectsTo="//@regions.3/@elements.233" length="536"/>
    <elements xsi:type="railway:Segment" id="498" monitoredBy="//@regions.3/@sensors.44" connectsTo="//@regions.3/@elements.234" length="322"/>
    <elements xsi:type="railway:Segment" id="500" monitoredBy="//@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.235" length="783"/>
    <elements xsi:type="railway:Segment" id="501" monitoredBy="//@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.236" length="524"/>
    <elements xsi:type="railway:Segment" id="502" monitoredBy="//@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.237" length="283"/>
    <elements xsi:type="railway:Segment" id="503" monitoredBy="//@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.238" length="82"/>
    <elements xsi:type="railway:Segment" id="504" monitoredBy="//@regions.3/@sensors.45" connectsTo="//@regions.3/@elements.239" length="574"/>
    <elements xsi:type="railway:Switch" id="506" monitoredBy="//@regions.3/@sensors.46 //@regions.3/@sensors.47 //@regions.3/@sensors.48 //@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.240" positions="//@routes.3/@follows.9"/>
    <elements xsi:type="railway:Segment" id="508" monitoredBy="//@regions.3/@sensors.46" connectsTo="//@regions.3/@elements.241" length="36"/>
    <elements xsi:type="railway:Segment" id="509" monitoredBy="//@regions.3/@sensors.46" connectsTo="//@regions.3/@elements.242" length="464"/>
    <elements xsi:type="railway:Segment" id="510" monitoredBy="//@regions.3/@sensors.46" connectsTo="//@regions.3/@elements.243" length="263"/>
    <elements xsi:type="railway:Segment" id="511" monitoredBy="//@regions.3/@sensors.46" connectsTo="//@regions.3/@elements.244" length="717"/>
    <elements xsi:type="railway:Segment" id="512" monitoredBy="//@regions.3/@sensors.46" connectsTo="//@regions.3/@elements.245" length="970"/>
    <elements xsi:type="railway:Segment" id="514" monitoredBy="//@regions.3/@sensors.47" connectsTo="//@regions.3/@elements.246" length="150"/>
    <elements xsi:type="railway:Segment" id="515" monitoredBy="//@regions.3/@sensors.47" connectsTo="//@regions.3/@elements.247" length="39"/>
    <elements xsi:type="railway:Segment" id="516" monitoredBy="//@regions.3/@sensors.47" connectsTo="//@regions.3/@elements.248" length="159"/>
    <elements xsi:type="railway:Segment" id="517" monitoredBy="//@regions.3/@sensors.47" connectsTo="//@regions.3/@elements.249" length="83"/>
    <elements xsi:type="railway:Segment" id="518" monitoredBy="//@regions.3/@sensors.47" connectsTo="//@regions.3/@elements.250" length="683"/>
    <elements xsi:type="railway:Segment" id="520" monitoredBy="//@regions.3/@sensors.48" connectsTo="//@regions.3/@elements.251" length="632"/>
    <elements xsi:type="railway:Segment" id="521" monitoredBy="//@regions.3/@sensors.48" connectsTo="//@regions.3/@elements.252" length="806"/>
    <elements xsi:type="railway:Segment" id="522" monitoredBy="//@regions.3/@sensors.48" connectsTo="//@regions.3/@elements.253" length="453"/>
    <elements xsi:type="railway:Segment" id="523" monitoredBy="//@regions.3/@sensors.48" connectsTo="//@regions.3/@elements.254" length="777"/>
    <elements xsi:type="railway:Segment" id="524" monitoredBy="//@regions.3/@sensors.48" connectsTo="//@regions.3/@elements.255" length="904"/>
    <elements xsi:type="railway:Segment" id="526" monitoredBy="//@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.256" length="546"/>
    <elements xsi:type="railway:Segment" id="527" monitoredBy="//@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.257" length="371"/>
    <elements xsi:type="railway:Segment" id="528" monitoredBy="//@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.258" length="352"/>
    <elements xsi:type="railway:Segment" id="529" monitoredBy="//@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.259" length="227"/>
    <elements xsi:type="railway:Segment" id="530" monitoredBy="//@regions.3/@sensors.49" connectsTo="//@regions.3/@elements.260" length="742"/>
    <elements xsi:type="railway:Switch" id="532" monitoredBy="//@regions.3/@sensors.50 //@regions.3/@sensors.51 //@regions.3/@sensors.52 //@regions.3/@sensors.53 //@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.261" currentPosition="STRAIGHT" positions="//@routes.3/@follows.10"/>
    <elements xsi:type="railway:Segment" id="534" monitoredBy="//@regions.3/@sensors.50" connectsTo="//@regions.3/@elements.262" length="208"/>
    <elements xsi:type="railway:Segment" id="535" monitoredBy="//@regions.3/@sensors.50" connectsTo="//@regions.3/@elements.263" length="177"/>
    <elements xsi:type="railway:Segment" id="536" monitoredBy="//@regions.3/@sensors.50" connectsTo="//@regions.3/@elements.264" length="611"/>
    <elements xsi:type="railway:Segment" id="537" monitoredBy="//@regions.3/@sensors.50" connectsTo="//@regions.3/@elements.265" length="576"/>
    <elements xsi:type="railway:Segment" id="538" monitoredBy="//@regions.3/@sensors.50" connectsTo="//@regions.3/@elements.266" length="605"/>
    <elements xsi:type="railway:Segment" id="540" monitoredBy="//@regions.3/@sensors.51" connectsTo="//@regions.3/@elements.267" length="326"/>
    <elements xsi:type="railway:Segment" id="541" monitoredBy="//@regions.3/@sensors.51" connectsTo="//@regions.3/@elements.268" length="386"/>
    <elements xsi:type="railway:Segment" id="542" monitoredBy="//@regions.3/@sensors.51" connectsTo="//@regions.3/@elements.269" length="531"/>
    <elements xsi:type="railway:Segment" id="543" monitoredBy="//@regions.3/@sensors.51" connectsTo="//@regions.3/@elements.270" length="781"/>
    <elements xsi:type="railway:Segment" id="544" monitoredBy="//@regions.3/@sensors.51" connectsTo="//@regions.3/@elements.271" length="652"/>
    <elements xsi:type="railway:Segment" id="546" monitoredBy="//@regions.3/@sensors.52" connectsTo="//@regions.3/@elements.272" length="83"/>
    <elements xsi:type="railway:Segment" id="547" monitoredBy="//@regions.3/@sensors.52" connectsTo="//@regions.3/@elements.273" length="27"/>
    <elements xsi:type="railway:Segment" id="548" monitoredBy="//@regions.3/@sensors.52" connectsTo="//@regions.3/@elements.274" length="973"/>
    <elements xsi:type="railway:Segment" id="549" monitoredBy="//@regions.3/@sensors.52" connectsTo="//@regions.3/@elements.275" length="42"/>
    <elements xsi:type="railway:Segment" id="550" monitoredBy="//@regions.3/@sensors.52" connectsTo="//@regions.3/@elements.276" length="918"/>
    <elements xsi:type="railway:Segment" id="552" monitoredBy="//@regions.3/@sensors.53" connectsTo="//@regions.3/@elements.277" length="772"/>
    <elements xsi:type="railway:Segment" id="553" monitoredBy="//@regions.3/@sensors.53" connectsTo="//@regions.3/@elements.278" length="185"/>
    <elements xsi:type="railway:Segment" id="554" monitoredBy="//@regions.3/@sensors.53" connectsTo="//@regions.3/@elements.279" length="817"/>
    <elements xsi:type="railway:Segment" id="555" monitoredBy="//@regions.3/@sensors.53" connectsTo="//@regions.3/@elements.280" length="850"/>
    <elements xsi:type="railway:Segment" id="556" monitoredBy="//@regions.3/@sensors.53" connectsTo="//@regions.3/@elements.281" length="503"/>
    <elements xsi:type="railway:Segment" id="558" monitoredBy="//@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.282" length="314"/>
    <elements xsi:type="railway:Segment" id="559" monitoredBy="//@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.283" length="847"/>
    <elements xsi:type="railway:Segment" id="560" monitoredBy="//@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.284" length="300"/>
    <elements xsi:type="railway:Segment" id="561" monitoredBy="//@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.285" length="121"/>
    <elements xsi:type="railway:Segment" id="562" monitoredBy="//@regions.3/@sensors.54" connectsTo="//@regions.3/@elements.286" length="51"/>
    <elements xsi:type="railway:Switch" id="564" monitoredBy="//@regions.3/@sensors.55 //@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.287" currentPosition="STRAIGHT" positions="//@routes.3/@follows.11"/>
    <elements xsi:type="railway:Segment" id="566" monitoredBy="//@regions.3/@sensors.55" connectsTo="//@regions.3/@elements.288" length="977"/>
    <elements xsi:type="railway:Segment" id="567" monitoredBy="//@regions.3/@sensors.55" connectsTo="//@regions.3/@elements.289" length="270"/>
    <elements xsi:type="railway:Segment" id="568" monitoredBy="//@regions.3/@sensors.55" connectsTo="//@regions.3/@elements.290" length="130"/>
    <elements xsi:type="railway:Segment" id="569" monitoredBy="//@regions.3/@sensors.55" connectsTo="//@regions.3/@elements.291" length="195"/>
    <elements xsi:type="railway:Segment" id="570" monitoredBy="//@regions.3/@sensors.55" connectsTo="//@regions.3/@elements.292" length="69"/>
    <elements xsi:type="railway:Segment" id="572" monitoredBy="//@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.293" length="899"/>
    <elements xsi:type="railway:Segment" id="573" monitoredBy="//@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.294" length="47"/>
    <elements xsi:type="railway:Segment" id="574" monitoredBy="//@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.295" length="373"/>
    <elements xsi:type="railway:Segment" id="575" monitoredBy="//@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.296" length="521"/>
    <elements xsi:type="railway:Segment" id="576" monitoredBy="//@regions.3/@sensors.56" connectsTo="//@regions.3/@elements.297" length="423"/>
    <elements xsi:type="railway:Switch" id="578" monitoredBy="//@regions.3/@sensors.57 //@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.298" currentPosition="STRAIGHT" positions="//@routes.3/@follows.12"/>
    <elements xsi:type="railway:Segment" id="580" monitoredBy="//@regions.3/@sensors.57" connectsTo="//@regions.3/@elements.299" length="21"/>
    <elements xsi:type="railway:Segment" id="581" monitoredBy="//@regions.3/@sensors.57" connectsTo="//@regions.3/@elements.300" length="450"/>
    <elements xsi:type="railway:Segment" id="582" monitoredBy="//@regions.3/@sensors.57" connectsTo="//@regions.3/@elements.301" length="820"/>
    <elements xsi:type="railway:Segment" id="583" monitoredBy="//@regions.3/@sensors.57" connectsTo="//@regions.3/@elements.302" length="372"/>
    <elements xsi:type="railway:Segment" id="584" monitoredBy="//@regions.3/@sensors.57" connectsTo="//@regions.3/@elements.303" length="291"/>
    <elements xsi:type="railway:Segment" id="586" monitoredBy="//@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.304" length="993"/>
    <elements xsi:type="railway:Segment" id="587" monitoredBy="//@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.305" length="95"/>
    <elements xsi:type="railway:Segment" id="588" monitoredBy="//@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.306" length="455"/>
    <elements xsi:type="railway:Segment" id="589" monitoredBy="//@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.307" length="522"/>
    <elements xsi:type="railway:Segment" id="590" monitoredBy="//@regions.3/@sensors.58" connectsTo="//@regions.3/@elements.308" length="325"/>
    <elements xsi:type="railway:Switch" id="592" monitoredBy="//@regions.3/@sensors.59 //@regions.3/@sensors.60 //@regions.3/@sensors.61 //@regions.3/@sensors.62" connectsTo="//@regions.3/@elements.309" positions="//@routes.3/@follows.13"/>
    <elements xsi:type="railway:Segment" id="594" monitoredBy="//@regions.3/@sensors.59" connectsTo="//@regions.3/@elements.310" length="984"/>
    <elements xsi:type="railway:Segment" id="595" monitoredBy="//@regions.3/@sensors.59" connectsTo="//@regions.3/@elements.311" length="536"/>
    <elements xsi:type="railway:Segment" id="596" monitoredBy="//@regions.3/@sensors.59" connectsTo="//@regions.3/@elements.312" length="460"/>
    <elements xsi:type="railway:Segment" id="597" monitoredBy="//@regions.3/@sensors.59" connectsTo="//@regions.3/@elements.313" length="108"/>
    <elements xsi:type="railway:Segment" id="598" monitoredBy="//@regions.3/@sensors.59" connectsTo="//@regions.3/@elements.314" length="691"/>
    <elements xsi:type="railway:Segment" id="600" monitoredBy="//@regions.3/@sensors.60" connectsTo="//@regions.3/@elements.315" length="176"/>
    <elements xsi:type="railway:Segment" id="601" monitoredBy="//@regions.3/@sensors.60" connectsTo="//@regions.3/@elements.316" length="822"/>
    <elements xsi:type="railway:Segment" id="602" monitoredBy="//@regions.3/@sensors.60" connectsTo="//@regions.3/@elements.317" length="759"/>
    <elements xsi:type="railway:Segment" id="603" monitoredBy="//@regions.3/@sensors.60" connectsTo="//@regions.3/@elements.318" length="348"/>
    <elements xsi:type="railway:Segment" id="604" monitoredBy="//@regions.3/@sensors.60" connectsTo="//@regions.3/@elements.319" length="61"/>
    <elements xsi:type="railway:Segment" id="606" monitoredBy="//@regions.3/@sensors.61" connectsTo="//@regions.3/@elements.320" length="827"/>
    <elements xsi:type="railway:Segment" id="607" monitoredBy="//@regions.3/@sensors.61" connectsTo="//@regions.3/@elements.321" length="917"/>
    <elements xsi:type="railway:Segment" id="608" monitoredBy="//@regions.3/@sensors.61" connectsTo="//@regions.3/@elements.322" length="749"/>
    <elements xsi:type="railway:Segment" id="609" monitoredBy="//@regions.3/@sensors.61" connectsTo="//@regions.3/@elements.323" length="569"/>
    <elements xsi:type="railway:Segment" id="610" monitoredBy="//@regions.3/@sensors.61" connectsTo="//@regions.3/@elements.324" length="934"/>
    <elements xsi:type="railway:Segment" id="612" monitoredBy="//@regions.3/@sensors.62" connectsTo="//@regions.3/@elements.325" length="971"/>
    <elements xsi:type="railway:Segment" id="613" monitoredBy="//@regions.3/@sensors.62" connectsTo="//@regions.3/@elements.326" length="904"/>
    <elements xsi:type="railway:Segment" id="614" monitoredBy="//@regions.3/@sensors.62" connectsTo="//@regions.3/@elements.327" length="593"/>
    <elements xsi:type="railway:Segment" id="615" monitoredBy="//@regions.3/@sensors.62" connectsTo="//@regions.3/@elements.328" length="571"/>
    <elements xsi:type="railway:Segment" id="616" monitoredBy="//@regions.3/@sensors.62" connectsTo="//@regions.4/@elements.0" length="358"/>
  </regions>
  <regions id="619">
    <sensors id="621" monitors="//@regions.4/@elements.0 //@regions.4/@elements.1 //@regions.4/@elements.2 //@regions.4/@elements.3 //@regions.4/@elements.4 //@regions.4/@elements.5"/>
    <sensors id="629" monitors="//@regions.4/@elements.6 //@regions.4/@elements.7 //@regions.4/@elements.8 //@regions.4/@elements.9 //@regions.4/@elements.10 //@regions.4/@elements.11"/>
    <sensors id="635" monitors="//@regions.4/@elements.6 //@regions.4/@elements.12 //@regions.4/@elements.13 //@regions.4/@elements.14 //@regions.4/@elements.15 //@regions.4/@elements.16"/>
    <sensors id="641" monitors="//@regions.4/@elements.6 //@regions.4/@elements.17 //@regions.4/@elements.18 //@regions.4/@elements.19 //@regions.4/@elements.20 //@regions.4/@elements.21"/>
    <sensors id="647" monitors="//@regions.4/@elements.6 //@regions.4/@elements.22 //@regions.4/@elements.23 //@regions.4/@elements.24 //@regions.4/@elements.25 //@regions.4/@elements.26"/>
    <sensors id="653" monitors="//@regions.4/@elements.6 //@regions.4/@elements.27 //@regions.4/@elements.28 //@regions.4/@elements.29 //@regions.4/@elements.30 //@regions.4/@elements.31"/>
    <sensors id="659" monitors="//@regions.4/@elements.6 //@regions.4/@elements.32 //@regions.4/@elements.33 //@regions.4/@elements.34 //@regions.4/@elements.35 //@regions.4/@elements.36"/>
    <sensors id="665" monitors="//@regions.4/@elements.6 //@regions.4/@elements.37 //@regions.4/@elements.38 //@regions.4/@elements.39 //@regions.4/@elements.40 //@regions.4/@elements.41"/>
    <sensors id="673" monitors="//@regions.4/@elements.42 //@regions.4/@elements.43 //@regions.4/@elements.44 //@regions.4/@elements.45 //@regions.4/@elements.46 //@regions.4/@elements.47"/>
    <sensors id="679" monitors="//@regions.4/@elements.42 //@regions.4/@elements.48 //@regions.4/@elements.49 //@regions.4/@elements.50 //@regions.4/@elements.51 //@regions.4/@elements.52"/>
    <sensors id="685" monitors="//@regions.4/@elements.42 //@regions.4/@elements.53 //@regions.4/@elements.54 //@regions.4/@elements.55 //@regions.4/@elements.56 //@regions.4/@elements.57"/>
    <sensors id="693" monitors="//@regions.4/@elements.58 //@regions.4/@elements.59 //@regions.4/@elements.60 //@regions.4/@elements.61 //@regions.4/@elements.62 //@regions.4/@elements.63"/>
    <sensors id="699" monitors="//@regions.4/@elements.58 //@regions.4/@elements.64 //@regions.4/@elements.65 //@regions.4/@elements.66 //@regions.4/@elements.67 //@regions.4/@elements.68"/>
    <sensors id="705" monitors="//@regions.4/@elements.58 //@regions.4/@elements.69 //@regions.4/@elements.70 //@regions.4/@elements.71 //@regions.4/@elements.72 //@regions.4/@elements.73"/>
    <sensors id="711" monitors="//@regions.4/@elements.58 //@regions.4/@elements.74 //@regions.4/@elements.75 //@regions.4/@elements.76 //@regions.4/@elements.77 //@regions.4/@elements.78"/>
    <sensors id="717" monitors="//@regions.4/@elements.58 //@regions.4/@elements.79 //@regions.4/@elements.80 //@regions.4/@elements.81 //@regions.4/@elements.82 //@regions.4/@elements.83"/>
    <sensors id="723" monitors="//@regions.4/@elements.58 //@regions.4/@elements.84 //@regions.4/@elements.85 //@regions.4/@elements.86 //@regions.4/@elements.87 //@regions.4/@elements.88"/>
    <sensors id="731" monitors="//@regions.4/@elements.89 //@regions.4/@elements.90 //@regions.4/@elements.91 //@regions.4/@elements.92 //@regions.4/@elements.93 //@regions.4/@elements.94"/>
    <elements xsi:type="railway:Switch" id="620" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.1" positions="//@routes.4/@follows.0"/>
    <elements xsi:type="railway:Segment" id="622" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.2" length="787">
      <semaphores id="1" signal="GO"/>
    </elements>
    <elements xsi:type="railway:Segment" id="623" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.3" length="673"/>
    <elements xsi:type="railway:Segment" id="624" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.4" length="35"/>
    <elements xsi:type="railway:Segment" id="625" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.5" length="969"/>
    <elements xsi:type="railway:Segment" id="626" monitoredBy="//@regions.4/@sensors.0" connectsTo="//@regions.4/@elements.6" length="718"/>
    <elements xsi:type="railway:Switch" id="628" monitoredBy="//@regions.4/@sensors.1 //@regions.4/@sensors.2 //@regions.4/@sensors.3 //@regions.4/@sensors.4 //@regions.4/@sensors.5 //@regions.4/@sensors.6 //@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.7" positions="//@routes.4/@follows.1"/>
    <elements xsi:type="railway:Segment" id="630" monitoredBy="//@regions.4/@sensors.1" connectsTo="//@regions.4/@elements.8" length="421"/>
    <elements xsi:type="railway:Segment" id="631" monitoredBy="//@regions.4/@sensors.1" connectsTo="//@regions.4/@elements.9" length="307"/>
    <elements xsi:type="railway:Segment" id="632" monitoredBy="//@regions.4/@sensors.1" connectsTo="//@regions.4/@elements.10" length="514"/>
    <elements xsi:type="railway:Segment" id="633" monitoredBy="//@regions.4/@sensors.1" connectsTo="//@regions.4/@elements.11" length="161"/>
    <elements xsi:type="railway:Segment" id="634" monitoredBy="//@regions.4/@sensors.1" connectsTo="//@regions.4/@elements.12" length="530"/>
    <elements xsi:type="railway:Segment" id="636" monitoredBy="//@regions.4/@sensors.2" connectsTo="//@regions.4/@elements.13" length="1000"/>
    <elements xsi:type="railway:Segment" id="637" monitoredBy="//@regions.4/@sensors.2" connectsTo="//@regions.4/@elements.14" length="686"/>
    <elements xsi:type="railway:Segment" id="638" monitoredBy="//@regions.4/@sensors.2" connectsTo="//@regions.4/@elements.15" length="534"/>
    <elements xsi:type="railway:Segment" id="639" monitoredBy="//@regions.4/@sensors.2" connectsTo="//@regions.4/@elements.16" length="858"/>
    <elements xsi:type="railway:Segment" id="640" monitoredBy="//@regions.4/@sensors.2" connectsTo="//@regions.4/@elements.17" length="520"/>
    <elements xsi:type="railway:Segment" id="642" monitoredBy="//@regions.4/@sensors.3" connectsTo="//@regions.4/@elements.18" length="909"/>
    <elements xsi:type="railway:Segment" id="643" monitoredBy="//@regions.4/@sensors.3" connectsTo="//@regions.4/@elements.19" length="664"/>
    <elements xsi:type="railway:Segment" id="644" monitoredBy="//@regions.4/@sensors.3" connectsTo="//@regions.4/@elements.20" length="750"/>
    <elements xsi:type="railway:Segment" id="645" monitoredBy="//@regions.4/@sensors.3" connectsTo="//@regions.4/@elements.21" length="944"/>
    <elements xsi:type="railway:Segment" id="646" monitoredBy="//@regions.4/@sensors.3" connectsTo="//@regions.4/@elements.22" length="200"/>
    <elements xsi:type="railway:Segment" id="648" monitoredBy="//@regions.4/@sensors.4" connectsTo="//@regions.4/@elements.23" length="895"/>
    <elements xsi:type="railway:Segment" id="649" monitoredBy="//@regions.4/@sensors.4" connectsTo="//@regions.4/@elements.24" length="79"/>
    <elements xsi:type="railway:Segment" id="650" monitoredBy="//@regions.4/@sensors.4" connectsTo="//@regions.4/@elements.25" length="214"/>
    <elements xsi:type="railway:Segment" id="651" monitoredBy="//@regions.4/@sensors.4" connectsTo="//@regions.4/@elements.26" length="135"/>
    <elements xsi:type="railway:Segment" id="652" monitoredBy="//@regions.4/@sensors.4" connectsTo="//@regions.4/@elements.27" length="345"/>
    <elements xsi:type="railway:Segment" id="654" monitoredBy="//@regions.4/@sensors.5" connectsTo="//@regions.4/@elements.28" length="493"/>
    <elements xsi:type="railway:Segment" id="655" monitoredBy="//@regions.4/@sensors.5" connectsTo="//@regions.4/@elements.29" length="922"/>
    <elements xsi:type="railway:Segment" id="656" monitoredBy="//@regions.4/@sensors.5" connectsTo="//@regions.4/@elements.30" length="943"/>
    <elements xsi:type="railway:Segment" id="657" monitoredBy="//@regions.4/@sensors.5" connectsTo="//@regions.4/@elements.31" length="639"/>
    <elements xsi:type="railway:Segment" id="658" monitoredBy="//@regions.4/@sensors.5" connectsTo="//@regions.4/@elements.32" length="168"/>
    <elements xsi:type="railway:Segment" id="660" monitoredBy="//@regions.4/@sensors.6" connectsTo="//@regions.4/@elements.33" length="758"/>
    <elements xsi:type="railway:Segment" id="661" monitoredBy="//@regions.4/@sensors.6" connectsTo="//@regions.4/@elements.34" length="432"/>
    <elements xsi:type="railway:Segment" id="662" monitoredBy="//@regions.4/@sensors.6" connectsTo="//@regions.4/@elements.35" length="89"/>
    <elements xsi:type="railway:Segment" id="663" monitoredBy="//@regions.4/@sensors.6" connectsTo="//@regions.4/@elements.36" length="589"/>
    <elements xsi:type="railway:Segment" id="664" monitoredBy="//@regions.4/@sensors.6" connectsTo="//@regions.4/@elements.37" length="135"/>
    <elements xsi:type="railway:Segment" id="666" monitoredBy="//@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.38" length="533"/>
    <elements xsi:type="railway:Segment" id="667" monitoredBy="//@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.39" length="735"/>
    <elements xsi:type="railway:Segment" id="668" monitoredBy="//@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.40" length="632"/>
    <elements xsi:type="railway:Segment" id="669" monitoredBy="//@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.41" length="342"/>
    <elements xsi:type="railway:Segment" id="670" monitoredBy="//@regions.4/@sensors.7" connectsTo="//@regions.4/@elements.42" length="469"/>
    <elements xsi:type="railway:Switch" id="672" monitoredBy="//@regions.4/@sensors.8 //@regions.4/@sensors.9 //@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.43" currentPosition="DIVERGING" positions="//@routes.4/@follows.2"/>
    <elements xsi:type="railway:Segment" id="674" monitoredBy="//@regions.4/@sensors.8" connectsTo="//@regions.4/@elements.44" length="29"/>
    <elements xsi:type="railway:Segment" id="675" monitoredBy="//@regions.4/@sensors.8" connectsTo="//@regions.4/@elements.45" length="576"/>
    <elements xsi:type="railway:Segment" id="676" monitoredBy="//@regions.4/@sensors.8" connectsTo="//@regions.4/@elements.46" length="320"/>
    <elements xsi:type="railway:Segment" id="677" monitoredBy="//@regions.4/@sensors.8" connectsTo="//@regions.4/@elements.47" length="78"/>
    <elements xsi:type="railway:Segment" id="678" monitoredBy="//@regions.4/@sensors.8" connectsTo="//@regions.4/@elements.48" length="225"/>
    <elements xsi:type="railway:Segment" id="680" monitoredBy="//@regions.4/@sensors.9" connectsTo="//@regions.4/@elements.49" length="56"/>
    <elements xsi:type="railway:Segment" id="681" monitoredBy="//@regions.4/@sensors.9" connectsTo="//@regions.4/@elements.50" length="966"/>
    <elements xsi:type="railway:Segment" id="682" monitoredBy="//@regions.4/@sensors.9" connectsTo="//@regions.4/@elements.51" length="161"/>
    <elements xsi:type="railway:Segment" id="683" monitoredBy="//@regions.4/@sensors.9" connectsTo="//@regions.4/@elements.52" length="517"/>
    <elements xsi:type="railway:Segment" id="684" monitoredBy="//@regions.4/@sensors.9" connectsTo="//@regions.4/@elements.53" length="145"/>
    <elements xsi:type="railway:Segment" id="686" monitoredBy="//@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.54" length="778"/>
    <elements xsi:type="railway:Segment" id="687" monitoredBy="//@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.55" length="904"/>
    <elements xsi:type="railway:Segment" id="688" monitoredBy="//@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.56" length="467"/>
    <elements xsi:type="railway:Segment" id="689" monitoredBy="//@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.57" length="53"/>
    <elements xsi:type="railway:Segment" id="690" monitoredBy="//@regions.4/@sensors.10" connectsTo="//@regions.4/@elements.58" length="367"/>
    <elements xsi:type="railway:Switch" id="692" monitoredBy="//@regions.4/@sensors.11 //@regions.4/@sensors.12 //@regions.4/@sensors.13 //@regions.4/@sensors.14 //@regions.4/@sensors.15 //@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.59" currentPosition="DIVERGING" positions="//@routes.4/@follows.3"/>
    <elements xsi:type="railway:Segment" id="694" monitoredBy="//@regions.4/@sensors.11" connectsTo="//@regions.4/@elements.60" length="916"/>
    <elements xsi:type="railway:Segment" id="695" monitoredBy="//@regions.4/@sensors.11" connectsTo="//@regions.4/@elements.61" length="522"/>
    <elements xsi:type="railway:Segment" id="696" monitoredBy="//@regions.4/@sensors.11" connectsTo="//@regions.4/@elements.62" length="182"/>
    <elements xsi:type="railway:Segment" id="697" monitoredBy="//@regions.4/@sensors.11" connectsTo="//@regions.4/@elements.63" length="579"/>
    <elements xsi:type="railway:Segment" id="698" monitoredBy="//@regions.4/@sensors.11" connectsTo="//@regions.4/@elements.64" length="972"/>
    <elements xsi:type="railway:Segment" id="700" monitoredBy="//@regions.4/@sensors.12" connectsTo="//@regions.4/@elements.65" length="940"/>
    <elements xsi:type="railway:Segment" id="701" monitoredBy="//@regions.4/@sensors.12" connectsTo="//@regions.4/@elements.66" length="349"/>
    <elements xsi:type="railway:Segment" id="702" monitoredBy="//@regions.4/@sensors.12" connectsTo="//@regions.4/@elements.67" length="900"/>
    <elements xsi:type="railway:Segment" id="703" monitoredBy="//@regions.4/@sensors.12" connectsTo="//@regions.4/@elements.68" length="695"/>
    <elements xsi:type="railway:Segment" id="704" monitoredBy="//@regions.4/@sensors.12" connectsTo="//@regions.4/@elements.69" length="449"/>
    <elements xsi:type="railway:Segment" id="706" monitoredBy="//@regions.4/@sensors.13" connectsTo="//@regions.4/@elements.70" length="223"/>
    <elements xsi:type="railway:Segment" id="707" monitoredBy="//@regions.4/@sensors.13" connectsTo="//@regions.4/@elements.71" length="51"/>
    <elements xsi:type="railway:Segment" id="708" monitoredBy="//@regions.4/@sensors.13" connectsTo="//@regions.4/@elements.72" length="163"/>
    <elements xsi:type="railway:Segment" id="709" monitoredBy="//@regions.4/@sensors.13" connectsTo="//@regions.4/@elements.73" length="332"/>
    <elements xsi:type="railway:Segment" id="710" monitoredBy="//@regions.4/@sensors.13" connectsTo="//@regions.4/@elements.74" length="81"/>
    <elements xsi:type="railway:Segment" id="712" monitoredBy="//@regions.4/@sensors.14" connectsTo="//@regions.4/@elements.75" length="282"/>
    <elements xsi:type="railway:Segment" id="713" monitoredBy="//@regions.4/@sensors.14" connectsTo="//@regions.4/@elements.76" length="510"/>
    <elements xsi:type="railway:Segment" id="714" monitoredBy="//@regions.4/@sensors.14" connectsTo="//@regions.4/@elements.77" length="983"/>
    <elements xsi:type="railway:Segment" id="715" monitoredBy="//@regions.4/@sensors.14" connectsTo="//@regions.4/@elements.78" length="941"/>
    <elements xsi:type="railway:Segment" id="716" monitoredBy="//@regions.4/@sensors.14" connectsTo="//@regions.4/@elements.79" length="78"/>
    <elements xsi:type="railway:Segment" id="718" monitoredBy="//@regions.4/@sensors.15" connectsTo="//@regions.4/@elements.80" length="777"/>
    <elements xsi:type="railway:Segment" id="719" monitoredBy="//@regions.4/@sensors.15" connectsTo="//@regions.4/@elements.81" length="229"/>
    <elements xsi:type="railway:Segment" id="720" monitoredBy="//@regions.4/@sensors.15" connectsTo="//@regions.4/@elements.82" length="997"/>
    <elements xsi:type="railway:Segment" id="721" monitoredBy="//@regions.4/@sensors.15" connectsTo="//@regions.4/@elements.83" length="137"/>
    <elements xsi:type="railway:Segment" id="722" monitoredBy="//@regions.4/@sensors.15" connectsTo="//@regions.4/@elements.84" length="596"/>
    <elements xsi:type="railway:Segment" id="724" monitoredBy="//@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.85" length="916"/>
    <elements xsi:type="railway:Segment" id="725" monitoredBy="//@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.86" length="331"/>
    <elements xsi:type="railway:Segment" id="726" monitoredBy="//@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.87" length="407"/>
    <elements xsi:type="railway:Segment" id="727" monitoredBy="//@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.88" length="500"/>
    <elements xsi:type="railway:Segment" id="728" monitoredBy="//@regions.4/@sensors.16" connectsTo="//@regions.4/@elements.89" length="54"/>
    <elements xsi:type="railway:Switch" id="730" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.4/@elements.90" positions="//@routes.4/@follows.4"/>
    <elements xsi:type="railway:Segment" id="732" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.4/@elements.91" length="683"/>
    <elements xsi:type="railway:Segment" id="733" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.4/@elements.92" length="50"/>
    <elements xsi:type="railway:Segment" id="734" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.4/@elements.93" length="633"/>
    <elements xsi:type="railway:Segment" id="735" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.4/@elements.94" length="578"/>
    <elements xsi:type="railway:Segment" id="736" monitoredBy="//@regions.4/@sensors.17" connectsTo="//@regions.0/@elements.0" length="456"/>
  </regions>
</railway:RailwayContainer>

Multiplicity in EParameter

Hi,

I'm currently using the EParameter class of the pyecore library. I saw that this is a derived class of the ETypedElement class in which one has the option to determine a value for the upper/lower index.
As far as I've seen, this is not possible in the definition of an EParameter directly, e.g. like

p = Ecore.EParameter('p', eType= Ecore.EInt, required= True, lower = 0, upper = 5)

Are there any other possiblities to specify the multiplicity directly or would it be better to use Ecore.EList as the parameter type?

Thank you in advance!

Metamodel dynamic extend error

@aranega
I import an python lib which is generated by pyecore, then I want to extend an attribute to one EClass, it added successfully, however, it didn't add to class object actually. I use a simple test cast like this:

Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyecore.ecore import *
>>> import cofluent
>>> a = cofluent.TESTCLASS()
>>> dir(a)
['content']
>>> a.content
>>> cofluent.TESTCLASS.eClass.eStructuralFeatures.append(EAttribute('name', EString, default_value='new_name'))
>>> dir(a)
['content', 'name']
>>> a.content
>>> a.name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'TESTCLASS' object has no attribute 'name'
>>>

did I use it in a wrong way or how do I fix this?

xmi buffer out of sync issue

Hi aranega,
I met the buffer out of sync issue from time to time when saving multiple files through pyecore's xmi api.
As an example, if I write two files down at the end of a program. Only the first one get its content flushed to the disk.
I tried to add flush() call to URI.close_stream() through a monkey patch, which is safe. But it can't fix that. I have to make the flush call write after the Element.write in XMI.save(). XMI.save() contains logic which you might change from version to version and I don't want to break it with a monkey patch.
So I made a very simple pull request. Please kindly review it and see if you could accept it.
THanks!
-Andy

How to read the contents of an imported model

Hello, I've been reading the documentation and it's not clear to me how to import an existing model.

I want to import the model and be able to read each of its components, but in the documentation it only appears how to rescue the main node and add, not read its contents.

How could I do this?

Thank you very much for your help

pyecore's eorderset can't work under ordered-set 3.0.0

@aranega
It might be a regression.
ordered-set 3.0.0 change the slicing implementation
from

               return OrderSet(result) #2.0.2

to

               return self.__class__(result) # 3.0.0

and the slicing will return EOrderedSet with empty items.
for

              Node.children[1:]

Could you give a check ?

json resource runtime error: dictionary changed size during iteration

hello @aranega

I'm getting the error:

  File "/env/lib/python3.5/site-packages/pyecore/resources/resource.py", line 84, in get_resource
    resource.load(options=options)
  File "/env/lib/python3.5/site-packages/pyecore/resources/json.py", line 35, in load
    for inst, refs in self._load_href.items():
RuntimeError: dictionary changed size during iteration

From what I can tell, this only happens in Python 3.x because of how Python 3 iterates through a dictionary (by iterator instead of making a copy of the keys).

From what I can tell, the offending code is at line 166

self._load_href[inst] = ereferences

which is part of the function to_obj which can be called in the function process_inst which is called for each iteration over self._load_href:

for inst, refs in self._load_href.items():
    self.process_inst(inst, refs)

I've changed the iteration to the following (and it appears to be working):

for inst in list(self._load_href.keys()):
    refs = self._load_href[inst]
    self.process_inst(inst, refs)

However, I don't fully understand the process here so this might be a bad fix.

Thanks,

Inheritance in PyEcore

Hi @aranega

I'm experimenting with inheritance and behaviour in PyEcore.
I'm trying to create subtype of a certain class by doing:

CommercialBuildingMetaClass = EClass('CommercialBuilding', superclass=(esdl.Building.eClass))
CommercialBuilding = CommercialBuildingMetaClass(name = 'CommercialBuilding')
c = CommercialBuilding('A CommercialBuilding')

So CommercialBuilding should be a subclass of Building, but it does not inherit its attributes, nor the EOperations. If i print the attributes of c it only shows the name attribute, not the inherited ones.
If i add behavior to the esdl.Building class, it also does not get inherited to the subclass.
E.g.:

esdl.Building.eOperations.append(EOperation(name='test'))
@esdl.Building.behavior
def test(self):
    print('Hi {}'.format(self.name))
...
b = esdl.Building('A Building')
b.test() # prints "Hi A Building"
c.test() # Throws an error

What am I doing wrong? How should inheritance work in PyEcore?

Enums in DynamicEPackage

I'm trying to assign an enum literal to a variable as follows:

... #load meta model, etc.
esdl = DynamicEPackage(esdl_model)

windturbine = esdl.WindTurbine(type=esdl.WindTurbineEnumType.WIND_ON_LAND)

This doesn't work, it says that AttributeError: 'EEnum' object has no attribute 'WIND_ON_LAND'
If I do the following it works:

windturbine = esdl.WindTurbine(type=esdl.WindTurbineEnumType.from_string('WIND_ON_LAND'))

But this is for developers more error prone.
In the static version, where classes are first generated, assigning it directly using the (name of the) literal works. Is this by intention? Reading the code of EEnum.__init___ it reads:

self.__setattr__(lit_name, literal)

So that should work, right?

PyEcore's XMI serialization of EDate is not compatible with EMF

Hi,

we have a C++ application (using emf4cpp) which interacts with models generated using PyEcore.
Unfortunately, when trying to open such an XMI we get errror mesages like
Could not parse date string '2019-01-28 17:28:30.075312'.

The same would happen when reading such a model in Java:
According to org.eclipse.emf.ecore.impl.EFactoryImpl the following serialization formats are supported by EMF:

protected static final DateFormat [] EDATE_FORMATS =
{
new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSSZ"),
new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS"),
new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"),
new SafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm"),
new SafeSimpleDateFormat("yyyy-MM-dd")
};

In the XMI generated from Python attributes of type EDate get serialized in a format '%Y-%m-%d %H:%M:%S.%f'. Note that this lacks the 'T' between date and time which the supported formats expect.

A related issue is that instantiating pyecore.ecore.EDate (which internally is mapped to a datetime.datetime) from an ISO time is currently not possible:

date = EDate.from_string( datetime.now().isoformat() )
ValueError: time data '2019-01-29T09:50:55.370908' does not match format '%Y-%m-%d %H:%M:%S.%f'

Thanks in advance

Generated ipxact api does not work

Hi,
I want use pyecore to generate python ipxact library. I created a ipxact ecore by using EMF and ipxact schema, then i use pyecore to generate python codes. Finally, i found the codes can't parse a ipxact model file.

Using multiple resources in a ResourceSet gives invalid output

I'm experimenting with StringURI to get an intermediate string representation of a resource and run into a problem when serializing to disk.

I do the following:

  1. I load an existing XML resource from file.
  2. I want to store this as a String resource (using the documented StringURI). I get a valid representation as a string in python.
  3. I do a resource.save() on the file resource loaded in (1). I get invalid output.
  4. If I create a new file resource I get valid output again.

Somehow the string resource saving corrupts the original one when it comes to references.

This is what I input:

      <asset xsi:type="esdl:ElectricityDemand" id="e_demand_1" name="E demand">
        <port xsi:type="esdl:InPort" id="InPort1" connectedTo="OutPort1"/>
      </asset>

This is what i get:

      <asset xsi:type="esdl:ElectricityDemand" name="E demand" id="e_demand_1">
        <port xsi:type="esdl:InPort" id="InPort1">
          <connectedTo href="anyname#OutPort1" xsi:type="esdl:OutPort"/>
        </port>
      </asset>

My String URI was named anyname

Any clues?

Note: I adapted the StringURI to use io.BytesIO instead of io.StringIO, as lxml compained about bytes in Python 3.7

How to validate a imported ecore file

Hi, I'm importing an ecore file which consists on one class and two attributes with the same name.
Is there any way to validate the metamodel and get which errors are present?

deserialize UTC datetime string to EDate

hello aranega,

I'm not sure of the property way to use pyecore to deserialize datetime values from an XMI resource. I constructed an XMI resource using an ecore metamodel and set an attribute to datetime.utcnow(). the resource serialized without issue using resource.save() but upon loading the resource using create_resource I get the following error:

>>> resource = rset.get_resource(URI(inFilePath))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/env/lib/python3.5/site-packages/pyecore/resources/resource.py", line 82, in get_resource
    resource.load(options=options)
  File "/env/lib/python3.5/site-packages/pyecore/resources/xmi.py", line 46, in load
    modelroot = self._init_modelroot(root)
  File "/env/lib/python3.5/site-packages/pyecore/resources/xmi.py", line 113, in _init_modelroot
    self._decode_eattribute_value(modelroot, feature, value)
  File "/env/lib/python3.5/site-packages/pyecore/resources/xmi.py", line 128, in _decode_eattribute_value
    eobject.__setattr__(eattribute.name, val)
  File "/env/lib/python3.5/site-packages/pyecore/ecore.py", line 582, in __set__
    instance_dict[name]._set(value)
  File "/env/lib/python3.5/site-packages/pyecore/valuecontainer.py", line 73, in _set
    self.check(value)
  File "/env/lib/python3.5/site-packages/pyecore/valuecontainer.py", line 46, in check
    raise BadValueError(value, self.feature.eType)
pyecore.valuecontainer.BadValueError: Expected type <pyecore.ecore.EProxy object at 0x10d5c0048>, but got type str with value 2018-06-05 16:15:47.290839 instead

myMetamodel.ecore

...
<eStructuralFeatures xsi:type="ecore:EAttribute" 
    name="documentRevisionDate" 
    eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
...

mySerializeData.xmi

... 
documentRevisionDate="2018-06-05 16:15:47.290839"
...

It also failed to deserialize using a timestamp and timestamp string. please help me understand the property way to serialize/deserialze datetime values.

Thanks for this amazing project,

Coverity Scan

Hi Vincent @aranega
Do you have a plan to register pyecore at https://scan.coverity.com ? The static scan tool is free for open source project and should be helpful to reduce the security risk due to small code error.
I have done some offline scan for pyecore with open source tool from redhat. But a scan report from coverity will always greatly uplift the security reputation of opensource project.This is just a soft suggestion. Again, thank a lot for the contribtion on this project!
-Andy

TypeError for containers

Hi,

I tried the to run the code from the quickstart:

from pyecore.ecore import EClass, EReference

A = EClass('A')
A.eStructuralFeatures.append(EReference('cont1', containment=True, upper=-1))

a1 = A()
a2 = A()
a1.cont1.append(a2)

But I get the following error:

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Program Files\Python36\lib\site-packages\pyecore\valuecontainer.py", line 290, in append
    self.add(value, update_opposite)
  File "C:\Program Files\Python36\lib\site-packages\pyecore\valuecontainer.py", line 293, in add
    self.check(value)
  File "C:\Program Files\Python36\lib\site-packages\pyecore\valuecontainer.py", line 46, in check
    if not EcoreUtils.isinstance(value, self.feature.eType):
  File "C:\Program Files\Python36\lib\site-packages\pyecore\valuecontainer.py", line 21, in isinstance
    elif isinstance(obj, _type):
TypeError: isinstance() arg 2 must be a type or tuple of types

Sebastian

use pyecore to generate the notation model

I want to use pyecore to manipulate the notation model.
I use pyecoregen to get the notation.py from standard notation.ecore. After that, I can't use the generated class to define a notation file and. Would it be possible for you to add a tutorial about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.