Sha256: 47aa6771ea113f5260494b30bf13e22fedd771c00ea4e11af5091b695cbc6e0d
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
module Pacer # Methods to be mixed into Blueprints Graph objects from any # implementation. # # Adds more convenient/rubyish methods and adds support for extensions # to some methods where needed. class GraphML # Import the data in a GraphML file. # # Will fail if the data already exsts in the current graph. # # @param [String] path def self.import(graph, path) path = File.expand_path path begin stream = java.net.URL.new(path).open_stream rescue java.net.MalformedURLException stream = java.io.FileInputStream.new path end graph.send :creating_elements do com.tinkerpop.blueprints.util.io.graphml.GraphMLReader.input_graph graph.blueprints_graph, stream end true ensure stream.close if stream end # Export the graph to GraphML # # @param [String] path will be replaced if it exists def self.export(graph, path) path = File.expand_path path stream = java.io.FileOutputStream.new path com.tinkerpop.blueprints.util.io.graphml.GraphMLWriter.outputGraph graph.blueprints_graph, stream ensure stream.close if stream end end end
Version data entries
15 entries across 15 versions & 1 rubygems