Skip to content

Unary Graph Collection Operators

Rascat edited this page Aug 15, 2018 · 9 revisions

This section provides an overview of unary graph collection operators, which operate on a single GraphCollection and return a subset or transformation of the input collection.

Unary Graph Collection Operators
Selection
Matching
Limit
Distinct

Selection

Given a collection, the select operator filters all contained graphs based on their associated graph head and return a collection with logical graphs that fulfill the predicate.

Method Expects Returns
select predicate function (FilterFunction<GraphHead>) for a graph head GraphCollection which contains all logical graphs that fulfill the predicate.

Selection example

Consider the Social Network example graph, which contains multiple logical graphs with different relations. This example takes a single graph collection and selects a subset of logical graphs that fulfill the predicate function.
In order to select all graphs that contain edges labeled 'hasMember', we would do the following:

  1. aggregate the property hasEdgeLabel_hasMember for each graph in the collection
  2. use the select method to retrieve graphs for which the newly set property is true
FlinkAsciiGraphLoader loader = getSocialNetworkLoader();
GraphCollection collection = loader.getGraphCollectionByVariables("g0", "g1", "g2", "g3");

// create aggregation function
HasEdgeLabel hasLabelHasMember = new HasEdgeLabel("hasMember"):

// apply aggregation
collection = collection.apply(new ApplyAggregation(hasLabelHasMember))

// select graphs
GraphCollection result = collection.select(hasLabelHasMember))

The graph collection result now contains the logical graph g3:Forum, since it is the only one which contains edges labeled 'hasMember'. Or to be more precise: it is the only one with a property 'hasEdgeLabel_hasMember' that is set to true after we applied the aggregation.

Matching

tbd.

Limit

tbd.

Distinct

tbd.

Clone this wiki locally