Unfold Node Property

The Unfold Node Property operation can be used to transform every instance of a node property to a predicate such that if a node N has property P and value X,

  • P becomes the predicate

  • N is the subject of the predicate

  • X becomes the object of the predicate

kgx.graph_operations.unfold_node_property

kgx.graph_operations.unfold_node_property(graph: kgx.graph.base_graph.BaseGraph, node_property: str, prefix: Optional[str] = None) → None[source]

Unfold node property as a predicate where every node with node_property will be unfolded as an edge.

Parameters
  • graph (kgx.graph.base_graph.BaseGraph) – The graph

  • node_property (str) – The node property to unfold

  • prefix (Optional[str]) – The prefix to use