CsvGenerator

See javadoc - uk.gov.gchq.gaffer.data.generator.CsvGenerator

Available since Gaffer version 1.0.0

Converts an iterable of elements into an iterable of csvs

Examples

Elements to csv

Java
JSON
Full JSON
Python
final CsvGenerator function = new CsvGenerator.Builder()
        .group("Group Label")
        .vertex("Vertex Label")
        .source("Source Label")
        .property("count", "Count Label")
        .constant("A Constant", "Some constant value")
        .quoted(false)
        .build();
{
  "class" : "CsvGenerator",
  "fields" : {
    "GROUP" : "Group Label",
    "VERTEX" : "Vertex Label",
    "SOURCE" : "Source Label",
    "count" : "Count Label"
  },
  "constants" : {
    "A Constant" : "Some constant value"
  },
  "quoted" : false,
  "commaReplacement" : " "
}
{
  "class" : "uk.gov.gchq.gaffer.data.generator.CsvGenerator",
  "fields" : {
    "GROUP" : "Group Label",
    "VERTEX" : "Vertex Label",
    "SOURCE" : "Source Label",
    "count" : "Count Label"
  },
  "constants" : {
    "A Constant" : "Some constant value"
  },
  "quoted" : false,
  "commaReplacement" : " "
}
g.CsvGenerator( 
  fields={'GROUP': 'Group Label', 'VERTEX': 'Vertex Label', 'SOURCE': 'Source Label', 'count': 'Count Label'}, 
  constants={'A Constant': 'Some constant value'}, 
  quoted=False, 
  comma_replacement=" " 
)

Input type:

java.lang.Iterable

Example inputs:

Input TypeInputResult TypeResult
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[Foo,vertex1,,1,A Constant, Foo,vertex2,,,A Constant, Bar,,dest1,1,A Constant, Bar,,dest1,,A Constant]

Elements to quoted csv

Java
JSON
Full JSON
Python
final CsvGenerator function = new CsvGenerator.Builder()
        .group("Group Label")
        .vertex("Vertex Label")
        .source("Source Label")
        .property("count", "Count Label")
        .constant("A Constant", "Some constant value")
        .quoted(true)
        .build();
{
  "class" : "CsvGenerator",
  "fields" : {
    "GROUP" : "Group Label",
    "VERTEX" : "Vertex Label",
    "SOURCE" : "Source Label",
    "count" : "Count Label"
  },
  "constants" : {
    "A Constant" : "Some constant value"
  },
  "quoted" : true,
  "commaReplacement" : " "
}
{
  "class" : "uk.gov.gchq.gaffer.data.generator.CsvGenerator",
  "fields" : {
    "GROUP" : "Group Label",
    "VERTEX" : "Vertex Label",
    "SOURCE" : "Source Label",
    "count" : "Count Label"
  },
  "constants" : {
    "A Constant" : "Some constant value"
  },
  "quoted" : true,
  "commaReplacement" : " "
}
g.CsvGenerator( 
  fields={'GROUP': 'Group Label', 'VERTEX': 'Vertex Label', 'SOURCE': 'Source Label', 'count': 'Count Label'}, 
  constants={'A Constant': 'Some constant value'}, 
  quoted=True, 
  comma_replacement=" " 
)

Input type:

java.lang.Iterable

Example inputs:

Input TypeInputResult TypeResult
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["Foo","vertex1",,"1","A Constant", "Foo","vertex2",,,"A Constant", "Bar",,"dest1","1","A Constant", "Bar",,"dest1",,"A Constant"]

results matching ""

    No results matching ""