Sha256: 5f0350946daa29d539eff80fc9ba46c8ddbeaac91d41b2a4d7c19e8d6585cc3e

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

module Pacer::Core::Graph

  # This module adds route methods to the basic graph classes returned from the
  # blueprints library.
  module GraphRoute
    import com.tinkerpop.pipes.transform.VerticesPipe
    import com.tinkerpop.pipes.transform.EdgesPipe

    # Returns a new route to all graph vertices. Standard filter options.
    def v(*filters, &block)
      filters = Pacer::Route.filters(filters)
      route = chain_route :element_type => :vertex,
        :pipe_class => VerticesPipe,
        :route_name => 'GraphV'
      Pacer::Route.property_filter(route, filters, block)
    end

    # Returns a new route to all graph edges. Standard filter options.
    def e(*filters, &block)
      filters = Pacer::Route.edge_filters(filters)
      route = chain_route :element_type => :edge,
        :pipe_class => EdgesPipe,
        :route_name => 'GraphE'
      Pacer::Route.property_filter(route, filters, block)
    end

    def filter(*args)
      raise 'Not implemented'
    end

    # Specialization of result simply returns self.
    def result
      self
    end

    # The graph itself is as root as you can get.
    def root?
      true
    end

    def graph
      # This must be defined here to overwrite the #graph method in Route.
      self
    end

    def ==(other)
      equal?(other)
    end

    # Don't try to inspect the graph data when inspecting.
    def hide_elements
      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacer-0.9.1.1-java lib/pacer/core/graph/graph_route.rb