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/11 11:52:37 UTC

[1/7] tinkerpop git commit: TINKERPOP-1608 Added test for GraphML transform

Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 2436a69e9 -> e6826508d


TINKERPOP-1608 Added test for GraphML transform


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

Branch: refs/heads/tp32
Commit: 777747e6cdf8def87e4e51918027686cdb78f243
Parents: 2f90a7f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 6 09:41:29 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 7 15:53:15 2017 -0400

----------------------------------------------------------------------
 .../src/main/resources/tp2-to-tp3-graphml.xslt  | 19 +++++++
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 31 +++++++++++
 .../io/graphml/tinkerpop-classic-tp2.xml        | 54 ++++++++++++++++++++
 3 files changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/777747e6/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
index 1944bcf..40d553b 100644
--- a/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
+++ b/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
@@ -1,4 +1,22 @@
 <?xml version="1.0" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+
 <!-- XSL stylesheet to convert TinkerPop v2 GraphML files for Apache TinkerPop v3 -->
 <xsl:stylesheet version="1.0"
                 xmlns="http://graphml.graphdrawing.org/xmlns"
@@ -34,6 +52,7 @@
             <data key="labelE">
                 <xsl:value-of select="@label"/>
             </data>
+            <xsl:apply-templates select="node()|@*"/>
         </edge>
     </xsl:template>
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/777747e6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
index 428a0d8..2c13c2f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
@@ -55,6 +55,9 @@ import org.slf4j.LoggerFactory;
 
 import javax.xml.XMLConstants;
 import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
@@ -286,6 +289,34 @@ public class IoTest {
             assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices()));
             assertEquals(IteratorUtils.count(source.edges()), IteratorUtils.count(target.edges()));
         }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_LONG_VALUES)
