Transformation Language Text to Model - eclipse

ATL is a transformation language that allows to make model to model transformations, but I want to know if with this transformation language it's possible to make text to model transformation (already having a defined Ecore metamodel) or I must have to do with another transformation language.
If it is not possible with ATL, what is the transformation language?

This is called "reverse engineering" or "design recovery" depending on how abstract your model is.
To transform "text" to a model, you need a parser for that text, whatever it is.
Typically that text is for a programming language in its full glory. If your text is COBOL, Java, or C++, you need full parsers for those languages and they are not easy to build, as these languages are big, complex, and less well-documented than you would think, and then you get to deal with vendor-specific variants.
A parser isn't enough, either. Model elements represent entities with relationships between them (e.g., classes with "contains", "uses", "calls" relationships). These relationships need to be extracted from the code, thus requiring static analysis of the code to extract such facts. You have to write this analysis in "some" language.
An ideal tool for such a task is an program transformation (PT) system. These tools accept language defintions, parse source code building ASTs (a kind of compiler data structure) and make it possible to transform the code, and/or analyze it to extracts relations of interest, usually written in a DSL specific to the PT system. AFAIK, DMS (my company's PT system) is the only one with mature parsers for common languages. YMMV.

EMFText, Xtext.
I used the first one to implement XPath 2 printer and parser. Also there are a lot of examples here.

Related

how to generate code from a graphical model to a specefic api?

i am building an editor for manipulating graphical elements, each element must represent a type of element in an API Specification.
The elements of the API are basicaly some classes ad interfaces, they have certain usage constraints, like the element A can't be a child of the element B, or can't be connected with the element C, etc...
The editor should allow you to generate code accordinatly to what you have drawn and the generated code must be an implementation of the API that correspond to what you have drawn.
i know nothing (in practice) about model driven architecture and how i can generate code from a graphical model to some implmentation.
i don't want to mix the graphical model(containing graphical informations like the size and the coordinates, etc...) with the business model implementing the API Specification.
I am using eclipse GEF for building the editor
here're the problems i am facing:
Since the graphical model and the business model are separated, i was thinking of defining an emf model, the the editor would be an editor for that emf model. Is it possible then to transform the model drawn in the editor, using the emf model as basic construct elements, to a corresponding implementation of the API specification ?
i know since the graphical model and the business model are separated i have to implement some sort of a grammer sepcifiyng the usage constraints is antlr well suited for what i want to do (speaking about code generation and the grammer) or should i go with xtext ?
what eclipse framework tool whould help me to do what i want to do ?
If you already have a graphical editor, then it seems mostly unnecessary to create a lower-level textual model format (e.g. using antlr/Xtext) to execute code generation. Especially, if your model is already in EMF.
There are various code generator technologies for EMF model (e.g. Acceleo or Xtend can also be used for that); these generator will use the EMF model as an input, and provide the output code specific to the API you seem to be using. In both tools you have to manually assemble your output files by defining templates, and then serialize the results of these templates. This serialization is automatic in Acceleo, or you can do it using a Java-like API in Xtend.
If your model is not in EMF now, you can still use Xtend directly - however, I believe, Acceleo will not useful in this case.

Ecore modification

I have an Ecore model saved to file.
What I want to do is to modify the Ecore model (add elements, supertypes, attributs, delete attributes...)
But I don't want to do it by hand, I want a script / M2M transformation.
What language, tool would you use ?
What you want is transform your Ecore model into another Ecore model. You should have a look at the model transformation projects of the Eclipse Foundation. I would recommend ATL among those projects as it's easy to master for your need (you do not seems to need very complex transformations). If you need a really simple transformation, I'll suggest doing it directly in Java as it may be easier for your to integrate it in your workflow.
Full disclosure: I work for one of the company contributing to ATL.
Can you be more precise please?
I understood you want to modify your source model, however I suppose you want to do it accordingly to some rules. Is that true? Can you exemplify these rules?
That said, I would recommend you to start with Epsilon. It is a powerful language which allows you to define a variety of model-to-model and model-to-text transformations.
Since you're writing a model-to-model transform you should use Java as nothing beats Java for the sorts of navigations, iterations and fine-grained access that you'll need. If you wanted to generate code from the model I'd suggest one of the templating languages, however.

Frameworks for semantic annotation for user defined domain model

I have some documents and an ontology for some concepts. Are there any frameworks that automatically extracts those concepts from the given documents and creates triples? The ontology must contain special properties?
I found UIMA, but as far as I understood with UIMA I can do only something like this:
create some dictionaries which keep associations with the ontology
use this dictionary with ConceptMapper
write a CAS consumer that creates the triples and persists them -
I don't like this approach because I have to keep in sync the concepts from the ontology and the dictionary.
Can be UIMA used differently, or are there any advanced frameworks that can use directly my ontology with lets say some custom properties as input and based on it annotate the documents?
I want to use ontologies as domain model because I want to create further a knowledge base and ontologies seem more flexible than for example relational model.
Thanks.
After spending more time searching on Google I found GATE and more specifically OntoRoot Gazetter and Large KB Gazetteer.
OntoRoot Gazetteer is a type of a dynamically created gazetteer that is, in combination with few other generic GATE resources, capable of producing ontology-based annotations over the given content with regards to the given ontology. This gazetteer is a part of ‘Gazetteer_Ontology_Based’ plugin that has been developed as a part of the TAO project.
I didn't test them but these ones seem good solution candidates for my problem.

Database-independent queries to the extreme in Java... or in general

Let's say I have an app that should ideally be able to use a relational database, object database, XML files, or whatever to persist its data. In the spirit of coding to interfaces instead of implementations, I have a generic DataStore interface that specifies a contract for all I/O involving the data store. This interface can be implemented by concrete classes such as RDBMSDataStore, OODBMSDataStore, XMLFileDataStore, and so on.
This works well as long as I keep the contents of the DataStore interface simple - i.e. getThis(), getThose(), saveThat(), updateThis(), etc. But as soon as I require more complicated queries, it breaks down. The XMLFileDataStore class obviously doesn't understand SQL, and the RDBMSDataStore class obviously doesn't understand XPath/XQuery. And OODBMSDataStore understands something entirely different depending on the OODBMS in use.
I could adopt a language-independent object query language, write all my queries in that and then have the concrete classes translate them into their native language, but that's a huge task, if I want to be complete.
Are there standards or best practices for handling this kind of situation in Java? Unfortunately it seems like 99% of the world interprets "database independence" to mean "relational database independence" and ignores the object databases, XML databases, document databases, etc. entirely.
From the way I read the question, this sounds a lot like the semantic that Hibernate brings to the table for Java. It even has mode for dealing with XML as the content backing store (using Dom4J). The Hibernate API has a number of extension points that could allow the addition of an OODBMS model. Even if Hibernate turns out not to be the best solution for you (implementation-wise), I think it provides a good example of the types of patterns that can be used to solve the problems you proposed.

Should I place a built in Class (such as Date) as a separate class in my UML

I'm creating a UML Class Diagram for an inventory system as part of a class assignment. I used members such as String and Date in a few of my Classes. My group members are saying that I should include a Date class because it is an object.
My assumption is that we were using Java or some other language with a built in Date object.
Do I need to explicitly state a class for Date? What about the String object?
What other languages besides Java has a built in Date type that can be used to develop a client/server such as an inventory system.
UML diagrams are not like architects plans; they are simply a way of communicating something visually. In your case where you’re using the date type in your class, I would just list it as date.
Try to keep the language and framework out of your diagrams as much as possible and just focus on the functionality of your own classes. This keeps it language/framework agnostic and more flexible to change.
Remember change is inevitable; you will make lots of changes to your class diagram over time. If you make it too detailed and complex you will be more resistant to changing it and the diagram will become out of date and useless.
The ultimate design document for your application is the code, not the UML.
For you it will depend on whatever the person marking your assignment wants so you should ask them.
In general there seems little point adding it (thought there is arguably little point in most UML that gets produced)
Modeling is about abstracting unimportant details. So, it depends on how import would Date be in your diagram. If you use heavily objects of that class you might want to show dependency. If your diagram should be language agnostic and you need date functionality, you might create an interface in your diagram which will represent the Date class. This way, if the model created usign your diagram will be used to generate code for different languages(which might not be so likely...) it would be easy to create an Adapter(design pattern) which will realize your interface usign whatever Date implementation target language has. If you want to inherit from Date class (or wrap it), than you will need the Date class as well in your diagram. If your diagrams are going to be a part of a big model and you want to be sure which dependencies you have, it might be useful to create interfaces(or classes) representing underlying system/platform/library infrastructure and put them into separate package.