Join

See javadoc - uk.gov.gchq.gaffer.operation.impl.join.Join

Available since Gaffer version 1.8.0

This operation joins two iterables together. There are three different types of Join:

  • FULL - returns all objects in the key, along with any matched objects from the other side
  • INNER - returns all keys which matched with objects on the other side
  • OUTER - returns all keys which didn't match with objects from the other side

A Join operation can key by the left (input) or right hand side (output of the operation specified) and outputs an iterable of MapTuples. These Tuples contain the left and right outputs.

A join operation must be supplied with a match method. This tells the operation how to determine what is and what isn't a match. There are two built in match methods:

  • ElementMatch - Matches elements of the same id(s), group and group by properties
  • KeyFunctionMatch - Matches any objects based on two key functions. The first key function applies to whatever the join type is (the object on the left hand side for Left keyed join and vice versa for the right).

Once matched, the left and right sides are outputted as MapTuples keyed by "LEFT" and "RIGHT". The output is flattened by default (one left value for each right value) but this can be turned off using the flatten flag. Setting the flatten flag to false will cause the non keyed side to be summarised in a list.

Required fields

No required fields

Examples

Input elements for the following Join examples:

[ {
  "class" : "uk.gov.gchq.gaffer.data.element.Entity",
  "group" : "entity",
  "vertex" : 1,
  "properties" : {
    "count" : 3
  }
}, {
  "class" : "uk.gov.gchq.gaffer.data.element.Entity",
  "group" : "entity",
  "vertex" : 4,
  "properties" : {
    "count" : 1
  }
}, {
  "class" : "uk.gov.gchq.gaffer.data.element.Entity",
  "group" : "entity",
  "vertex" : 5,
  "properties" : {
    "count" : 3
  }
}, {
  "class" : "uk.gov.gchq.gaffer.data.element.Entity",
  "group" : "entity",
  "vertex" : 6,
  "properties" : {
    "count" : 30
  }
} ]

Left key inner join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.INNER)
                .matchKey(MatchKey.LEFT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "INNER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "INNER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      flatten=False, 
      join_type="INNER", 
      operation=g.GetAllElements(), 
      match_key="LEFT", 
      input=[ 
        g.Entity( 
          group="entity", 
          vertex=1, 
          properties={'count': 3} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=4, 
          properties={'count': 1} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=5, 
          properties={'count': 3} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=6, 
          properties={'count': 30} 
        ) 
      ], 
      match_method=g.ElementMatch() 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> [Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> [Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> [Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    } ]
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    } ]
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    } ]
  }
} ]


Flattened left key inner join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.INNER)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "flatten" : true,
    "joinType" : "INNER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "flatten" : true,
    "joinType" : "INNER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      operation=g.GetAllElements(), 
      join_type="INNER", 
      input=[ 
        g.Entity( 
          group="entity", 
          properties={'count': 3}, 
          vertex=1 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 1}, 
          vertex=4 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 3}, 
          vertex=5 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 30}, 
          vertex=6 
        ) 
      ], 
      flatten=True, 
      match_method=g.ElementMatch() 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
} ]


Right key inner join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.INNER)
                .matchKey(MatchKey.RIGHT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "INNER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "INNER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      match_key="RIGHT", 
      join_type="INNER", 
      match_method=g.ElementMatch(), 
      input=[ 
        g.Entity( 
          vertex=1, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=4, 
          properties={'count': 1}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=5, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=6, 
          properties={'count': 30}, 
          group="entity" 
        ) 
      ], 
      flatten=False, 
      operation=g.GetAllElements() 
    ) 
  ] 
)

Result:

Java
JSON
[ [Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ [Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ [Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
} ]


Flattened right key inner join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .flatten(true)
                .matchKey(MatchKey.RIGHT)
                .joinType(JoinType.INNER)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "INNER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "INNER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      flatten=True, 
      join_type="INNER", 
      input=[ 
        g.Entity( 
          vertex=1, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=4, 
          group="entity", 
          properties={'count': 1} 
        ), 
        g.Entity( 
          vertex=5, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=6, 
          group="entity", 
          properties={'count': 30} 
        ) 
      ], 
      match_key="RIGHT", 
      match_method=g.ElementMatch(), 
      operation=g.GetAllElements() 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
} ]


Left key full join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.FULL)
                .matchKey(MatchKey.LEFT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "FULL"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "FULL"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      join_type="FULL", 
      input=[ 
        g.Entity( 
          vertex=1, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=4, 
          properties={'count': 1}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=5, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=6, 
          properties={'count': 30}, 
          group="entity" 
        ) 
      ], 
      operation=g.GetAllElements(), 
      match_key="LEFT", 
      match_method=g.ElementMatch(), 
      flatten=False 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> [Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> [Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> [Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]] ]
[ Entity[vertex=6,group=entity,properties=Properties[count=<java.lang.Integer>30]] --> [] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    } ]
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    } ]
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    } ]
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    },
    "RIGHT" : [ ]
  }
} ]