+        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
+        @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
+        public void shouldTransformGraphMLV2ToV3ViaXSLT() throws Exception {
+            final InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");
+            final InputStream datafile = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "tinkerpop-classic-tp2.xml");
+            final ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+            final TransformerFactory tFactory = TransformerFactory.newInstance();
+            final StreamSource stylesource = new StreamSource(stylesheet);
+            final Transformer transformer = tFactory.newTransformer(stylesource);
+
+            final StreamSource source = new StreamSource(datafile);
+            final StreamResult result = new StreamResult(output);
+            transformer.transform(source, result);
+
+            final GraphReader reader = GraphMLReader.build().create();
+            reader.readGraph(new ByteArrayInputStream(output.toByteArray()), graph);
+            assertClassicGraph(graph, false, true);
+        }
     }
 
     public static final class GryoTest extends AbstractGremlinTest {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/777747e6/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphml/tinkerpop-classic-tp2.xml
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphml/tinkerpop-classic-tp2.xml b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphml/tinkerpop-classic-tp2.xml
new file mode 100644
index 0000000..b056732
--- /dev/null
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphml/tinkerpop-classic-tp2.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
+        http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
+    <key id="weight" for="edge" attr.name="weight" attr.type="float"/>
+    <key id="name" for="node" attr.name="name" attr.type="string"/>
+    <key id="age" for="node" attr.name="age" attr.type="int"/>
+    <key id="lang" for="node" attr.name="lang" attr.type="string"/>
+    <graph id="G" edgedefault="directed">
+        <node id="1">
+            <data key="name">marko</data>
+            <data key="age">29</data>
+        </node>
+        <node id="2">
+            <data key="name">vadas</data>
+            <data key="age">27</data>
+        </node>
+        <node id="3">
+            <data key="name">lop</data>
+            <data key="lang">java</data>
+        </node>
+        <node id="4">
+            <data key="name">josh</data>
+            <data key="age">32</data>
+        </node>
+        <node id="5">
+            <data key="name">ripple</data>
+            <data key="lang">java</data>
+        </node>
+        <node id="6">
+            <data key="name">peter</data>
+            <data key="age">35</data>
+        </node>
+        <edge id="7" source="1" target="2" label="knows">
+            <data key="weight">0.5</data>
+        </edge>
+        <edge id="8" source="1" target="4" label="knows">
+            <data key="weight">1.0</data>
+        </edge>
+        <edge id="9" source="1" target="3" label="created">
+            <data key="weight">0.4</data>
+        </edge>
+        <edge id="10" source="4" target="5" label="created">
+            <data key="weight">1.0</data>
+        </edge>
+        <edge id="11" source="4" target="3" label="created">
+            <data key="weight">0.4</data>
+        </edge>
+        <edge id="12" source="6" target="3" label="created">
+            <data key="weight">0.2</data>
+        </edge>
+    </graph>
+</graphml>
\ No newline at end of file


[4/7] tinkerpop git commit: TINKERPOP-1608 Cleaned up java source in docs a bit.

Posted by sp...@apache.org.
TINKERPOP-1608 Cleaned up java source in docs a bit.


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

Branch: refs/heads/tp32
Commit: c47fda69b0512b26ddf974d2a7043da14d9da49c
Parents: 7683bf9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 7 15:47:53 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 7 15:53:33 2017 -0400

----------------------------------------------------------------------
 docs/src/reference/the-graph.asciidoc | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c47fda69/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index 26ed778..09c11fa 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -451,23 +451,23 @@ specification that were corrected for 3.x. As a result, attempting to read a Gra
 
 [source,java]
 ----
-import javax.xml.parsers.DocumentBuilderFactory
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.dom.DOMSource
-import javax.xml.transform.stream.StreamSource
-import javax.xml.transform.stream.StreamResult
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.stream.StreamResult;
 
 InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");
-File datafile = new File('/tmp/tp2-graphml.xml')
-File outfile = new File('/tmp/tp3-graphml.xml')
+File datafile = new File('/tmp/tp2-graphml.xml');
+File outfile = new File('/tmp/tp3-graphml.xml');
 
-TransformerFactory tFactory = TransformerFactory.newInstance()
-StreamSource stylesource = new StreamSource(stylesheet)
-Transformer transformer = tFactory.newTransformer(stylesource)
+TransformerFactory tFactory = TransformerFactory.newInstance();
+StreamSource stylesource = new StreamSource(stylesheet);
+Transformer transformer = tFactory.newTransformer(stylesource);
 
-StreamSource source = new StreamSource(datafile)
-StreamResult result = new StreamResult(new FileWriter(outfile))
-transformer.transform(source, result)
+StreamSource source = new StreamSource(datafile);
+StreamResult result = new StreamResult(new FileWriter(outfile));
+transformer.transform(source, result);
 ----
 
 [[graphson-reader-writer]]


[3/7] tinkerpop git commit: TINKERPOP-1608 Cleaned up bad features on graphml xslt test

Posted by sp...@apache.org.
TINKERPOP-1608 Cleaned up bad features on graphml xslt test


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

Branch: refs/heads/tp32
Commit: 93b31fd48663fd45aaf39a254e35b12849d933aa
Parents: c47fda6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 7 15:52:04 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 7 15:53:33 2017 -0400

----------------------------------------------------------------------
 .../java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java   | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/93b31fd4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
index 2c13c2f..9246aa7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
@@ -295,10 +295,6 @@ public class IoTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
         @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
-        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
-        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
-        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_LONG_VALUES)
-        @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
         @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
         public void shouldTransformGraphMLV2ToV3ViaXSLT() throws Exception {
             final InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");


[5/7] tinkerpop git commit: TINKERPOP-1608 Update docs and changelog with GraphML XSTL

Posted by sp...@apache.org.
TINKERPOP-1608 Update docs and changelog with GraphML XSTL


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

Branch: refs/heads/tp32
Commit: 7683bf9f5bd0be832cf09b9e84c56effd89b14bc
Parents: 777747e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 6 10:24:48 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 7 15:53:33 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/reference/the-graph.asciidoc           | 26 ++++++++++++++++++++
 .../upgrade/release-3.1.x-incubating.asciidoc   | 16 ++++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7683bf9f/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index effdc07..bb42ff9 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.1.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added XSLT transform option to convert TinkerPop 2.x GraphML to 3.x GraphML.
 * Added validation to `StarVertexProperty`.
 * Bumped to Jackson 2.8.7.
 * Fixed `EventStrategy` so that newly added properties trigger events with the name of the key that was added.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7683bf9f/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index e51c309..26ed778 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -444,6 +444,32 @@ try (final InputStream stream = new FileInputStream("tinkerpop-modern.xml")) {
 }
 ----
 
+GraphML was a supported format in TinkerPop 2.x, but there were several issues that made it inconsistent with the
+specification that were corrected for 3.x. As a result, attempting to read a GraphML file generated by 2.x with the
+3.x `GraphMLReader` will result in error. To help with this problem, an XSLT file is provided as a resource in
+`gremlin-core` which will transform 2.x GraphML to 3.x GraphML. It can be used as follows:
+
+[source,java]
+----
+import javax.xml.parsers.DocumentBuilderFactory
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamSource
+import javax.xml.transform.stream.StreamResult
+
+InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");
+File datafile = new File('/tmp/tp2-graphml.xml')
+File outfile = new File('/tmp/tp3-graphml.xml')
+
+TransformerFactory tFactory = TransformerFactory.newInstance()
+StreamSource stylesource = new StreamSource(stylesheet)
+Transformer transformer = tFactory.newTransformer(stylesource)
+
+StreamSource source = new StreamSource(datafile)
+StreamResult result = new StreamResult(new FileWriter(outfile))
+transformer.transform(source, result)
+----
+
 [[graphson-reader-writer]]
 GraphSON Reader/Writer
 ~~~~~~~~~~~~~~~~~~~~~~

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7683bf9f/docs/src/upgrade/release-3.1.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.1.x-incubating.asciidoc b/docs/src/upgrade/release-3.1.x-incubating.asciidoc
index 05c34c2..2768048 100644
--- a/docs/src/upgrade/release-3.1.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.1.x-incubating.asciidoc
@@ -25,10 +25,23 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.1.7
 ---------------
 
-*Release Date: TBD*
+*Release Date: NOT OFFICIALLY RELEASED YET*
 
 Please see the link:https://github.com/apache/tinkerpop/blob/3.1.6/CHANGELOG.asciidoc#tinkerpop-xyz-release-date-MM-DD-YYYY[changelog] for a complete list of all the modifications that are part of this release.
 
+Upgrading for Users
+~~~~~~~~~~~~~~~~~~~
+
+GraphML XSLT
+^^^^^^^^^^^^
+
+There were some inconsistencies in the GraphML format supported in TinkerPop 2.x. These issues were corrected on the
+initial release of TinkerPop 3.0.0, but as a result, attempting to read GraphML from 2.x will end with an error. A
+newly added XSLT file in `gremlin-core`, called `tp2-to-tp3-graphml.xslt`, transforms 2.x GraphML into 3.x GraphML,
+making it possible easily read in legacy GraphML through a 3.x `GraphMLReader`.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-1608[TINKERPOP-1608]
+
 TinkerPop 3.1.6
 ---------------
 
@@ -53,7 +66,6 @@ to proceed only when the server was fully complete with its work.
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-1544[TINKERPOP-1544]
 
-
 TinkerPop 3.1.5
 ---------------
 


[7/7] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32

Conflicts:
	gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java


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

Branch: refs/heads/tp32
Commit: e6826508d559b5a2d34eea834f077a8dde3b878d
Parents: 2436a69 d4f4108
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 11 07:28:26 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 11 07:28:26 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/reference/the-graph.asciidoc           | 28 +++++++++-
 .../upgrade/release-3.1.x-incubating.asciidoc   | 16 +++++-
 .../src/main/resources/tp2-to-tp3-graphml.xslt  | 59 ++++++++++++++++++++
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 27 +++++++++
 .../io/graphml/tinkerpop-classic-tp2.xml        | 54 ++++++++++++++++++
 6 files changed, 182 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6826508/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6826508/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e6826508/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
----------------------------------------------------------------------
diff --cc gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
index a523b15,9246aa7..6a1d965
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
@@@ -310,16 -290,29 +313,40 @@@ public class IoTest 
              assertEquals(IteratorUtils.count(source.edges()), IteratorUtils.count(target.edges()));
          }
  
