cancel
Showing results for 
Search instead for 
Did you mean: 

How to represent a business process model in Neo4J

jk05802
Node Link

I started learning Neo4J and pretty new to the concepts. I am not sure if we can represent a business process in Neo4J. Suppose there is a process with different steps to fix a damaged cricket bat. How do I represent the flow and steps?

Also, consider that I am building a website which helps users to fix the damaged cricket bats by themselves. While they going thru the steps on the website, how do I show the recommended products needed to fix the damaged bats on the same web page?(how would I connect these products to that process?)

My questions may be too generic but expecting someone understood my requirement.

Thanks,

JK

2 ACCEPTED SOLUTIONS

ameyasoft
Graph Maven

Here is a first shot:

merge (a:Process {name: "Cricket Bats"})
merge (b:BrokenHandle {process: "Fix Broken Handle"})
merge (c:SeparateDamagedHandle {process: "Use a saw blade and separate the damaged handle from the bat"})
merge (d:ApplyGlue {process: "Apply glue"})
merge (e:FitHandle {process: "Fit the handle"})
merge (f:SmoothenHandle {process: "Smoothen/Clean the handle"})
merge (g:Benchpress {process: "Use benchpress to tight hold the bat"})
merge (h:LetItDry {process: "Leave it for 1 day and use"})

merge (j:RecommendedParts {item1: "Handle"})

merge (a)-[:BROKEN_HANDLE]->(b)
merge (b)-[:FIRST_STEP]->(c)
merge (c)-[:NEXT]->(d)
merge (d)-[:NEXT]->(e)
merge (e)-[:NEXT]->(f)
merge (f)-[:NEXT]->(g)
merge (g)-[:LAST_STEP]->(h)
merge (h)-[:RECOMMENDED_PARTS]->(j)
Result:
Screen Shot 2022-09-21 at 12.15.15 PM.png

View solution in original post

jasperblues
Graph Buddy

@jk05802 What I do is use the BPMN business process modelling language. All business processes are trees (they have exactly one starting point) and all trees are graphs. There can be multiple outcomes.

You can model a business process in BPMN using something like Camunda engine, then export the XML. Following that you can transform the XML to ingest the BPMN graph into Neo4j.

Finally once you have done that, you can ask questions like the following:

* Given I'm on step x in a process, what is the shortest path to desired outcome y?

* For all of the instances of a process, what is the step that takes the longest? If it was sped up by x%, what would the total savings be?

* Given I'm on step x of a process, what are the possible outcomes from here?

I will write a blog about the above in future. In the meantime, have fun!

 

View solution in original post

10 REPLIES 10

ameyasoft
Graph Maven

Q: Suppose there is a process with different steps to fix a damaged cricket bat?

Do you have data for each process and for each damage? The model depends on the available data. 

I do have process with few steps and each step will have descriptions written in sentences.

 

Ex:

Consider, If the handle is broken.

Process name would be "How to fix the broken handle"

Steps look like:

1. Use a saw blade to cut and separate the damaged handle from the bat.

2. Get a new handle and make it in a shape to fit in to the bat.

3. Apply glue

4. Fit the handle.

5. Smoothen/clean the handle

6. Use benchpress to tight hold the bat.

7. Leave it for 1 day and use.

 

In the above steps, we could see the saw blade, glue, bench press and handle right. I want them to be recommended(to buy) on my process web page.

ameyasoft
Graph Maven

Thanks for the update. To recommend the parts to buy, do you have parts list associated with each fix?  

Yes. I do have them.

ameyasoft
Graph Maven

Here is a first shot:

merge (a:Process {name: "Cricket Bats"})
merge (b:BrokenHandle {process: "Fix Broken Handle"})
merge (c:SeparateDamagedHandle {process: "Use a saw blade and separate the damaged handle from the bat"})
merge (d:ApplyGlue {process: "Apply glue"})
merge (e:FitHandle {process: "Fit the handle"})
merge (f:SmoothenHandle {process: "Smoothen/Clean the handle"})
merge (g:Benchpress {process: "Use benchpress to tight hold the bat"})
merge (h:LetItDry {process: "Leave it for 1 day and use"})

merge (j:RecommendedParts {item1: "Handle"})

merge (a)-[:BROKEN_HANDLE]->(b)
merge (b)-[:FIRST_STEP]->(c)
merge (c)-[:NEXT]->(d)
merge (d)-[:NEXT]->(e)
merge (e)-[:NEXT]->(f)
merge (f)-[:NEXT]->(g)
merge (g)-[:LAST_STEP]->(h)
merge (h)-[:RECOMMENDED_PARTS]->(j)
Result:
Screen Shot 2022-09-21 at 12.15.15 PM.png

Thank you @ameyasoft for writing the queries and explaining me with the graph. Appreciate it!

jasperblues
Graph Buddy

@jk05802 What I do is use the BPMN business process modelling language. All business processes are trees (they have exactly one starting point) and all trees are graphs. There can be multiple outcomes.

You can model a business process in BPMN using something like Camunda engine, then export the XML. Following that you can transform the XML to ingest the BPMN graph into Neo4j.

Finally once you have done that, you can ask questions like the following:

* Given I'm on step x in a process, what is the shortest path to desired outcome y?

* For all of the instances of a process, what is the step that takes the longest? If it was sped up by x%, what would the total savings be?

* Given I'm on step x of a process, what are the possible outcomes from here?

I will write a blog about the above in future. In the meantime, have fun!

 

Thank you so much @jasperblues. I was looking for this answer. Will try to use Camunda and ingest BPMN graph into Neo4J. Looking forward to reading your blog. 

Welcome @jk05802. There is a bit of a learning curve, but it will be worth it. Feel free to ping me if you get stuck.

Sure. Thank you so much!

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.