Laureeens
Laureeens

Reputation: 23

Model as Backend

first of all: I'm new to the EMF world. I worked through the Book "Model driven software engineering in practice" and now I want to apply this in a project:

I "meta modelled" my Project and implemented some OCL Constraints, which is therefore like a semantic database schema.

  1. What i don't understand is, how i implement the business logic? Is this just possible with OCL Constraints and Model transformations? It would be very overengineered if i would implement everything with henshin.

  2. i want to use my model as a "backend". that the client can access some parts of the model via REST. What possibities do I have to make it happen?

Thank you, Laurens

Upvotes: 2

Views: 323

Answers (3)

Jordi Cabot
Jordi Cabot

Reputation: 8228

You may want to take a look at our EMF Rest tool https://som-research.uoc.edu/tools/emf-rest/

We have not been updated it in a while but it could be used as an example of what you could build

Upvotes: 1

Mad Matts
Mad Matts

Reputation: 1116

As already mentioned there OCLinEcore which is Xtext based. Xtext does now fully support the Language Server Protocol, which means you can keep your model on a server and interact with it either via REST, Json-RPC or even websockets. The guys from xtext recently came up with Sprotty, which is a

web based, diagramming framework

This might be interesting for you, because it demonstrates how to use a model server. Here are also some slides about sprotty and also the Xtext LSP Architecture. Sprotty is targeted towards diagramming support in the browser, but I think the server architecture might get you started, even if you don't need a front end or an editor.

Upvotes: 0

Ed Willink
Ed Willink

Reputation: 1498

If you are using EMF, you probably want to use Eclipse OCL or Dresden OCL.

(As the primary Eclipse OCL author I can answer for Eclipse OCL. Perhaps a Dresden OCL author may give you an alternative answer.)

Eclipse OCL provides an Xtext-based OCLinEcore editor that allows you to embed your OCL as EAnnotations within your Ecore model, thereby implementing your business logic. You may also choose to have your embedded OCL genmodelled as direct Java code rather than interpreted OCL. See the OCL tutorials in the OCL documentation accompanying the Eclipse OCL distribution.

Alternatively you may use the Xtext-based Complete OCL editor to maintain your OCL as a complementing document for your metamodel. There is currently no direct Java code generation for this approach and you need to arrange to import the Complete OCL document into your consuming application.

I an enthusiastic supporter of M2M so I would recommend using an M2M, Henshin if that is your favourite, to define your transformations resorting only to OCL or Java to flesh out some per-class queries. EMF provides a nice isolation so that EMF applications can be substantially ignorant of the technologies used to implement EOperations.

Upvotes: 2

Related Questions