Networks in three formats
All networks that we have – currently 17 – are available now in three format on the networks page. GraphML, XGMML and JSON are available. They originate from the same source – the Cytoscape-editor. They then are exported as XGMML. This then is normalized to remove lots of irrelevant things stored by Cytoscape. We then use XSLT transformation to both GraphML and JSON.
The nomalizer script is
<?xml version="1.0"?> <!-- xgmml namespace necessary --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xgmml="http://www.cs.rpi.edu/XGMML" > <!-- override default to avoid blank lines --> <xsl:template match="text()"/> <!-- copy the graph element --> <xsl:template match="xgmml:graph"> <xsl:copy> <!-- copy directed attribute, since default is 0 --> <xsl:copy-of select="@directed"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- process nodes --> <xsl:template match="xgmml:node"> <xsl:copy select="."> <!-- copy id attribute --> <xsl:copy-of select="@id"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from nodes copy name and type xgmml attributes --> <xsl:template match="xgmml:node/xgmml:att[attribute::name='name' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> <!-- process edges --> <xsl:template match="xgmml:edge"> <xsl:copy select="."> <!-- copy source and target attributes --> <xsl:copy-of select="@source|@target"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from edges copy amount and type attributes --> <xsl:template match="xgmml:edge/xgmml:att[attribute::name='amount' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
The converter xgmml2graphml.xslt is
<?xml version="1.0"?> <!-- xgmml namespace necessary --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xgmml="http://www.cs.rpi.edu/XGMML" > <!-- override default to avoid blank lines --> <xsl:template match="text()"/> <!-- copy the graph element --> <xsl:template match="xgmml:graph"> <xsl:copy> <!-- copy directed attribute, since default is 0 --> <xsl:copy-of select="@directed"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- process nodes --> <xsl:template match="xgmml:node"> <xsl:copy select="."> <!-- copy id attribute --> <xsl:copy-of select="@id"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from nodes copy name and type xgmml attributes --> <xsl:template match="xgmml:node/xgmml:att[attribute::name='name' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> <!-- process edges --> <xsl:template match="xgmml:edge"> <xsl:copy select="."> <!-- copy source and target attributes --> <xsl:copy-of select="@source|@target"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from edges copy amount and type attributes --> <xsl:template match="xgmml:edge/xgmml:att[attribute::name='amount' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
The converter xgmml2json.xslt is
<?xml version="1.0"?> <!-- xgmml namespace necessary --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xgmml="http://www.cs.rpi.edu/XGMML" > <!-- override default to avoid blank lines --> <xsl:template match="text()"/> <!-- copy the graph element --> <xsl:template match="xgmml:graph"> <xsl:copy> <!-- copy directed attribute, since default is 0 --> <xsl:copy-of select="@directed"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- process nodes --> <xsl:template match="xgmml:node"> <xsl:copy select="."> <!-- copy id attribute --> <xsl:copy-of select="@id"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from nodes copy name and type xgmml attributes --> <xsl:template match="xgmml:node/xgmml:att[attribute::name='name' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> <!-- process edges --> <xsl:template match="xgmml:edge"> <xsl:copy select="."> <!-- copy source and target attributes --> <xsl:copy-of select="@source|@target"/> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:copy> <xsl:text> </xsl:text> </xsl:template> <!-- from edges copy amount and type attributes --> <xsl:template match="xgmml:edge/xgmml:att[attribute::name='amount' or attribute::name='type']"> <xsl:copy-of select="."/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>