Quickstart ---------- .. raw:: html Open In Colab .. code-block:: python from rdflib import Graph from arango import ArangoClient from arango_rdf import ArangoRDF db = ArangoClient().db() adbrdf = ArangoRDF(db) def beatles(): g = Graph() g.parse("https://raw.githubusercontent.com/ArangoDB-Community/ArangoRDF/main/tests/data/rdf/beatles.ttl", format="ttl") return g **ArangoDB to RDF** **Note**: RDF-to-ArangoDB functionality has been implemented using concepts described in the paper `Transforming RDF-star to Property Graphs: A Preliminary Analysis of Transformation Approaches `_. So we offer two transformation approaches: 1. `RDF-Topology Preserving Transformation (RPT) <./rdf_to_arangodb_rpt.html>`_ 2. `Property Graph Transformation (PGT) <./rdf_to_arangodb_pgt.html>`_ .. code-block:: python # 1. RDF-Topology Preserving Transformation (RPT) adbrdf.rdf_to_arangodb_by_rpt(name="BeatlesRPT", rdf_graph=beatles(), overwrite_graph=True) # 2. Property Graph Transformation (PGT) adbrdf.rdf_to_arangodb_by_pgt(name="BeatlesPGT", rdf_graph=beatles(), overwrite_graph=True) We now also offer a third transformation approach: 1. `Labeled Property Graph Transformation (LPG) <./rdf_to_arangodb_lpg.html>`_ This approach is useful when you want to combine the benefits of RPT and PGT: - Uses one ArangoDB Collection for all RDF Resources - Uses one ArangoDB Collection for all RDF Statements - Stores literal statements as ArangoDB Document Properties .. code-block:: python adbrdf.rdf_to_arangodb_by_lpg(name="BeatlesLPG", rdf_graph=beatles(), overwrite_graph=True) # Apply RDF type statements as ArangoDB Document Attributes adbrdf.migrate_edges_to_attributes( "BeatlesLPG", "Edge", "_type", filter_clause="e._label == 'type'" ) **RDF to ArangoDB** .. code-block:: python # pip install arango-datasets from arango_datasets import Datasets name = "OPEN_INTELLIGENCE_ANGOLA" Datasets(db).load(name) # 1. Graph to RDF rdf_graph = adbrdf.arangodb_graph_to_rdf(name, rdf_graph=Graph()) # 2. Collections to RDF rdf_graph_2 = adbrdf.arangodb_collections_to_rdf( name, rdf_graph=Graph(), v_cols={"Event", "Actor", "Source"}, e_cols={"eventActor", "hasSource"}, ) # 3. Metagraph to RDF rdf_graph_3 = adbrdf.arangodb_to_rdf( name=name, rdf_graph=Graph(), metagraph={ "vertexCollections": { "Event": {"date", "description", "fatalities"}, "Actor": {"name"} }, "edgeCollections": { "eventActor": {} }, }, )