Skip to content

Provides a typescript implementation that validates a Cypher query string against a simple schema definition and fixes relationship directions when necessary.

License

Notifications You must be signed in to change notification settings

yWorks/cypher-query-validator

Repository files navigation

Cypher-Validator

This Typescript package can be used to validate cypher queries. With the help of a simple schema, the validator will check and correct the directions of relationship patterns.

There is only one public API and that is the "validate" method:

type RelationshipTuple = {
  sourceLabel: string;
  relationshipType: string;
  targetLabel: string;
};

function validate(cypher: string, schema: RelationshipTuple[]): string;

It will return '' for invalid Cypher and will otherwise correct the arrow heads on directed queries to match the schema, when possible.

Copyright 2023, Sebastian Mueller, yWorks GmbH

The antlr file is derived from https://github.com/neo4j/cypher-editor/tree/main/packages/antlr4 copyrighted under Apache 2.0 license, Neo4j 2023. Thanks!

Licensed under Apache 2.0

About

Provides a typescript implementation that validates a Cypher query string against a simple schema definition and fixes relationship directions when necessary.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published