Toggle Menu
Prev Up Next

# `langchain_community.graphs.networkx_graph`.KnowledgeTriple

class langchain_community.graphs.networkx_graph.KnowledgeTriple(subject: str, predicate: str, object_: str)

  Knowledge triple in the graph.

  Create new instance of KnowledgeTriple(subject, predicate, object_)

  Attributes

  `object_` | Alias for field number 2
  `predicate` | Alias for field number 1
  `subject` | Alias for field number 0

  Methods

  `__init__`() |
  `count`(value, /) | Return number of occurrences of value.
  `from_string`(triple_string) | Create a KnowledgeTriple from a string.
  `index`(value[, start, stop]) | Return first index of value.

  Parameters

    - subject (str) –

    - predicate (str) –

    - object_ (str) –

  __init__()
  count(value, /)

    Return number of occurrences of value.

  classmethod from_string(triple_string: str) → KnowledgeTriple

    Create a KnowledgeTriple from a string.

    Parameters

      triple_string (str) –

    Return type

      KnowledgeTriple

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

    Return first index of value.

    Raises ValueError if the value is not present.