Dmx-cooking: A showcase for modeling and for writing a plugin

From the modeling example…
At DMX, we recently produced a 15 min. video tutorial to show how to build a data model. We picked an easy, vivid example: Cooking - this moment when you stand in front of the fridge and wonder what you could cook with what you have in there. The data model should let us enter everything we need to answer the following questions:

  • What can I cook with the ingredients I search for?
  • Which quantities and which other ingredients do I need?
  • Where do I find the recipe?

You can play with the according demo content on our demo server. We decided to create the data model and the sample data (the content) in two different workspaces. This permits to give different groups access to each workspace. Some people in a team might work only on the data model while others just enter content.
Data Model:
Sample Data:

… to the coding example
Out of curiosity I wanted to learn how to achieve the same without entering everything manually. I wanted to try and write a plugin for this use case to find out how difficult it is as I hardly know any Java. The plugin was supposed
a) to declare the Topic Types and Association Types we built manually in the tutorial (vegetable, spice, etc.).
b) to predefine a huge set of Topics (zucchini, salt, etc.)
c) to automatically chose the right association type for ingredients every time some creates an association between the declared food topics and a dish. We call this feature autotyping. It is something you can only achieve with programming, you cannot model this in the web client.

With the plugin template and a bit of help from @jri I was able to create the plugin. You can investigate it here. It has a few inline comments so you can hopefully find your way around:

I really encourage you to try this! Writing a plugin can save you a lot of work if you have a large quantity of items to define in your project and it is actually a lot of fun!