Module: RDF::AllegroGraph::Functors::SnaFunctors

Included in:
Query
Defined in:
lib/rdf/allegro_graph/functors/sna_functors.rb

Overview

This module contains AllegroGraph functor definitions that may be called when building a query. Note that these functors merely add a functor expression to a query. The actual functor will be called on the server.

See Also:

Paths Through the Graph collapse

Nearby Nodes collapse

Instance Method Details

#bidirectional_search_paths(from, to, generator, path, options = {})

This method returns an undefined value.

Search for paths between two nodes following the edges specified by generator, and using a bidirectional search strategy.

Parameters:

  • from (Symbol, RDF::Resource)

    Input: The start node in the path.

  • to (Symbol, RDF::Resource)

    Input: The end node in the path.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • to (Symbol)

    Output: A list of nodes in the path.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :max_depth (Integer)

    Input: The maxium search depth.



70
71
72
73
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 70

def bidirectional_search_paths(from, to, generator, path, options={})
  search_paths('bidirectional-search-paths', from, to, generator, path,
               options)
end

#breadth_first_search_paths(from, to, generator, path, options = {})

This method returns an undefined value.

Search for paths between two nodes following the edges specified by generator, and using a breadth-first search strategy.

Parameters:

  • from (Symbol, RDF::Resource)

    Input: The start node in the path.

  • to (Symbol, RDF::Resource)

    Input: The end node in the path.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • to (Symbol)

    Output: A list of nodes in the path.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :max_depth (Integer)

    Input: The maxium search depth.



30
31
32
33
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 30

def breadth_first_search_paths(from, to, generator, path, options={})
  search_paths('breadth-first-search-paths', from, to, generator, path,
               options)
end

#depth_first_search_paths(from, to, generator, path, options = {})

This method returns an undefined value.

Search for paths between two nodes following the edges specified by generator, and using a depth-first search strategy.

Parameters:

  • from (Symbol, RDF::Resource)

    Input: The start node in the path.

  • to (Symbol, RDF::Resource)

    Input: The end node in the path.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • to (Symbol)

    Output: A list of nodes in the path.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :max_depth (Integer)

    Input: The maxium search depth.



50
51
52
53
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 50

def depth_first_search_paths(from, to, generator, path, options={})
  search_paths('depth-first-search-paths', from, to, generator, path,
               options)
end

#ego_group(actor, depth, generator, group)

This method returns an undefined value.

Generate an actor's ego group.

Parameters:

  • actor (Symbol, RDF::Resource)

    Input: The resource at the center of the graph.

  • depth (Integer)

    Input: The maximum number of links to traverse.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • group (Array<RDF::Resource>)

    Output: Either a variable or resource.



127
128
129
130
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 127

def ego_group(actor, depth, generator, group)
  functor('ego-group', actor, PrologLiteral.new(depth),
          generator, group)
end

#ego_group_member(actor, depth, generator, member)

This method returns an undefined value.

Generate all members of an actor's ego group.

Parameters:

  • actor (Symbol, RDF::Resource)

    Input: The resource at the center of the graph.

  • depth (Integer)

    Input: The maximum number of links to traverse.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • group (Symbol, RDF::Resource)

    Input/Output: Either a variable or resource.



143
144
145
146
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 143

def ego_group_member(actor, depth, generator, member)
  functor('ego-group-member', actor, PrologLiteral.new(depth),
          generator, member)
end

#neighbor_count(actor, generator, count) Also known as: nodal_degree

This method returns an undefined value.

Count the neighbors of the actor.

Parameters:

  • actor (Symbol, RDF::Resource)

    Input: The node whose neighbors we want to find.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • count (Symbol)

    Output: The number of neighbors of the actor.



97
98
99
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 97

def neighbor_count(actor, generator, count)
  functor('nodal-degree', actor, generator, count)
end

#neighbors(actor, generator, neighbor) Also known as: nodal_neighbors

This method returns an undefined value.

Find all neighbors of the actor.

Parameters:

  • actor (Symbol, RDF::Resource)

    Input: The node whose neighbors we want to find.

  • generator (PrologLiteral)

    Input: The generator to use when finding links to traverse.

  • neighbor (Symbol)

    Output: A neighbor of the actor.



111
112
113
# File 'lib/rdf/allegro_graph/functors/sna_functors.rb', line 111

def neighbors(actor, generator, neighbor)
  functor('nodal-neighbors', actor, generator, neighbor)
end