Flattened left key full join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.FULL)
                .matchKey(MatchKey.LEFT)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : true,
    "joinType" : "FULL"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : true,
    "joinType" : "FULL"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      operation=g.GetAllElements(), 
      flatten=True, 
      match_method=g.ElementMatch(), 
      input=[ 
        g.Entity( 
          properties={'count': 3}, 
          group="entity", 
          vertex=1 
        ), 
        g.Entity( 
          properties={'count': 1}, 
          group="entity", 
          vertex=4 
        ), 
        g.Entity( 
          properties={'count': 3}, 
          group="entity", 
          vertex=5 
        ), 
        g.Entity( 
          properties={'count': 30}, 
          group="entity", 
          vertex=6 
        ) 
      ], 
      join_type="FULL", 
      match_key="LEFT" 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ Entity[vertex=6,group=entity,properties=Properties[count=<java.lang.Integer>30]] --> null ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    },
    "RIGHT" : null
  }
} ]


Right key full join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.FULL)
                .matchKey(MatchKey.RIGHT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "FULL"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "FULL"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      match_key="RIGHT", 
      operation=g.GetAllElements(), 
      match_method=g.ElementMatch(), 
      join_type="FULL", 
      input=[ 
        g.Entity( 
          vertex=1, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=4, 
          properties={'count': 1}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=5, 
          properties={'count': 3}, 
          group="entity" 
        ), 
        g.Entity( 
          vertex=6, 
          properties={'count': 30}, 
          group="entity" 
        ) 
      ], 
      flatten=False 
    ) 
  ] 
)

Result:

Java
JSON
[ [Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ [] --> Edge[source=1,destination=2,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>3]] ]
[ [] --> Edge[source=1,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Edge[source=2,destination=3,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>2]] ]
[ [] --> Edge[source=2,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Edge[source=2,destination=5,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]] ]
[ [] --> Edge[source=3,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>4]] ]
[ [Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ [Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 2,
      "directed" : true,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 2,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 3,
      "directed" : true,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 5,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 3,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 3,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 4
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    } ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
} ]


Flattened right key full join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.FULL)
                .matchKey(MatchKey.RIGHT)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "FULL"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "FULL"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      match_method=g.ElementMatch(), 
      match_key="RIGHT", 
      join_type="FULL", 
      operation=g.GetAllElements(), 
      input=[ 
        g.Entity( 
          vertex=1, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=4, 
          group="entity", 
          properties={'count': 1} 
        ), 
        g.Entity( 
          vertex=5, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=6, 
          group="entity", 
          properties={'count': 30} 
        ) 
      ], 
      flatten=True 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ null --> Edge[source=1,destination=2,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>3]] ]
[ null --> Edge[source=1,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Edge[source=2,destination=3,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>2]] ]
[ null --> Edge[source=2,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Edge[source=2,destination=5,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]] ]
[ null --> Edge[source=3,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>4]] ]
[ Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] --> Entity[vertex=4,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] --> Entity[vertex=5,group=entity,properties=Properties[count=<java.lang.Integer>3]] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 2,
      "directed" : true,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 2,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 3,
      "directed" : true,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 5,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 3,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 3,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 4
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    },
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }
  }
} ]


Left key outer join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.OUTER)
                .matchKey(MatchKey.LEFT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "OUTER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : false,
    "joinType" : "OUTER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      operation=g.GetAllElements(), 
      join_type="OUTER", 
      match_method=g.ElementMatch(), 
      flatten=False, 
      input=[ 
        g.Entity( 
          group="entity", 
          vertex=1, 
          properties={'count': 3} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=4, 
          properties={'count': 1} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=5, 
          properties={'count': 3} 
        ), 
        g.Entity( 
          group="entity", 
          vertex=6, 
          properties={'count': 30} 
        ) 
      ], 
      match_key="LEFT" 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=6,group=entity,properties=Properties[count=<java.lang.Integer>30]] --> [] ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    },
    "RIGHT" : [ ]
  }
} ]


Flattened left key outer join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.OUTER)
                .matchKey(MatchKey.LEFT)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : true,
    "joinType" : "OUTER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "LEFT",
    "flatten" : true,
    "joinType" : "OUTER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      operation=g.GetAllElements(), 
      match_key="LEFT", 
      input=[ 
        g.Entity( 
          group="entity", 
          properties={'count': 3}, 
          vertex=1 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 1}, 
          vertex=4 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 3}, 
          vertex=5 
        ), 
        g.Entity( 
          group="entity", 
          properties={'count': 30}, 
          vertex=6 
        ) 
      ], 
      flatten=True, 
      join_type="OUTER", 
      match_method=g.ElementMatch() 
    ) 
  ] 
)

