Delete Nodes & Edges

Remove entities and relationships with cascade handling and integrity checks.

Overview

This tutorial covers the safe deletion of nodes and edges from your ResearchArcade graph database. You'll learn how to remove individual entities, handle cascade deletions, maintain referential integrity, and implement soft deletion strategies for critical data.

Deleting Nodes

Select a node type below to see the code example for deleting that entity:

Select a node type from the dropdown above to view the code example.

Deleting an ArXiv Papers Node

Example code for deleting an arxiv papers entry:

# Delete a paper by ID
paper_id = {"arxiv_id": "1706.03762v7"}
deleted_paper = research_arcade.delete_node_by_id("arxiv_papers", paper_id)
print("Deleted paper:")
print(deleted_paper)

No example code available for this operation in the tutorial.

No example code available for this operation in the tutorial.

Deleting an ArXiv Sections Node

Example code for deleting an arxiv sections entry:

section_id = {"id": 544409}
research_arcade.delete_node_by_id("arxiv_sections", section_id)

Deleting an ArXiv Paragraphs Node

Example code for deleting an arxiv paragraphs entry:

paragraph_id = {"id": 27428267}
research_arcade.delete_node_by_id("arxiv_paragraphs", paragraph_id)

Deleting an ArXiv Figures Node

Example code for deleting an arxiv figures entry:

figure_id = {"id": 836691}
research_arcade.delete_node_by_id("arxiv_figures", figure_id)

Deleting an ArXiv Tables Node

Example code for deleting an arxiv tables entry:

table_id = {"id": 299024}
research_arcade.delete_node_by_id("arxiv_tables", table_id)

Deleting an OpenReview Authors Node

Example code for deleting an openreview authors entry:

author_id = {"author_openreview_id": "~ishmam_zabir1"}
author_features = research_arcade.delete_node_by_id("openreview_authors", author_id)
print(author_features.to_dict(orient="records")[0])

Deleting an OpenReview Papers Node

Example code for deleting an openreview papers entry:

paper_id = {"paper_openreview_id": "zGej22CBnS"}
paper_features = research_arcade.delete_node_by_id("openreview_papers", paper_id)
print(paper_features.to_dict(orient="records")[0])

Deleting an OpenReview Reviews Node

Example code for deleting an openreview reviews entry:

review_id = {"review_openreview_id": "DHwZxFryth"}
review_features = research_arcade.delete_node_by_id("openreview_reviews", review_id)
print(review_features.to_dict(orient="records")[0])

Deleting an OpenReview Revisions Node

Example code for deleting an openreview revisions entry:

revision_id = {"revision_openreview_id": "yfHQOp5zWc"}
revision_feature = research_arcade.delete_node_by_id("openreview_revisions", revision_id)
print(revision_feature.to_dict(orient="records")[0])

Deleting an OpenReview Paragraphs Node

Example code for deleting an openreview paragraphs entry:

paper_id = {"paper_openreview_id": "xujj_test"}
paragraph_feature = research_arcade.delete_node_by_id("openreview_paragraphs", paper_id)
print(len(paragraph_feature))
print(paragraph_feature.to_dict(orient="records")[0])

Deleting an OpenReview-ArXiv Link Node

Example code for deleting an openreview-arxiv link entry:

openreview_id = {"paper_openreview_id": "zkNCWtw2fd"}
openreview_arxiv_df = research_arcade.delete_edge_by_id("openreview_arxiv", openreview_id)
print(openreview_arxiv_df.to_dict(orient="records")[0])

arxiv_id = {"arxiv_id": "http://arxiv.org/abs/2408.10536v1"}
openreview_arxiv_df = research_arcade.delete_edge_by_id("openreview_arxiv", arxiv_id)
print(openreview_arxiv_df.to_dict(orient="records")[0])

openreview_arxiv_id = {"paper_openreview_id": "zkNCWtw2fd", "arxiv_id": "http://arxiv.org/abs/2408.10536v1"}
openreview_arxiv_df = research_arcade.delete_edge_by_id("openreview_arxiv", openreview_arxiv_id)
print(openreview_arxiv_df.to_dict(orient="records")[0])

Deleting Edges

Select an edge type below to see the code example for deleting that relationship:

Select an edge type from the dropdown above to view the code example.

Deleting an ArXiv Author-Paper Relationship

Example code for deleting an arxiv author-paper entry:

