forayer.input_output.from_to_gradoop

Write Gradoop file format and read Gradoop file format.

Functions

int_to_gradoop_id(value)

Casts to Gradoop id, which are 12 byte hexadecimal strings.

is_gradoop_id(value)

Check if value is a valid Gradoop id.

load_from_csv_datasource(folder_path[, ...])

Load Gradoop graph from csv datasource.

write_to_csv_datasource(kgs, out_path[, ...])

Write knowledge graph(s) to Gradoop CSV Datasource.

Classes

EdgeLine(id, graph_ids, source_id, ...)

VertexLine(id, graph_ids, type, props)

class forayer.input_output.from_to_gradoop.EdgeLine(id, graph_ids, source_id, target_id, type, props)
count(value, /)

Return number of occurrences of value.

graph_ids

Alias for field number 1

id

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

props

Alias for field number 5

source_id

Alias for field number 2

target_id

Alias for field number 3

type

Alias for field number 4

class forayer.input_output.from_to_gradoop.VertexLine(id, graph_ids, type, props)
count(value, /)

Return number of occurrences of value.

graph_ids

Alias for field number 1

id

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

props

Alias for field number 3

type

Alias for field number 2

forayer.input_output.from_to_gradoop.int_to_gradoop_id(value: int) str[source]

Casts to Gradoop id, which are 12 byte hexadecimal strings.

valueint

Value to cast

str

12 byte hexadecimal string (without leading ‘0x’).

forayer.input_output.from_to_gradoop.is_gradoop_id(value) bool[source]

Check if value is a valid Gradoop id.

Gradoop ids are 12 byte hexadecimal strings

value

Value to check

bool

True if is valid Gradoop id

forayer.input_output.from_to_gradoop.load_from_csv_datasource(folder_path: str, graph_name_property: Optional[str] = None) Dict[str, forayer.knowledge_graph.kg.KG][source]

Load Gradoop graph from csv datasource.

folder_pathstr

Path for folder that contains graph.

graph_name_propertystr

Name of graph property that will be used to name graphs. If None use graph id.

Dict[str,KG]

Dictionary of knowledge graphs.

forayer.input_output.from_to_gradoop.write_to_csv_datasource(kgs: Union[forayer.knowledge_graph.kg.KG, Dict[str, forayer.knowledge_graph.kg.KG]], out_path: str, label_attr: str = '_label', attribute_type_mapping: Optional[Dict] = None, vertex_id_attr_name: str = '_forayer_id', default_graph_type: str = 'graph', graph_name_as_property: Optional[str] = None, overwrite: bool = False)[source]

Write knowledge graph(s) to Gradoop CSV Datasource.

kgsUnion[KG, Dict[str, KG]]

Knowledge Graph(s) to serialize.

out_pathstr

Folder where this data will be serialized to.

label_attrstr, Default = “_label”

Vertex attribute to use for Gradoop’s special type attribute.

attribute_type_mappingDict, Default=None

Manually set attribute types.

vertex_id_attr_namestr, Default=”_forayer_id”

Save the current entity id as property with this name. If set to None, entity id is not saved.

default_graph_typestr

Label graphs as this type if they do not have a name.

graph_name_as_propertystr

Save the name of graphs as seperate property.

overwritebool

If True, overwrites existing files at output.