MapGenerator
See javadoc - uk.gov.gchq.gaffer.data.generator.MapGenerator
Available since Gaffer version 1.0.0
Converts an iterable of elements into an iterable of maps
Examples
Elements to map
Java
JSON
Full JSON
Python
final MapGenerator function = new MapGenerator.Builder()
.group("Group Label")
.vertex("Vertex Label")
.source("Source Label")
.property("count", "Count Label")
.constant("A Constant", "Some constant value")
.build();
{
"class" : "MapGenerator",
"fields" : {
"GROUP" : "Group Label",
"VERTEX" : "Vertex Label",
"SOURCE" : "Source Label",
"count" : "Count Label"
},
"constants" : {
"A Constant" : "Some constant value"
}
}
{
"class" : "uk.gov.gchq.gaffer.data.generator.MapGenerator",
"fields" : {
"GROUP" : "Group Label",
"VERTEX" : "Vertex Label",
"SOURCE" : "Source Label",
"count" : "Count Label"
},
"constants" : {
"A Constant" : "Some constant value"
}
}
g.MapGenerator(
fields={'GROUP': 'Group Label', 'VERTEX': 'Vertex Label', 'SOURCE': 'Source Label', 'count': 'Count Label'},
constants={'A Constant': 'Some constant value'}
)
Input type:
java.lang.Iterable
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.ArrayList | [Entity[vertex=vertex1,group=Foo,properties=Properties[count=<java.lang.Integer>1]], Entity[vertex=vertex2,group=Foo,properties=Properties[]], Edge[source=dest1,destination=source1,directed=false,group=Bar,properties=Properties[count=<java.lang.Integer>1]], Edge[source=dest1,destination=source1,directed=false,group=Bar,properties=Properties[]]] | uk.gov.gchq.gaffer.data.generator.OneToOneObjectGenerator$1 | [{Group Label=Foo, Vertex Label=vertex1, Count Label=1, A Constant=Some constant value}, {Group Label=Foo, Vertex Label=vertex2, A Constant=Some constant value}, {Group Label=Bar, Source Label=dest1, Count Label=1, A Constant=Some constant value}, {Group Label=Bar, Source Label=dest1, A Constant=Some constant value}] |