Opened 8 years ago

Last modified 6 years ago

#11092 new Bugs

Boost write_graphml writes non-conformant GraphML for boolean attributes

Reported by: freedesktop@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

Boolean attributes are serialized as 0 and 1. They should be written as "false" and "true" instead.

The GraphML spec does not specify what values are acceptable, but according to the GraphML primer, "The type of the GraphML-Attribute can be either boolean, int, long, float, double, or string. These types are defined like the corresponding types in the Java(TM)-Programming language.".

In source code, Java would allow only "true" and "false" for boolean values. If we add any representation that Java's Boolean.parseString() recognizes, the case wouldn't matter, but "1" still wouldn't parse as true.

Other libraries like NetworkX fail to parse GraphML with boolean attributes written by Boost. See also https : github.com / networkx / networkx / pull / 1063.

Change History (2)

comment:1 by freedesktop@…, 8 years ago

Correction: Boolean.parseString() => Boolean.parseBoolean()

comment:2 by anonymous, 6 years ago

This also affects the TinkerPop/Gremlin graph packages -- it cannot serialize graphMLs written by boost, because Boolean.valueOf("1") == false.

Note: See TracTickets for help on using tickets.