cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Visualization neovis

hello,
I have 900 data with 3 labels: company, jobs and industry. I relation it to a query:
MATCH (c:company), (i:industry), (j:jobs) where i.id=c.id AND c.id=j.id CREATE (i)<-[:kategori]-(c)-[:menyediakan]->(j)

when I want to display the type of industry with cyper:
MATCH p=(i:industry{jenisIndustry:"Elektrikal & Elektronik"})<--(c:company)-->(j:jobs) return p

the results:

how to make nodes jenisIndustry: "Elektrikal & Elektronik" (red nodes) gathered together??
Does the error in the relation or query display it??

thanks.

3 REPLIES 3

I think the search results are correctly showing multiple copies.

I believe

CREATE (i)<-[:kategori]-(c)-[:menyediakan]->(j)

is creating multiple copies of the node "Elektrikal & Elektronik" (as well as other duplicate nodes/relationships if I understand your goal).

Take a look at MERGE

https://neo4j.com/docs/cypher-manual/current/clauses/merge/

hello joel,
thank you for answering.

but I want to ask again.
if I want to make a company label with property: business name, business address, company site, work capacity, time of work, benefits, language, uniform.

but I wanta business name, made MARGE, while the other property is CREATE, how is the right clause?

thanks

Fun question. Couple questions.

  1. what's the problem you're modeling? Sometimes, that's better stated: what's the goal/role of this graph modeling?
  2. your model has i.id==c.id==j.id. Is this desired based on the answer to the first question?

If question 2 is desired, then with or without a MERGE clause, you'll get what you're showing. But, i think you want a 1..* relationship between industry and companies so you can say, count the number of Elektrikal companies in the graph. More interesting is the relationship between company and what they "menyediakan" (had to look that up ). What's offered here for that relationship is "job" but that could grow into something much more insightful.

So there's some ideas to start with and this last point starts the discussion about why graphs are more powerful tools for modeling than RDBMS'. The cypher for that will CREATE the industry node initially and using MERGE will avoid duplication. The fundamental question is in the id values all being equal.

Alternately, if this is just a way of knowing the attributes of a company and getting queries for that class of problem, then a simple spreadsheet or RDBMS will be easier using a foreign key to the industry type in the company table or just repeat the value in the industry column in the spreadsheet. You still want a single id for industry and individual id values for unique companies and unique jobs. But it'll be hard to get the cool graph pic

Finally, note that the id values do not define the relationships. In an RDBMS, it'll be the foreign key. In a graph, it's the from-to relationship which in my opinion, is less restrictive and more powerful.

HTH