The Knowledge Graph Conference Icon
The Knowledge Graph Conference
  • 馃彔Home
  • 馃搮Events
  • 馃懁Members
  • 馃數Announcements
  • 馃數Ask
  • 馃數Ask The Ontologists
  • 馃數Events
  • 馃數Jobs
  • 馃數Promotions
  • 馃數Share
Powered by Tightknit
Ask
Ask

Connecting Graph DB with Python Backend: Examples Needed

Avatar of Ellie Y.Ellie Y.
路Feb 07, 2024 05:26 PM

Hi folks! Does anyone have application code they can share, showing how a graph DB is connected to a python (fastAPI, Django) backend? Or instructions/examples of how to do this?

14 comments

路 Sorted by Oldest
  • Avatar of Matteo L.
    Matteo L.
    路

    what graph DB? triplestore? you can use SPARQLWrapper graph DB there is for example https://neo4j.com/docs/getting-started/languages-guides/neo4j-python/ not sure if I got your question correclty

  • Avatar of Ellie Y.
    Ellie Y.
    路

    Open to any graphDB but looking specifically for terminusDB or AllegroGraph

  • Avatar of Matteo L.
    Matteo L.
    路

    sorry these two I've never used before 馃槙 but i expect sparql wrapper to work with allegro

  • Avatar of Matteo L.
    Matteo L.
    路

    https://franz.com/agraph/support/documentation/current/sparql-reference.html

  • Avatar of Ellie Y.
    Ellie Y.
    路

    Thank you! We鈥檙e specifically looking for an example integration - do you know of any code base that puts this wrapper into use?

  • Avatar of Matteo L.
    Matteo L.
    路

    i am not sure to understand what you mean by integration. Allegrograph exposes a sparql endpoint https://franz.com/agraph/support/documentation/current/http-protocol.html you find the correct URL for your deployment and replace it in the instantiation of SPARQLWrapper https://sparqlwrapper.readthedocs.io/en/latest/main.html#how-to-use this allows you to send queries and process answers

  • Avatar of Matteo L.
    Matteo L.
    路

    from python

  • Avatar of Matteo L.
    Matteo L.
    路

    i am not aware for ORM support though if that is what you are looking for

  • Avatar of Fran莽ois S.
    Fran莽ois S.
    路

    Hey Ellie! Most graph databases expose a SPARQL endpoint that can then be queried directly through HTTP or using a wrapper such as RDFLib sparql wrapper (posted above by Matteo)

    鉂わ笍1
  • Avatar of Ellie Y.
    Ellie Y.
    路

    Thank you, Francois :)

  • Avatar of Bob DuCharme
    Bob DuCharme
    路

    RDFLib does a lot more than provide a SPARQL wrapper. (It's actually older than SPARQL!) It can do a lot of other things that should help with the integration.

    馃檹1
  • Avatar of Ellie Y.
    Ellie Y.
    路

    Thanks, Bob!

  • Avatar of Vladimir A.
    Vladimir A.
    路

    There are a number of ORM (object-RDF Mapping) frameworks, Empire and Alibaba come to mind. But for a more dynamic "ORM-like" functionality, check out GraphQL

    馃檹1
  • Avatar of Ellie Y.
    Ellie Y.
    路

    Great tip, thank you Vladimir!