Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing Default Graphics Values for GPML2021 #8

Open
Finterly opened this issue Jul 23, 2021 · 5 comments
Open

Writing Default Graphics Values for GPML2021 #8

Finterly opened this issue Jul 23, 2021 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@Finterly
Copy link
Contributor

Finterly commented Jul 23, 2021

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

@Finterly Finterly added the question Further information is requested label Jul 23, 2021
@Finterly Finterly self-assigned this Jul 23, 2021
@Finterly Finterly changed the title GPML2021 Writing Default Graphics Values Writing Default Graphics Values for GPML2021 Jul 23, 2021
@egonw
Copy link
Collaborator

egonw commented Jul 25, 2021

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?

@Finterly
Copy link
Contributor Author

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

@ariutta
Copy link

ariutta commented Jul 28, 2021

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?

@egonw
Copy link
Collaborator

egonw commented Jul 28, 2021

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.

@ariutta
Copy link

ariutta commented Jul 28, 2021

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
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants