CountGroups

See javadoc - uk.gov.gchq.gaffer.operation.impl.CountGroups

Available since Gaffer version 1.0.0

Required fields

No required fields

Examples

Count all element groups

Using this directed graph:


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

Java
JSON
Full JSON
Python
final OperationChain<GroupCounts> opChain = new OperationChain.Builder()
        .first(new GetAllElements())
        .then(new CountGroups())
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "GetAllElements"
  }, {
    "class" : "CountGroups"
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
  }, {
    "class" : "uk.gov.gchq.gaffer.operation.impl.CountGroups"
  } ]
}
g.OperationChain( 
  operations=[ 
    g.GetAllElements(), 
    g.CountGroups() 
  ] 
)

Result:

Java
JSON
GroupCounts[entityGroups={entity=5},edgeGroups={edge=6},limitHit=false]
{
  "entityGroups" : {
    "entity" : 5
  },
  "edgeGroups" : {
    "edge" : 6
  },
  "limitHit" : false
}


Count all element groups with limit

Using this directed graph:


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

Java
JSON
Full JSON
Python
final OperationChain<GroupCounts> opChain = new OperationChain.Builder()
        .first(new GetAllElements())
        .then(new CountGroups(5))
        .build();
{
  "class" : "OperationChain",
  "operations" : [ {
    "class" : "GetAllElements"
  }, {
    "class" : "CountGroups",
    "limit" : 5
  } ]
}
{
  "class" : "uk.gov.gchq.gaffer.operation.OperationChain",
  "operations" : [ {
    "class" : "uk.gov.gchq.gaffer.operation.impl.get.GetAllElements"
  }, {
    "class" : "uk.gov.gchq.gaffer.operation.impl.CountGroups",
    "limit" : 5
  } ]
}
g.OperationChain( 
  operations=[ 
    g.GetAllElements(), 
    g.CountGroups( 
      limit=5 
    ) 
  ] 
)

Result:

Java
JSON
GroupCounts[entityGroups={entity=2},edgeGroups={edge=3},limitHit=true]
{
  "entityGroups" : {
    "entity" : 2
  },
  "edgeGroups" : {
    "edge" : 3
  },
  "limitHit" : true
}


results matching ""

    No results matching ""