Class OGraphSONUtility

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

public class OGraphSONUtility extends Object
Helps write individual graph elements to TinkerPop JSON format known as GraphSON.
Author:
Stephen Mallette (http://stephen.genoprime.com), Luca Garulli (l.garulli--(at)--orientdb.com)
  • Constructor Summary

    Constructors
    Constructor
    Description
    OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory)
    A GraphSONUtiltiy that includes all properties of vertices and edges.
    OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.ElementPropertyConfig config)
     
    OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, Set<String> vertexPropertyKeys, Set<String> edgePropertyKeys)
    A GraphSONUtility that includes the specified properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.tinkerpop.blueprints.Edge
    edgeFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in)
    Creates an edge from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Edge
    edgeFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Edge from JSON.
    com.tinkerpop.blueprints.Edge
    edgeFromJson(InputStream json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in)
    Creates an edge from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Edge
    edgeFromJson(InputStream json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Edge from JSON.
    com.tinkerpop.blueprints.Edge
    edgeFromJson(String json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in)
    Creates an edge from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Edge
    edgeFromJson(String json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Edge from JSON.
    com.tinkerpop.blueprints.Edge
    edgeFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in)
    Creates an edge from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Edge
    edgeFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Edge from JSON.
    org.codehaus.jettison.json.JSONObject
    jsonFromElement(com.tinkerpop.blueprints.Element element)
    Creates GraphSON for a single graph element.
    com.fasterxml.jackson.databind.node.ObjectNode
    objectNodeFromElement(com.tinkerpop.blueprints.Element element)
    Creates GraphSON for a single graph element.
    com.tinkerpop.blueprints.Vertex
    vertexFromJson(com.fasterxml.jackson.databind.JsonNode json)
    Creates a vertex from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Vertex
    vertexFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Vertex from JSON.
    com.tinkerpop.blueprints.Vertex
    Creates a vertex from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Vertex
    vertexFromJson(InputStream json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Vertex from JSON.
    com.tinkerpop.blueprints.Vertex
    Creates a vertex from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Vertex
    vertexFromJson(String json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Vertex from JSON.
    com.tinkerpop.blueprints.Vertex
    vertexFromJson(org.codehaus.jettison.json.JSONObject json)
    Creates a vertex from GraphSON using settings supplied in the constructor.
    static com.tinkerpop.blueprints.Vertex
    vertexFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys)
    Reads an individual Vertex from JSON.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OGraphSONUtility

      public OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory)
      A GraphSONUtiltiy that includes all properties of vertices and edges.
    • OGraphSONUtility

      public OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, Set<String> vertexPropertyKeys, Set<String> edgePropertyKeys)
      A GraphSONUtility that includes the specified properties.
    • OGraphSONUtility

      public OGraphSONUtility(com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.ElementPropertyConfig config)
  • Method Details

    • vertexFromJson

      public com.tinkerpop.blueprints.Vertex vertexFromJson(org.codehaus.jettison.json.JSONObject json) throws IOException
      Creates a vertex from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • vertexFromJson

      public com.tinkerpop.blueprints.Vertex vertexFromJson(String json) throws IOException
      Creates a vertex from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • vertexFromJson

      public com.tinkerpop.blueprints.Vertex vertexFromJson(InputStream json) throws IOException
      Creates a vertex from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • vertexFromJson

      public com.tinkerpop.blueprints.Vertex vertexFromJson(com.fasterxml.jackson.databind.JsonNode json) throws IOException
      Creates a vertex from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • edgeFromJson

      public com.tinkerpop.blueprints.Edge edgeFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in) throws IOException
      Creates an edge from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • edgeFromJson

      public com.tinkerpop.blueprints.Edge edgeFromJson(String json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in) throws IOException
      Creates an edge from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • edgeFromJson

      public com.tinkerpop.blueprints.Edge edgeFromJson(InputStream json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in) throws IOException
      Creates an edge from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • edgeFromJson

      public com.tinkerpop.blueprints.Edge edgeFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in) throws IOException
      Creates an edge from GraphSON using settings supplied in the constructor.
      Throws:
      IOException
    • jsonFromElement

      public org.codehaus.jettison.json.JSONObject jsonFromElement(com.tinkerpop.blueprints.Element element) throws org.codehaus.jettison.json.JSONException
      Creates GraphSON for a single graph element.
      Throws:
      org.codehaus.jettison.json.JSONException
    • objectNodeFromElement

      public com.fasterxml.jackson.databind.node.ObjectNode objectNodeFromElement(com.tinkerpop.blueprints.Element element)
      Creates GraphSON for a single graph element.
    • vertexFromJson

      public static com.tinkerpop.blueprints.Vertex vertexFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Vertex from JSON. The vertex must match the accepted GraphSON format.
      Parameters:
      json - a single vertex in GraphSON format as Jettison JSONObject
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include on reading of element properties
      Throws:
      IOException
    • vertexFromJson

      public static com.tinkerpop.blueprints.Vertex vertexFromJson(String json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Vertex from JSON. The vertex must match the accepted GraphSON format.
      Parameters:
      json - a single vertex in GraphSON format as a String.
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include on reading of element properties
      Throws:
      IOException
    • vertexFromJson

      public static com.tinkerpop.blueprints.Vertex vertexFromJson(InputStream json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Vertex from JSON. The vertex must match the accepted GraphSON format.
      Parameters:
      json - a single vertex in GraphSON format as an InputStream.
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include on reading of element properties
      Throws:
      IOException
    • vertexFromJson

      public static com.tinkerpop.blueprints.Vertex vertexFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Vertex from JSON. The vertex must match the accepted GraphSON format.
      Parameters:
      json - a single vertex in GraphSON format as Jackson JsonNode
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include on reading of element properties
      Throws:
      IOException
    • edgeFromJson

      public static com.tinkerpop.blueprints.Edge edgeFromJson(org.codehaus.jettison.json.JSONObject json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Edge from JSON. The edge must match the accepted GraphSON format.
      Parameters:
      json - a single edge in GraphSON format as a Jettison JSONObject
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include when reading of element properties
      Throws:
      IOException
    • edgeFromJson

      public static com.tinkerpop.blueprints.Edge edgeFromJson(String json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Edge from JSON. The edge must match the accepted GraphSON format.
      Parameters:
      json - a single edge in GraphSON format as a String
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include when reading of element properties
      Throws:
      IOException
    • edgeFromJson

      public static com.tinkerpop.blueprints.Edge edgeFromJson(InputStream json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Edge from JSON. The edge must match the accepted GraphSON format.
      Parameters:
      json - a single edge in GraphSON format as an InputStream
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include when reading of element properties
      Throws:
      IOException
    • edgeFromJson

      public static com.tinkerpop.blueprints.Edge edgeFromJson(com.fasterxml.jackson.databind.JsonNode json, com.tinkerpop.blueprints.Vertex out, com.tinkerpop.blueprints.Vertex in, com.tinkerpop.blueprints.util.io.graphson.ElementFactory factory, com.tinkerpop.blueprints.util.io.graphson.GraphSONMode mode, Set<String> propertyKeys) throws IOException
      Reads an individual Edge from JSON. The edge must match the accepted GraphSON format.
      Parameters:
      json - a single edge in GraphSON format as a Jackson JsonNode
      factory - the factory responsible for constructing graph elements
      mode - the mode of the GraphSON
      propertyKeys - a list of keys to include when reading of element properties
      Throws:
      IOException