[
https://issues.apache.org/jira/browse/TINKERPOP-1608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Plurad updated TINKERPOP-1608:
------------------------------------
Description:
There were some changes in the GraphML format between TinkerPop 2 and TinkerPop
3. [~joshsh] has [started work|https://github.com/apache/tinkerpop/pull/501] on
an XSLT to transform between the two formats.
I performed an initial test of the transform using this code within the Gremlin
Console.
{noformat}
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
stylesheet = new File('/tmp/tp-graphml-convert.xslt')
datafile = new File('/tmp/tp2-graphml.xml')
outfile = new File('/tmp/tp3-graphml.xml')
tFactory = TransformerFactory.newInstance()
stylesource = new StreamSource(stylesheet)
transformer = tFactory.newTransformer(stylesource)
source = new StreamSource(datafile)
result = new StreamResult(new FileWriter(outfile))
transformer.transform(source, result)
{noformat}
Example TinkerPop 2 GraphML:
https://github.com/tinkerpop/gremlin/blob/master/data/graph-example-1.xml
Example TinkerPop 3 GraphML:
https://github.com/apache/tinkerpop/blob/3.1.5/data/tinkerpop-classic.xml
was:
There were some changes in the GraphML format between TinkerPop 2 and TinkerPop
3. [~joshsh] has [started work|https://github.com/apache/tinkerpop/pull/501] on
an XSLT to transform between the two formats.
I performed an initial test of the transform using this code within the Gremlin
Console.
{noformat}
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
stylesheet = new File('/tmp/tp-graphml-convert.xslt')
datafile = new File('/tmp/tp2-graphml.xml')
outfile = new File('/tmp/tp3-graphml.xml')
factory = DocumentBuilderFactory.newInstance()
builder = factory.newDocumentBuilder()
document = builder.parse(datafile)
tFactory = TransformerFactory.newInstance()
stylesource = new StreamSource(stylesheet)
transformer = tFactory.newTransformer(stylesource)
source = new DOMSource(document)
result = new StreamResult(new FileWriter(outfile))
transformer.transform(source, result)
{noformat}
There are still some remaining changes required for compatibility.
These keys need to be defined:
{noformat}
<key attr.name="labelV" attr.type="string" for="node" id="labelV"/>
<key attr.name="labelE" attr.type="string" for="edge" id="labelE"/>
{noformat}
A vertex label needs to be inserted on all nodes. Vertex labels are new in TP3.
Not sure if this is required by the TP3 parser:
{noformat}
<data key="labelV">vertex</data>
{noformat}
The edge label needs to move from the edge tag to a nested child tag:
{noformat}
<data key="labelE">created</data>
{noformat}
Example TinkerPop 2 GraphML:
https://github.com/tinkerpop/gremlin/blob/master/data/graph-example-1.xml
Example TinkerPop 3 GraphML:
https://github.com/apache/tinkerpop/blob/3.1.5/data/tinkerpop-classic.xml
> TP2-to-TP3 GraphML XSLT
> -----------------------
>
> Key: TINKERPOP-1608
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1608
> Project: TinkerPop
> Issue Type: Improvement
> Components: io
> Affects Versions: 3.1.5, 3.2.3
> Reporter: Jason Plurad
>
> There were some changes in the GraphML format between TinkerPop 2 and
> TinkerPop 3. [~joshsh] has [started
> work|https://github.com/apache/tinkerpop/pull/501] on an XSLT to transform
> between the two formats.
> I performed an initial test of the transform using this code within the
> Gremlin Console.
> {noformat}
> 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
> stylesheet = new File('/tmp/tp-graphml-convert.xslt')
> datafile = new File('/tmp/tp2-graphml.xml')
> outfile = new File('/tmp/tp3-graphml.xml')
> tFactory = TransformerFactory.newInstance()
> stylesource = new StreamSource(stylesheet)
> transformer = tFactory.newTransformer(stylesource)
> source = new StreamSource(datafile)
> result = new StreamResult(new FileWriter(outfile))
> transformer.transform(source, result)
> {noformat}
> Example TinkerPop 2 GraphML:
> https://github.com/tinkerpop/gremlin/blob/master/data/graph-example-1.xml
> Example TinkerPop 3 GraphML:
> https://github.com/apache/tinkerpop/blob/3.1.5/data/tinkerpop-classic.xml
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)