-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Cypher Tools | ||
|
||
Experimental project exposing cypher tooling features as a rest service. | ||
|
||
## Docker image | ||
|
||
The docker image is available as `graphaware/cypher-tools:<tag>`. | ||
|
||
Ex : | ||
|
||
```bash | ||
docker run --rm -it --name cypher-tools-1 -p 8080:8080 graphaware/cypher-tools:1.0.0 | ||
``` | ||
|
||
## Schema enforcement | ||
|
||
LLM based Cypher query generation can lead to relationships being in the wrong direction, the following endpoint allows | ||
you to fix the directions of a query based on a provided list of schema relationships. | ||
|
||
Example : | ||
|
||
**Generated query** : | ||
|
||
```cypher | ||
MATCH (n:Person)-[:OWNED_BY]->(v:Vehicle) | ||
RETURN n.name, v.model | ||
``` | ||
|
||
However, the database schema has the relationship between the vehicle and the person instead `(Vehicle)-[:OWNED_BY]->(Person)` | ||
|
||
Fix it by calling the `cypher` endpoint | ||
|
||
```bash | ||
curl --location 'http://localhost:8080/enforceSchema' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"cypher": "MATCH (n:Person)-[:OWNED_BY]->(v:Vehicle) RETURN n.name, v.model", "relationships": ["(Person, LIVES_IN, City)","(Person, HAS_ACCOUNT, UserAccount)","(Vehicle, LICENCED_TO, LicensePlate)","(Vehicle, OWNED_BY, Person)"]}' | ||
``` | ||
|
||
Response : | ||
|
||
```json | ||
{ | ||
"cypher": "MATCH (n:`Person`)<-[:`OWNED_BY`]-(v:`Vehicle`)\nRETURN n.name, v.model" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters