Skip to content

Writing Default Graphics Values for GPML2021  #8

Open

Description

@Finterly

@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" />

Activity

  1. self-assigned this
    on Jul 23, 2021
  2. changed the title [-]GPML2021 Writing Default Graphics Values [/-] [+]Writing Default Graphics Values for GPML2021 [/+] on Jul 23, 2021
  3. egonw commented on Jul 25, 2021

    @egonw
    Collaborator

    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?

  4. Finterly commented on Jul 26, 2021

    @Finterly
    ContributorAuthor

    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).

  5. ariutta commented on Jul 28, 2021

    @ariutta

    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:

    My suggestion would be to provide defaults just for a few critical parameters like fill color, border color and text color, but leave the rest unspecified.
    Maybe we want (all?) the values used by Cytoscape to be explicitly specified?

  6. egonw commented on Jul 28, 2021

    @egonw
    Collaborator

    As long as it's easy to get the default values elsewhere, it's probably fine to not explicitly include them.

    Yes, I guess we cannot expect JavaScript to parse the XML Schema XML.

  7. ariutta commented on Jul 28, 2021

    @ariutta

    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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions