Write your own query
Every answer in Syncretic comes from a database query. You can read the ones the AI writes, change them, or write your own from scratch.
What Cypher is
Your graph is stored in a graph database, and Cypher is the language for asking it questions. A query describes a pattern of nodes and relationships, and gets back everything that fits. (p:Person)-[:PROPOSED]->(i:Idea) reads as “a Person who PROPOSED an Idea”. When you ask a question in plain English, the AI writes a Cypher query like this and runs it on your Mac. You don’t need Cypher to use Syncretic; this page is for when you want exact control.
Turn on Raw Cypher
- Press ⌘F to open the search bar.
- Click the chip at the right of the bar and choose Raw Cypher, or press ⌘4.
- Type a query and press Return.
The bar switches to a monospaced font and runs exactly what you type. No AI is involved.
Try it
Example queries
These run on the History of science graph: node types Person, Idea, Field and Work, joined by the relationship types PROPOSED, BUILDS_ON, PART_OF, PUBLISHED_IN, WROTE and INFLUENCED.
Who proposed what:
MATCH (p:Person)-[:PROPOSED]->(i:Idea) RETURN p, iWho influenced Einstein:
MATCH (a:Person)-[:INFLUENCED]->(b:Person) WHERE b.name = 'Albert Einstein' RETURN a, bIdeas before 1900, oldest first:
MATCH (i:Idea) WHERE i.year < 1900 RETURN i ORDER BY i.yearIdeas in physics:
MATCH (i:Idea)-[:PART_OF]->(f:Field) WHERE lower(f.name) = 'physics' RETURN i, fWhat General relativity builds on, up to three steps back:
MATCH p = (a:Idea)-[:BUILDS_ON*1..3]->(b:Idea) WHERE a.name = 'General relativity' RETURN pThe shortest chain of influence from Copernicus to Einstein:
MATCH p = (a:Person)-[:INFLUENCED* SHORTEST 1..6]->(b:Person)
WHERE a.name = 'Nicolaus Copernicus' AND b.name = 'Albert Einstein'
RETURN pThe five people with the most relationships, as a table:
MATCH (p:Person)-[r]-() RETURN p.name AS person, count(r) AS relationships ORDER BY relationships DESC LIMIT 5How many ideas there are, as one number:
MATCH (i:Idea) RETURN count(i) AS ideasWhat you get back
- Return whole nodes (
RETURN p, i) and they light up on the canvas, with a table of results under the bar. - Return values (
RETURN p.name AS person, …) and you get a table. - Return one value and you get a single big number.
Large answers come onto the canvas a page at a time, in the order your ORDER BY sets. See Ask questions.
Completion
The bar suggests as you type, based on your schema:
- after
:inside( ), your node types; inside[ ], your relationship types - after a variable and a dot (
p.), that node type’s properties, each with its plain name and kind (“Summary · Text”) - anywhere else, the query’s own variables, keywords like
MATCH,WHEREandORDER BY, and functions with a note on what each does
Press Tab to accept the top suggestion. Return still runs the query, unless you’ve moved to a suggestion with the arrow keys. A function comes with its brackets and the cursor between them.
As you type, keywords, names, strings and numbers each get their own colour. A node type your schema doesn’t have turns red with a dotted underline.
See the AI’s query
Ask in plain English, then read the query the AI wrote. See the AI’s query →
Queries only read
Asking can never change your graph. Before a query runs, a check refuses anything that would write, and the query then runs in a read-only transaction as a second safeguard. A refused query says why, for example Not run: Ask only reads your graph. This query uses DELETE, which would change it.
Answers stop at 500 rows (“Stopped at 500 rows. The query matches 2,314.”).
Your Raw Cypher queries are saved in History like any question. While you’re in Raw Cypher, the bar’s Recent list shows only queries you typed in Raw Cypher.
The names to use
Queries use your graph’s database names, which Syncretic makes from the names you gave:
| You named it | In a query |
|---|---|
| a node type, free energy principle | FreeEnergyPrinciple |
| a relationship type, relates to | RELATES_TO |
| a property, Year published | year_published |
| a name that’s a Cypher keyword, contains | CONTAINS_ (shown as CONTAINS in the app) |
Node types become PascalCase, relationship types UPPER_SNAKE, properties snake_case. Completion lists them all, and the AI’s queries show them in use. Every node and relationship also has an id column holding its UUID.
Syncretic’s dialect
The database is LadybugDB, which speaks the Kuzu dialect of Cypher. If you’ve learned Cypher from Neo4j examples, these are the differences that matter:
label(n)gives a node’s type, or a relationship’s type. There is nolabels()ortype().- Variable-length paths always need an upper bound:
-[:REL*1..3]->. Shortest paths are-[:REL* SHORTEST 1..6]->. - A property with no value is
NULL. Test withIS NULLorIS NOT NULL. - String functions include
lower,upper,contains,starts_with,ends_withandregexp_matches. - Aggregates like
countgroup implicitly by the other returned columns. - Two-way relationships are stored one way, so match them without a direction:
(a)-[:RELATES_TO]-(b). - To match one node by its id:
MATCH (n {id: upper('5f3a…')}).
Everything the read-only check refuses
These keywords are refused when used as keywords: CREATE, MERGE, SET, DELETE, DETACH, REMOVE, DROP, ALTER, COPY, INSTALL, LOAD, ATTACH, USE, EXPORT, IMPORT, BEGIN, COMMIT, ROLLBACK, CHECKPOINT and CALL. More than one statement in a query is refused too.
The same words are fine as names: a property called set (n.set) or a node type called Create won’t trip the check.
Queries sent by other AI apps connected to Syncretic go through the same check, with a limit of 1,000 rows instead of 500. See Use with other AI apps.