awswrangler.neptune.to_rdf_graph

awswrangler.neptune.to_rdf_graph(client: NeptuneClient, df: DataFrame, batch_size: int = 50, subject_column: str = 's', predicate_column: str = 'p', object_column: str = 'o', graph_column: str = 'g') Any

Write records stored in a DataFrame into Amazon Neptune.

The DataFrame must consist of triples with column names for the subject, predicate, and object specified. If you want to add data into a named graph then you will also need the graph column.

Parameters
  • (NeptuneClient) (client) – instance of the neptune client to use

  • (pandas.DataFrame) (df) – Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html

  • (str (graph_column) – The column name in the dataframe for the subject. Defaults to ‘s’

  • optional) – The column name in the dataframe for the subject. Defaults to ‘s’

  • (str – The column name in the dataframe for the predicate. Defaults to ‘p’

  • optional) – The column name in the dataframe for the predicate. Defaults to ‘p’

  • (str – The column name in the dataframe for the object. Defaults to ‘o’

  • optional) – The column name in the dataframe for the object. Defaults to ‘o’

  • (str – The column name in the dataframe for the graph if sending across quads. Defaults to ‘g’

  • optional) – The column name in the dataframe for the graph if sending across quads. Defaults to ‘g’

Returns

True if records were written

Return type

bool

Examples

Writing to Amazon Neptune

>>> import awswrangler as wr
>>> client = wr.neptune.connect(neptune_endpoint, neptune_port, iam_enabled=False)
>>> wr.neptune.gremlin.to_rdf_graph(
...     df=df
... )