Class OGraphMLReader

java.lang.Object
com.orientechnologies.orient.graph.graphml.OGraphMLReader

public class OGraphMLReader extends Object
GraphMLReader writes the data from a GraphML stream to a graph. Derived from Blueprints GraphMLReader. Supports also vertex labels.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com) (l.garulli(at)orientdb.com), Marko A. Rodriguez (http://markorodriguez.com), Alex Averbuch (alex.averbuch-at-gmail.com), Joshua Shinavier (http://fortytwo.net)
  • Constructor Details

    • OGraphMLReader

      public OGraphMLReader(OrientBaseGraph graph)
      Parameters:
      graph - the graph to populate with the GraphML data
  • Method Details

    • defineVertexAttributeStrategy

      public OGraphMLReader defineVertexAttributeStrategy(String iAttributeName, OGraphMLImportStrategy iStrategy)
      Define custom strategy to use for vertex attribute.
      Parameters:
      iAttributeName - attribute name
      iStrategy - strategy implementation
    • defineEdgeAttributeStrategy

      public OGraphMLReader defineEdgeAttributeStrategy(String iAttributeName, OGraphMLImportStrategy iStrategy)
      Define custom strategy to use for edge attribute.
      Parameters:
      iAttributeName - attribute name
      iStrategy - strategy implementation
    • inputGraph

      public void inputGraph(com.tinkerpop.blueprints.Graph inputGraph, InputStream graphMLInputStream) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      inputGraph - the graph to populate with the GraphML data
      graphMLInputStream - an InputStream of GraphML data
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public void inputGraph(com.tinkerpop.blueprints.Graph inputGraph, String filename) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      inputGraph - the graph to populate with the GraphML data
      filename - name of a file containing GraphML data
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public OGraphMLReader inputGraph(com.tinkerpop.blueprints.Graph inputGraph, String filename, int bufferSize, String vertexIdKey, String edgeIdKey, String edgeLabelKey) throws IOException
      Input the GraphML stream data into the graph. More control over how data is streamed is provided by this method.
      Parameters:
      inputGraph - the graph to populate with the GraphML data
      filename - name of a file containing GraphML data
      bufferSize - the amount of elements to hold in memory before committing a transactions (only valid for TransactionalGraphs)
      vertexIdKey - if the id of a vertex is a <data/> property, fetch it from the data property.
      edgeIdKey - if the id of an edge is a <data/> property, fetch it from the data property.
      edgeLabelKey - if the label of an edge is a <data/> property, fetch it from the data property.
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public OGraphMLReader inputGraph(com.tinkerpop.blueprints.Graph inputGraph, InputStream graphMLInputStream, int bufferSize, String vertexIdKey, String edgeIdKey, String edgeLabelKey) throws IOException
      Input the GraphML stream data into the graph. More control over how data is streamed is provided by this method.
      Parameters:
      inputGraph - the graph to populate with the GraphML data
      graphMLInputStream - an InputStream of GraphML data
      bufferSize - the amount of elements to hold in memory before committing a transactions (only valid for TransactionalGraphs)
      vertexIdKey - if the id of a vertex is a <data/> property, fetch it from the data property.
      edgeIdKey - if the id of an edge is a <data/> property, fetch it from the data property.
      edgeLabelKey - if the label of an edge is a <data/> property, fetch it from the data property.
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • getVertexLabelIndex

      public int getVertexLabelIndex()
    • setVertexLabelIndex

      public void setVertexLabelIndex(int vertexLabelIndex)
    • setVertexIdKey

      public void setVertexIdKey(String vertexIdKey)
      Parameters:
      vertexIdKey - if the id of a vertex is a <data/> property, fetch it from the data property.
    • setEdgeIdKey

      public void setEdgeIdKey(String edgeIdKey)
      Parameters:
      edgeIdKey - if the id of an edge is a <data/> property, fetch it from the data property.
    • setEdgeLabelKey

      public void setEdgeLabelKey(String edgeLabelKey)
      Parameters:
      edgeLabelKey - if the label of an edge is a <data/> property, fetch it from the data property.
    • inputGraph

      public OGraphMLReader inputGraph(InputStream graphMLInputStream) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      graphMLInputStream - an InputStream of GraphML data
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public OGraphMLReader inputGraph(String filename) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      filename - name of a file containing GraphML data
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public OGraphMLReader inputGraph(InputStream graphMLInputStream, int bufferSize) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      graphMLInputStream - an InputStream of GraphML data
      bufferSize - the amount of elements to hold in memory before committing a transactions (only valid for TransactionalGraphs)
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • inputGraph

      public OGraphMLReader inputGraph(String filename, int bufferSize) throws IOException
      Input the GraphML stream data into the graph. In practice, usually the provided graph is empty.
      Parameters:
      filename - name of a file containing GraphML data
      bufferSize - the amount of elements to hold in memory before committing a transactions (only valid for TransactionalGraphs)
      Throws:
      IOException - thrown when the GraphML data is not correctly formatted
    • isStoreVertexIds

      public boolean isStoreVertexIds()
    • setStoreVertexIds

      public void setStoreVertexIds(boolean storeVertexIds)
    • setOptions

      public OGraphMLReader setOptions(Map<String,List<String>> opts)
    • getBatchSize

      public int getBatchSize()
    • setBatchSize

      public void setBatchSize(int batchSize)
    • mapId

      protected void mapId(Map<String,ORID> vertexMappedIdMap, String vertexId, ORID rid)
    • getOutput

      public OCommandOutputListener getOutput()
    • setOutput

      public OGraphMLReader setOutput(OCommandOutputListener output)
    • printStatus

      protected void printStatus(XMLStreamReader input, long importedVertices, long importedEdges)