0

I am using this json for insert vertex...

{
    "id": "15",
    "label": "organization",
    "orgid": [{
        "_value": "15",
        "id": "5267ec4b-a39e-4d77-8dea-668cb36307bc"
    }],
    "name": [{
        "_value": "org.15",
        "id": "2e5271a6-ddd8-48b9-8ff6-be41e19f82f8"
    }],
    "org": "org"
}

...and its working fine..but the problem is when I am trying to insert Edge ..this is my json for Edge ... Pattern 1:

{
    "label": "parent",
    "id": "b9ae257a-ab49-487b-a165-57bd5330168b",
    "_sink": "15",
    "_sinkLabel": "organization",
    "_sinkPartition": "org|10",
    "_vertexId": "10",
    "_vertexLabel": "organization",
    "_isEdge": true,
    "org": "org"
}

Pattern 2.

{
    "id": "b9ae257a-ab49-487b-a165-57bd5330168b",
    "label": "parent",
    "type": "edge",
    "inVLabel": "organization",
    "outVLabel": "organization",
    "inV": "15",
    "outV": "1"
}

.. I tried both but no result ...it saved as Vertex not Edge....

Please someone help me to figure it out...I need the valid json format for insert an Edge...

Thank you!


N.B.: From code behind I did this already, now my challenge is to save BULK data from json to Cosmos Graph DB (Gremlin API) by using Azure Data Factory 'Copy' activity.


  • Leonard Lobel covers proper GraphSON syntax and using the SQL API to access graph data in the final module of his Pluralsight course [Learning Azure Cosmos DB](https://app.pluralsight.com/library/courses/azure-cosmos-db/table-of-contents). – coryseaman Oct 14 '21 at 02:08

1 Answers1

1

What you really want to do here is to use so called ".NET SDK URI" that your Gremlin API account exposes (not the default Gremlin endpoint) - you can find it in the Overview page of Azure Portal for your Cosmos DB account - this exposes little known feature of Gremlin API which is interoperability with SQL API, which is core Cosmos DB API much better suited for bulk operations. So, once you figure out the exact data model for vertices and edges in your graph, just populate your container from ADF using this .NET SDK endpoint as if it was yet another SQL API account. Once all vertices and edges fall into place, you can use your Gremlin endpoint to interact with the graph.

alekseys
  • 321
  • 1
  • 6
  • Here's hoping the Data Factory roadmap contains an eventual Cosmos DB (Gremlin API) connector...I'm sure they've been reluctant to tackle the graph paradigm in a mapping UI. – coryseaman Oct 14 '21 at 02:01