+         @Test
+         @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+         @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_STRING_VALUES)
+         @FeatureRequirement(featureClass = VertexPropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
+         @FeatureRequirement(featureClass = EdgePropertyFeatures.class, feature = EdgePropertyFeatures.FEATURE_FLOAT_VALUES)
+         public void shouldTransformGraphMLV2ToV3ViaXSLT() throws Exception {
+             final InputStream stylesheet = Thread.currentThread().getContextClassLoader().getResourceAsStream("tp2-to-tp3-graphml.xslt");
+             final InputStream datafile = IoTest.class.getResourceAsStream(TestHelper.convertPackageToResourcePath(GraphMLResourceAccess.class) + "tinkerpop-classic-tp2.xml");
+             final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ 
+             final TransformerFactory tFactory = TransformerFactory.newInstance();
+             final StreamSource stylesource = new StreamSource(stylesheet);
+             final Transformer transformer = tFactory.newTransformer(stylesource);
+ 
+             final StreamSource source = new StreamSource(datafile);
+             final StreamResult result = new StreamResult(output);
+             transformer.transform(source, result);
+ 
+             final GraphReader reader = GraphMLReader.build().create();
+             reader.readGraph(new ByteArrayInputStream(output.toByteArray()), graph);
+             assertClassicGraph(graph, false, true);
+         }
++
 +        private boolean isGraphMLXSDPresent() {
 +            // when the graphml website goes down then tests won't pass - this allows the tests that rely on this
 +            // resource to conditionally run
 +            try {
 +                new URL("http://graphml.graphdrawing.org/xmlns/1.1/graphml-structure.xsd").openConnection().connect();
 +                return true;
 +            } catch (Exception ex) {
 +                return false;
 +            }
 +        }
      }
  
      public static final class GryoTest extends AbstractGremlinTest {


[2/7] tinkerpop git commit: Added TP2-to-TP3 GraphML XSLT to resources

Posted by sp...@apache.org.
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/tp32
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>


[6/7] tinkerpop git commit: TINKERPOP-1608 Fix for xsltproc processing

Posted by sp...@apache.org.
TINKERPOP-1608 Fix for xsltproc processing

>From comments by Robert Dale on the PR itself: xsltproc is complaining because the apply-templates is not immediately after a new node when trying to apply selected attributes. From what I can tell, the only attributes that should be in the <edge> element are already explicitly defined. It is not necessary to copy attributes (@*) back into the <edge> element. That appears to be the main difference between TP2 and TP3 - that the label attribute is now a <data> element with key attribute. Thus, the attribute selection can be removed.


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

Branch: refs/heads/tp32
Commit: d4f4108423b3eea5cc6ce7734cb1b0524d0aecc7
Parents: 93b31fd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 11 07:17:14 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 11 07:17:14 2017 -0400

----------------------------------------------------------------------
 gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d4f41084/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
index 40d553b..1f3dd5c 100644
--- a/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
+++ b/gremlin-core/src/main/resources/tp2-to-tp3-graphml.xslt
@@ -52,7 +52,7 @@ limitations under the License.
             <data key="labelE">
                 <xsl:value-of select="@label"/>
             </data>
-            <xsl:apply-templates select="node()|@*"/>
+            <xsl:apply-templates select="node()"/>
         </edge>
     </xsl:template>