Nhogs / popoto

Visual query builder for Neo4j graph database
http://popotojs.com
GNU General Public License v3.0
498 stars 70 forks source link

How to give Custom CYPHER Queries? #92

Closed Deepam-Rai closed 1 year ago

Deepam-Rai commented 1 year ago

Can we provide custom CYPHER query and then build the graph visualization?
Queries like:

MATCH (p:Person)-[r:DIRECTED]->(m:Movie) RETURN p,r,m

And display the results in usual way how neo4j browser displays.

evahaudi commented 1 year ago

I would also want to know how one can use a customized cipher query, please respond.

Popotojs commented 1 year ago

Popoto is NOT a graph visualization library but a visual query builder. The graph is equivalent to the “cypher” query and not a graph of the results. The root node of the graph is the target of the search query and the graph is dynamic to add constraint to the query. So only specific Cypher queries structures are supported.

That said, you can't provide a custom Cypher query but it is possible to start a graph using a schema with predefined constraints, see this example: https://github.com/Nhogs/popoto-examples/tree/master/start-from-schema You can look at the source code for details.

Deepam-Rai commented 1 year ago

Thank you, that was clarifying. Great work tho!

darioamorosodaragona-tuni commented 8 months ago

Can we have more details about how the schema works? I cannot find any information on the wiki. I defined my schema but I got an 'undefined' node.

Popotojs commented 8 months ago

You can have a look at start-from-schema example the schema is defined like this:

    var schema = {
        label: "Person",
        rel: [
            {
                label: "ACTED_IN",
                target: {
                    label: "Movie",
                    value: {
                        title: "Jerry Maguire"
                    }
                }
            },
            {
                label: "ACTED_IN",
                target: {
                    label: "Movie",
                    value: {
                        title: "Top Gun"
                    }
                }
            }
        ]
    };

Or this save example: This example contains 5 differents predefined schema you can click on the left to start popoto with. It also show how to save a graph schema from current graph.

darioamorosodaragona-tuni commented 8 months ago

Yes, but for example is not specified anywhere that the property in the value field must be the first and the same property declared in the provider.node.Provider in returnAttributes.