relation_id = {'paper_arxiv_id': '1706.03762v7', 'author_id': 'ss_ashish_vaswani'}
research_arcade.delete_edge_by_id("arxiv_paper_author", primary_key=relation_id)
print("Relationship deleted!")

Deleting an ArXiv Paper-Category Relationship

Example code for deleting an arxiv paper-category entry:

relation_id = {'paper_arxiv_id': '1706.03762v7', 'category_id': 'cs.AI'}
research_arcade.delete_edge_by_id("arxiv_paper_category", primary_key=relation_id)
print("Relationship deleted!")

Deleting an ArXiv Citation

Example code for deleting an arxiv citation entry:

citation_id = {
    'citing_paper_id': '1810.04805v2',
    'cited_paper_id': '1706.03762v7'
}
research_arcade.delete_edge_by_id("arxiv_citation", primary_key=citation_id)
print("Citation deleted!")

Deleting an ArXiv Paper-Figures Relationship

Example code for deleting an arxiv paper-figures entry:

# Delete by paper_arxiv_id
paper_id = {"paper_arxiv_id": "2507.13024"}
result = research_arcade.delete_edge_by_id("arxiv_paper_figure", paper_id)

# Delete by figure_id
figure_id = {"figure_id": 1}
result = research_arcade.delete_edge_by_id("arxiv_paper_figure", figure_id)

# Delete by both ids
paper_figure_id = {
    "paper_arxiv_id": "2410.23123v2",
    "figure_id": 476323
}
result = research_arcade.delete_edge_by_id("arxiv_paper_figure", paper_figure_id)

Deleting an ArXiv Paper-Tables Relationship

Example code for deleting an arxiv paper-tables entry:

# Delete by paper_arxiv_id
paper_id = {"paper_arxiv_id": "1706.03762v7"}
result = research_arcade.delete_edge_by_id("arxiv_paper_table", paper_id)

# Delete by table_id
table_id = {"table_id": 1}
result = research_arcade.delete_edge_by_id("arxiv_paper_table", table_id)

# Delete by both ids
paper_table_id = {
    "paper_arxiv_id": "1706.03762v7",
    "table_id": 1
}
result = research_arcade.delete_edge_by_id("arxiv_paper_table", paper_table_id)

Deleting an ArXiv Paragraph-Citations Relationship

Example code for deleting an arxiv paragraph-citations entry:

paragraph_citation = {
    'paragraph_id': 1
}
count = research_arcade.delete_edge_by_id('arxiv_paragraph_citation', paragraph_citation)
print(f"Deleted {count} paragraph citations")

Deleting an ArXiv Paragraph-References Relationship

Example code for deleting an arxiv paragraph-references entry:

paragraph_id = {"paragraph_id": 1}
result = research_arcade.delete_edge_by_id("arxiv_paragraph_reference", paragraph_id)

Deleting an OpenReview Papers-Authors Relationship

Example code for deleting an openreview papers-authors entry:

paper_id = {"paper_openreview_id": "00SnKBGTsz"}
openreview_papers_authors = research_arcade.delete_edge_by_id("openreview_papers_authors", paper_id)
print(openreview_papers_authors.to_dict(orient="records"))

Deleting an OpenReview Papers-Reviews Relationship

Example code for deleting an openreview papers-reviews entry:

paper_review_id = {"paper_openreview_id": "00SnKBGTsz", "review_openreview_id": "13mj0Rtn5W"}
openreview_papers_reviews = research_arcade.delete_edge_by_id("openreview_papers_reviews", paper_review_id)
print(openreview_papers_reviews.to_dict(orient="records"))

Deleting an OpenReview Papers-Revisions Relationship

Example code for deleting an openreview papers-revisions entry:

paper_revision_id = {"paper_openreview_id": "00SnKBGTsz", "revision_openreview_id": "Cn0twOEX1T"}
openreview_papers_revisions = research_arcade.delete_edge_by_id("openreview_papers_revisions", paper_revision_id)
print(openreview_papers_revisions.to_dict(orient="records"))

Deleting an OpenReview Revisions-Reviews Relationship

Example code for deleting an openreview revisions-reviews entry:

revision_review_id = {"revision_openreview_id": "Cn0twOEX1T", "review_openreview_id": "13mj0Rtn5W"}
openreview_revisions_reviews = research_arcade.delete_edge_by_id("openreview_revisions_reviews", revision_review_id)
print(openreview_revisions_reviews.to_dict(orient="records"))

Next Steps

Now that you understand CRUD operations, explore data import and analysis: