# Designing a query language

**URL:** <https://org-roam.discourse.group/t/designing-a-query-language/1075>\
**Category:** Development\
**Created:** [December 20, 2020, 12:25pm UTC](https://org-roam.discourse.group/t/designing-a-query-language/1075 "2020-12-20T12:25:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/shlevy/32/555_2.png) [@shlevy](https://org-roam.discourse.group/u/shlevy)\
**Post date:** [December 20, 2020, 12:25pm UTC](https://org-roam.discourse.group/t/designing-a-query-language/1075/1 "2020-12-20T12:25:33Z")

</div>

I’m starting this thread to collect ideas for what a first class query language over a set of org-roam notes might look like. Some kinds of capabilities/questions I personally like to see:

- Typical nested boolean logic-style combinations (and, or, not)
- A “links to X, up to depth N” predicate
- A “links from X, up to depth N” predicate
- Filtering on tags

Additionally, and perhaps this is a separate topic, I think some kind of fuzzy/approximate matching would be great. In my ideal world I’d be incrementally training some ML system to serve up things I might not have thought to link together, where depending on my needs I can crank a “noise” dial up or down.

---

<div class="post-metadata">

**Author:** ![shlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/shlevy/32/555_2.png) [@shlevy](https://org-roam.discourse.group/u/shlevy)\
**Post date:** [December 20, 2020, 12:57pm UTC](https://org-roam.discourse.group/t/designing-a-query-language/1075/2 "2020-12-20T12:57:29Z")

</div>

Thinking about this a bit further, maybe what we really want is a first class graph query language. I haven’t looked into [graphql](https://graphql.org/) yet, but perhaps this would be a good place to start.

---

<div class="post-metadata">

**Author:** ![togakangaroo](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/togakangaroo/32/379_2.png) [@togakangaroo](https://org-roam.discourse.group/u/togakangaroo)\
**Post date:** [December 21, 2020, 2:56am UTC](https://org-roam.discourse.group/t/designing-a-query-language/1075/3 "2020-12-21T02:56:39Z")

</div>

Correct me if I’m wrong but graph ql doesn’t take do that. Not surprisingly at this point, the graph query language isn’t really about querying graphs but about standardizing the various ways people query entities. There is no way to say “all notes less than three links away from foo”

I would maybe look to the graph databases like neo4j for inspiration

---

<div class="post-metadata">

**Author:** ![JeffBrown](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/jeffbrown/32/254_2.png) [@JeffBrown](https://org-roam.discourse.group/u/JeffBrown)\
**Post date:** [December 21, 2020, 4:31pm UTC](https://org-roam.discourse.group/t/designing-a-query-language/1075/4 "2020-12-21T16:31:21Z")

</div>

Neo4j can do that. So can Gremlin, which is cross-platform.

Building on the idea of “show me any successor (or predecessor) within N links of file F”, it would be nice to be able to say “given a set Fs of files satisfying some search, show me any sucessor (or predecessor) within N links from anything in F”.
