Search code examples
sqlgremlingraph-traversaldatalogturing-complete

Turing complete graph query languages


Is it accurate to say that of the existing graph query languages (Cypher, Datalog, Sparql etc) Gremlin is the only one that's Turing complete?

In case it matters, I'm not looking for edge cases like the Turing completeness proof of Magic: the Gathering; the intent of my question is whether Gremlin is the only graph query language that is suitable in practice for performing arbitrary computation on graphs.


Solution

  • I'm not sure about what you include in the etc.. But I think your statement is correct. As you say that you are not looking for edge cases or exotic manipulation of the language.

    1. Cypher is not turing complete
    2. SQL is not properly t.c.
    3. By any practical definition, SPARQL is not t.c.
    4. Datalog is not t.c.
    5. AQL is more or less as powerful as standard SQL

    Yet, we should not look at turing completeness as a must-have feature. The power of declarative query languages is that the hard work is done by the system, while the user just describes what they are looking for. This has the added advantage that the system is able to find optimized plans to get to the right information.