-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing Default Graphics Values for GPML2021 #8
Comments
Assuming the defaults are in the XML Schema, that sounds good to me. What will the behavior be? The Java model will be populates with all default values, but when you save it will never output default values? |
When writing, attributes with default values will not be written. When reading, java model will populate with default value if an attribute is missing and has default value (attribute is not optional). |
As long as it's easy to get the default values elsewhere, it's probably fine to not explicitly include them. For deciding which attributes should have defaults, we could take a look at the existing pathways. If 99% of the time, an attribute has just one value, that would be a good candidate for using a default. (I said 99%, but maybe a lower percentage would be more appropriate.) @AlexanderPico said:
|
Yes, I guess we cannot expect JavaScript to parse the XML Schema XML. |
It is possible to parse XML using JavaScript (but obviously not as easy as JSON). If the defaults are simple, e.g., "all DataNodes by default use a rectangle shape," that would be fine. But trying to make JavaScript properly understand an XSD is harder. I'm not sure how to easily extract anything fancier than "DataNodes of Type 'Metabolite' by default use text color blue." (Except Alex suggested text color be explicitly specified.) |
@egonw @ariutta @AlexanderPico @mkutmon
Discussion: For GPML2021, do we want default values for Graphics to be always written?
Depending on the length of a gpml file and frequency with which it has default graphics value, the file size may be up to 25% smaller when default values are not repeatedly written. Example below:
All graphics properties written even if default value:
<Graphics centerX="781.1666666666678" centerY="796.0000000000002" width="47.66666666666658" height="25.0" textColor="000000" fontName="Arial" fontWeight="Normal" fontStyle="Normal" fontDecoration="Normal" fontStrikethru="Normal" fontSize="12" hAlign="Center" vAlign="Middle" borderColor="000000" borderStyle="Solid" borderWidth="1.0" fillColor="ffffff" shapeType="Rectangle" zOrder="32768" />
Graphics properties not written when default value:
<Graphics centerX="781.1666666666678" centerY="796.0000000000002" width="47.66666666666658" height="25.0" zOrder="32768" />
The text was updated successfully, but these errors were encountered: