You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/04/07 19:53:48 UTC

[5/8] tinkerpop git commit: Added TP2-to-TP3 GraphML XSLT to resources

Added TP2-to-TP3 GraphML XSLT to resources


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2f90a7f7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2f90a7f7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2f90a7f7

Branch: refs/heads/TINKERPOP-1608
Commit: 2f90a7f7b5f41f0b4a819202cf5cc48373aef165
Parents: 7c99635
Author: Joshua Shinavier <jo...@fortytwo.net>
Authored: Fri Nov 18 12:08:00 2016 -0800
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 7 15:53:15 2017 -0400

----------------------------------------------------------------------
 .../src/main/resources/tp2-to-tp3-graphml.xslt  | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2f90a7f7/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt b/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
new file mode 100644
index 0000000..1944bcf
--- /dev/null
+++ b/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
@@ -0,0 +1,40 @@
+<?xml version="1.0" ?>
+<!-- XSL stylesheet to convert TinkerPop v2 GraphML files for Apache TinkerPop v3 -->
+<xsl:stylesheet version="1.0"
+                xmlns="http://graphml.graphdrawing.org/xmlns"
+                xmlns:graphml="http://graphml.graphdrawing.org/xmlns"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                exclude-result-prefixes="graphml">
+    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
+    <xsl:strip-space elements="*"/>
+
+    <xsl:template match="node()|@*">
+        <xsl:copy>
+            <xsl:apply-templates select="node()|@*"/>
+        </xsl:copy>
+    </xsl:template>
+
+    <xsl:template match="graphml:graphml">
+        <graphml>
+            <key id="labelV" for="node" attr.name="labelV" attr.type="string"/>
+            <key id="labelE" for="edge" attr.name="labelE" attr.type="string"/>
+            <xsl:apply-templates/>
+        </graphml>
+    </xsl:template>
+
+    <xsl:template match="graphml:node">
+        <node>
+            <xsl:apply-templates select="node()|@*"/>
+            <data key="labelV">vertex</data>
+        </node>
+    </xsl:template>
+
+    <xsl:template match="graphml:edge">
+        <edge id="{@id}" source="{@source}" target="{@target}">
+            <data key="labelE">
+                <xsl:value-of select="@label"/>
+            </data>
+        </edge>
+    </xsl:template>
+
+</xsl:stylesheet>