npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dortdb/lang-cypher

v1.0.0

Published

Cypher parser and executor for DortDB

Readme

DortDB - Cypher Language Partial Implementation

This package is a language plugin for DortDB. It adds support for Cypher data selection queries.

Data adapter

The default data adapter implementation allows queries against Graphology graphs. The language can be configured with the name of the default graph to query.

const lang = Cypher({
  defaultGraph: 'myGraph',
});

It is also possible to specify the queried graph in the query itself:

FROM myOtherGraph
MATCH (n)
RETURN n

Differences between DortDB and openCypher

The DortDB Cypher language is parsed with an LALR(1) parser, which is not powerful enough for the original openCypher grammar, as it has only a limited lookahead. The grammar contains constructs that would be ambiguous during parsing. Certain patterns are, therefore, parsed a certain way, even though it means that some otherwise valid queries will fail.

Node patterns or parenthesized expressions

If the input can be interpreted as either the start of a node pattern or a parenthesized expression, the parser will always choose the node pattern.

  • (a) is a node pattern
  • (a:Label) is a node pattern
  • ({prop: value)} is a node pattern
  • ($param) is a node pattern

Because of this, (a:Label = true) will cause a parsing error, because it is already considered a node pattern, even though it would be a valid expression in the original grammar, checking whether the a variable has the Label label. The same goes for (prop: value.prop). More complex parenthesized expressions starting with a variable or a parameter are not affected, for example, ($param = true) or (a + a) are valid expressions. This should not cause any issues, as it is always possible to interpret the input as expressions by removing the parentheses. The label check expression a:Label has the highest precedence, so parentheses would not do anything anyway, and the rest are simply parentheses around atomic expressions.

Operators

The following symbol combinations are considered a part of relationship patterns and will not be interpreted as operators. If necessary, it is always possible to clarify the meaning by adding parentheses.

  • <-[ (e.g., it will never be parsed as a comparison like a < -[b])
  • <--
  • --
  • -[

List/pattern comprehension or list literals

Cypher includes special syntax for list comprehension and pattern comprehension.

RETURN [x IN range(0,10) WHERE x % 2 = 0 | x^3] AS result
MATCH (a:Person)
RETURN [(a)-[:KNOWS]->(b) WHERE b:Person | b.name] AS friends
MATCH (a {id: 1})
RETURN [path = (a)-[:KNOWS*]->(b) | size(path)] AS foafDistances

If the input can be interpreted as either the start of a list/pattern comprehension or a list literal, the parser will always choose the list/pattern comprehension. More specifically, if the input starts with:

  • [variable IN
  • [variable = (pattern)

Then it is no longer possible to interpret it as a list literal (even though in the original grammar, [variable IN list1, variable IN list2] would be a valid list literal containing two booleans).

Reserved words

In addition to the regular reserved words, the following words need to be escaped before they can be used as identifiers.

  • COUNT
  • ANY
  • NONE
  • SINGLE