Result:

Java
JSON
[ Entity[vertex=6,group=entity,properties=Properties[count=<java.lang.Integer>30]] --> null ]
[ {
  "values" : {
    "LEFT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    },
    "RIGHT" : null
  }
} ]


Right key outer join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.OUTER)
                .matchKey(MatchKey.RIGHT)
                .flatten(false)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "OUTER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : false,
    "joinType" : "OUTER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      input=[ 
        g.Entity( 
          vertex=1, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=4, 
          group="entity", 
          properties={'count': 1} 
        ), 
        g.Entity( 
          vertex=5, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=6, 
          group="entity", 
          properties={'count': 30} 
        ) 
      ], 
      join_type="OUTER", 
      match_method=g.ElementMatch(), 
      operation=g.GetAllElements(), 
      match_key="RIGHT", 
      flatten=False 
    ) 
  ] 
)

Result:

Java
JSON
[ [] --> Edge[source=1,destination=2,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>3]] ]
[ [] --> Edge[source=1,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Edge[source=2,destination=3,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>2]] ]
[ [] --> Edge[source=2,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Edge[source=2,destination=5,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ [] --> Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]] ]
[ [] --> Edge[source=3,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>4]] ]
[ {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 2,
      "directed" : true,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 2,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 3,
      "directed" : true,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 5,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 3,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : [ ],
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 3,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 4
      }
    }
  }
} ]


Flattened right key outer join

Using this directed graph:


    --> 4 <--
  /     ^     \
 /      |      \
1  -->  2  -->  3
         \
           -->  5

Java
JSON
Full JSON
Python
final OperationChain<Iterable<? extends MapTuple>> opChain = new OperationChain.Builder()
        .first(new Join.Builder<>()
                .input(inputElements)
                .operation(new GetAllElements())
                .joinType(JoinType.OUTER)
                .matchKey(MatchKey.RIGHT)
                .matchMethod(new ElementMatch("count"))
                .build())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "Join",
    "input" : [ {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "GetAllElements"
    },
    "matchMethod" : {
      "class" : "ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "OUTER"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.join.Join",
    "input" : [ {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 1,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 4,
      "properties" : {
        "count" : 1
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 5,
      "properties" : {
        "count" : 3
      }
    }, {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 6,
      "properties" : {
        "count" : 30
      }
    } ],
    "operation" : {
      "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
    },
    "matchMethod" : {
      "class" : "uk.gov.gchq.gaffer.store.operation.handler.join.match.ElementMatch"
    },
    "matchKey" : "RIGHT",
    "flatten" : true,
    "joinType" : "OUTER"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.Join( 
      match_key="RIGHT", 
      match_method=g.ElementMatch(), 
      flatten=True, 
      operation=g.GetAllElements(), 
      join_type="OUTER", 
      input=[ 
        g.Entity( 
          vertex=1, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=4, 
          group="entity", 
          properties={'count': 1} 
        ), 
        g.Entity( 
          vertex=5, 
          group="entity", 
          properties={'count': 3} 
        ), 
        g.Entity( 
          vertex=6, 
          group="entity", 
          properties={'count': 30} 
        ) 
      ] 
    ) 
  ] 
)

Result:

Java
JSON
[ null --> Edge[source=1,destination=2,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>3]] ]
[ null --> Edge[source=1,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Entity[vertex=2,group=entity,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Edge[source=2,destination=3,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>2]] ]
[ null --> Edge[source=2,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Edge[source=2,destination=5,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>1]] ]
[ null --> Entity[vertex=3,group=entity,properties=Properties[count=<java.lang.Integer>2]] ]
[ null --> Edge[source=3,destination=4,directed=true,group=edge,properties=Properties[count=<java.lang.Integer>4]] ]
[ {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 2,
      "directed" : true,
      "properties" : {
        "count" : 3
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 1,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 2,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 3,
      "directed" : true,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 2,
      "destination" : 5,
      "directed" : true,
      "properties" : {
        "count" : 1
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Entity",
      "group" : "entity",
      "vertex" : 3,
      "properties" : {
        "count" : 2
      }
    }
  }
}, {
  "values" : {
    "LEFT" : null,
    "RIGHT" : {
      "class" : "uk.gov.gchq.gaffer.data.element.Edge",
      "group" : "edge",
      "source" : 3,
      "destination" : 4,
      "directed" : true,
      "properties" : {
        "count" : 4
      }
    }
  }
} ]


results matching ""

    No results matching ""