Skip to content

Conversation

@aMahanna
Copy link
Member

@aMahanna aMahanna commented Aug 27, 2025

⚠️ Breaking change, warrants a major release ⚠️

Refactors the migrate_edges_to_attributes() function to support attribute migration beyond 1-hop traversals.

As a result, the method signature has changed:

def migrate_edges_to_attributes(
        self,
        graph_name: str,
        edge_path: list[str], # <---- replaces edge_collection_name
        attribute_name: Optional[str] = None,
        edge_direction: str = "OUTBOUND",
        max_depth: int = 1,  # <---- new
        sort_clause: Optional[str] = None,
        return_clause: Optional[str] = None,
        filter_clause: Optional[str] = None,
        traversal_options: Optional[dict[str, Any]] = None,
    ) -> int:

Example:

        @prefix ex: <http://example.com/> .
        @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

        ex:Alice a ex:Human .

        ex:Bob a ex:Person .

        ex:Charlie a ex:Animal .

        ex:Dana a ex:Entity .

        ex:Eve a ex:Human .
        ex:Eve a ex:Person .

        ex:Fred a ex:Human .
        ex:Fred a ex:Individual .

        ex:Human rdfs:subClassOf ex:Animal .
        ex:Person rdfs:subClassOf ex:Individual .
        ex:Animal rdfs:subClassOf ex:Entity .
        ex:Individual rdfs:subClassOf ex:Entity .

Use-case:

# PGT
adbrdf.rdf_to_arangodb_by_pgt(graph_name="MyGraph", ...)

adbrdf.migrate_edges_to_attributes(
    graph_name="MyGraph",
    edge_path=["type", "subClassOf"],
    max_depth=1,
)

# LPG
adbrdf.rdf_to_arangodb_by_lpg(graph_name="MyGraph", ...)

adbrdf.migrate_edges_to_attributes(
    graph_name="MyGraph",
    edge_path=["Edge"],
    max_depth=1,
    filter_clause="e._label == 'type'"
)

In this graph example:

  • With max_depth=1, the subClassOf edges are ignored
  • With max_depth=2, the subClassOf edges are included, but not all of them
  • With max_depth=3, the subClassOf edges are all included

Example output:
image

@coveralls
Copy link

coveralls commented Aug 27, 2025

Pull Request Test Coverage Report for Build 20825545993

Details

  • 20 of 20 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 94.582%

Totals Coverage Status
Change from base Build 20343458736: 0.03%
Covered Lines: 1187
Relevant Lines: 1255

💛 - Coveralls

@aMahanna aMahanna changed the title new: second_order_edge_collection_name refactor: migrate_edges_to_attributes Jan 8, 2026
@aMahanna aMahanna merged commit 0416a4b into main Jan 8, 2026
8 checks passed
@aMahanna aMahanna deleted the migrate-edges-to-attributes-with-second-order branch January 8, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants