GetElementsBetweenSets

See javadoc - uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets

Available since Gaffer version 1.0.0

Gets edges that exist between 2 sets and entities in the first set

Required fields

No required fields

Examples

Get elements within set of vertices 1 and 2 and 4

Java
JSON
Full JSON
Python
final GetElementsBetweenSets operation = new GetElementsBetweenSets.Builder()
        .input(new EntitySeed(1))
        .inputB(new EntitySeed(2), new EntitySeed(4))
        .build();
{
  "class" : "GetElementsBetweenSets",
  "input" : [ {
    "class" : "EntitySeed",
    "vertex" : 1
  } ],
  "inputB" : [ {
    "class" : "EntitySeed",
    "vertex" : 2
  }, {
    "class" : "EntitySeed",
    "vertex" : 4
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets",
  "input" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 1
  } ],
  "inputB" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 2
  }, {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 4
  } ]
}
g.GetElementsBetweenSets( 
  input=[ 
    g.EntitySeed( 
      vertex=1 
    ) 
  ], 
  input_b=[ 
    g.EntitySeed( 
      vertex=2 
    ), 
    g.EntitySeed( 
      vertex=4 
    ) 
  ] 
)


The results are:

Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=1,destination=4,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>1]]

Get elements within set of vertices 1 and 2 and 4 with count greater than 2

Java
JSON
Full JSON
Python
final GetElementsBetweenSets operation = new GetElementsBetweenSets.Builder()
        .input(new EntitySeed(1))
        .inputB(new EntitySeed(2), new EntitySeed(4))
        .view(new View.Builder()
                .entity("entity", new ViewElementDefinition.Builder()
                        .preAggregationFilter(new ElementFilter.Builder()
                                .select("count")
                                .execute(new IsMoreThan(2))
                                .build())
                        .build())
                .edge("edge", new ViewElementDefinition.Builder()
                        .preAggregationFilter(new ElementFilter.Builder()
                                .select("count")
                                .execute(new IsMoreThan(2))
                                .build())
                        .build())
                .build())
        .build();
{
  "class" : "GetElementsBetweenSets",
  "input" : [ {
    "class" : "EntitySeed",
    "vertex" : 1
  } ],
  "inputB" : [ {
    "class" : "EntitySeed",
    "vertex" : 2
  }, {
    "class" : "EntitySeed",
    "vertex" : 4
  } ],
  "view" : {
    "edges" : {
      "edge" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "IsMoreThan",
            "orEqualTo" : false,
            "value" : 2
          }
        } ]
      }
    },
    "entities" : {
      "entity" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "IsMoreThan",
            "orEqualTo" : false,
            "value" : 2
          }
        } ]
      }
    }
  }
}
{
  "class" : "uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets",
  "input" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 1
  } ],
  "inputB" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 2
  }, {
    "class" : "uk.gov.gchq.gaffer.operation.data.EntitySeed",
    "vertex" : 4
  } ],
  "view" : {
    "edges" : {
      "edge" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "uk.gov.gchq.koryphe.impl.predicate.IsMoreThan",
            "orEqualTo" : false,
            "value" : 2
          }
        } ]
      }
    },
    "entities" : {
      "entity" : {
        "preAggregationFilterFunctions" : [ {
          "selection" : [ "count" ],
          "predicate" : {
            "class" : "uk.gov.gchq.koryphe.impl.predicate.IsMoreThan",
            "orEqualTo" : false,
            "value" : 2
          }
        } ]
      }
    }
  }
}
g.GetElementsBetweenSets( 
  view=g.View( 
    entities=[ 
      g.ElementDefinition( 
        group="entity", 
        pre_aggregation_filter_functions=[ 
          g.PredicateContext( 
            selection=[ 
              "count" 
            ], 
            predicate=g.IsMoreThan( 
              value=2, 
              or_equal_to=False 
            ) 
          ) 
        ] 
      ) 
    ], 
    edges=[ 
      g.ElementDefinition( 
        group="edge", 
        pre_aggregation_filter_functions=[ 
          g.PredicateContext( 
            selection=[ 
              "count" 
            ], 
            predicate=g.IsMoreThan( 
              value=2, 
              or_equal_to=False 
            ) 
          ) 
        ] 
      ) 
    ], 
    all_edges=False, 
    all_entities=False 
  ), 
  input=[ 
    g.EntitySeed( 
      vertex=1 
    ) 
  ], 
  input_b=[ 
    g.EntitySeed( 
      vertex=2 
    ), 
    g.EntitySeed( 
      vertex=4 
    ) 
  ] 
)


The results are:

Entity[vertex=1,group=entity,properties=Properties[count=<java.lang.Integer>3]]
Edge[source=1,destination=2,directed=true,matchedVertex=SOURCE,group=edge,properties=Properties[count=<java.lang.Integer>3]]

results matching ""

    No results matching ""