Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display only a specific relationship type in a Neo4j Browser query

I have a simple Neo4j graph database that I created while trying to model something for a new application. When I run the following query, I get the nodes that I am expecting, but I also get more relationships than I bargained for:

MATCH (o:Office)-[r:REPORTS_VARIABLE_TO]->() 
RETURN o,r

This is what the results look like:

Graph Query Results

Since I specifically requested things that match with [:REPORTS_VARIABLE_TO] I expected to see only that relationship in the results. What I see, though, is all relationships that exist between any matching nodes (as you can see on the bottom of the image).

Is there a way to filter out those relationships that are not of the type I'm looking for?

like image 320
Michael Oryl Avatar asked Jul 06 '16 13:07

Michael Oryl


People also ask

How can you use Neo4j Browser Choose all that apply?

Neo4j Browser is the easiest way to access a Neo4j database. To establish a connection, you enter the DBMS URL, the name of the database you want to connect, and the user credentials. You can also use the :server command to manage the connection to Neo4j. For more information, see Manage connection commands.

How do you show all nodes and relationships in Neo4j?

When you want to return all nodes, relationships and paths found in a query, you can use the * symbol. This returns the two nodes, the relationship and the path used in the query.

What Neo4j Browser command do you use to access a Browser guide?

The guide drawer contains interactive Neo4j Browser guides for learning concepts and tools with Neo4j. Show the guide drawer with a specific Neo4j Browser guide. The name can be specified with or without the Hyphen ( - ) character, e.g, :guide movie-graph or :guide movie graph .

How do I access Neo4j from my Browser?

Launch Neo4j Browser If you are running Neo4j in another environment, Neo4j Browser is available via HTTP at http://localhost:7474 and HTTPS at https://localhost:7473 , substituting the right address for your environment.


2 Answers

Using Neo4j Desktop 1.3.8 and the Neo4j Browser, you need to uncheck the setting "Connect result nodes".

  1. Open the Neo4j Browser for your database.
  2. Click "Browser Settings" gear icon.
  3. Scroll to bottom and uncheck "Connect result nodes"
  4. Re-run your query in the browser

Neo4j Desktop 1.3.8 Settings

like image 134
John Kary Avatar answered Sep 27 '22 20:09

John Kary


For the newest versions (e.g 3.2, 3.3) the "auto-complete" toggle has been moved to the browser settings and its new name is "Connected all results". If it is checked, it connects nodes with all of their relationships. Otherwise, you only see relationships which meet the filtering criteria.

like image 43
Abshakiba Avatar answered Sep 27 '22 18:09

Abshakiba