GVNIX and spatial searchs - customization

I have installed this great development tool and I´m testing how can I use spatial queries or customize other functions.
For example, in the petclinic-geo project create a new map that shows only the owners inside Valencia (area). I think there is no roo commands that can create spatial queries.
In this case, how can I create new custom functions ?, Do I need to remove Roo to do that or either codes can coexist?
Thanks

Sorry Allen, Currently this feature is not implemented on framework. But, in gvNIX 2.0 roadmap (current in definition), probably, will includes advanced search for geometrical entities.
Anyway, you could make push-in of generated .aj files to customize the data request used by map component to fit returned data to your requirements.
Good luck!

Related

Creating and annotating simple geographical maps in Django

I am looking for a simple way to create geographical maps in Django, in which I could then select, highlight and annotate countries or groups thereof.
"Annotate": insert a label displaying textual information about the said country.
Is there anything that comes to mind?
Many thanks
EDIT: I checked GeoDjango already and it looks like much work in order to get where I need to. Don't get me wrong: I'm not trying to minimize my own investment in learning new tools, but for this project, I have a trade-off between time allocated to learning and the relative importance of this geographical feature in my app. It's more of a nice-to-have feature I'd like to add to an already 'complete' app. So I wondered whether there exists a 'simpler' python library for this task.
I think this is more of a question for if there is a front-end library to elegantly handle this. However if you need to generate the maps you could try something like this
https://kartograph.org/
I have personally used this http://jvectormap.com/ and found it to be really good.
In your database you could just have a Countries model with any associated information you might need to display, and create a view to handle that appropriately.

Bidirectional M2M Transformations using Eclipse EMF

I would like to do bidirectional Model2Model transformations. Both models are EMF / eCore based. Actually I would prefer that one model is an editable view on the other.
What are my options?
Which tools and tranformation languages are avaiable and what are their restrictions?
M2M are the hardest. Industries strength tools are rare, lots of academia stuff. If you're dead set on a M2M language, look into ATL which should also support ecore. Otherwise you can look at Xtend, which was made for model to text but you can abuse it and it should be more comftable than plain java. If your into research look at Scala based transformations here
http://metrikforge.informatik.hu-berlin.de/attachments/download/193/george_wider_scheidgen_ICMT_2012.pdf
There are more transformation tools than you can imagine for EMF, its kind of crazy...
For metamodel to metamodel transformation where the models are not very similar:
ATL is probably the most popular and most "baked"
Epsilon project has the Epsilon Transformation Language.
If the metamodels are very similar and you only need to tweak some things then there are tools targeted that type of migration/updating:
ATL now has a refining mode
Epsilon has Flock
Edapt looks very interesting as well because it does the metamodel/model changes together. It lets you work on a tree view and comes with a set prebuilt set of rules.
Henshin which lets you operate on a diagram view of the model
EMF Refactor is a more code-level approach, that can also use Henshin rules somehow.
You can always directly manipulate the metamodel and model using the EMF Java APIs as well.
I'll add, if you are doing any real EMF work you will need to get and read EMF: Eclipse Modeling Framework. It's available in Safari also. I highly recommend Safari, for $39 a month you get almost every development ebook you could ever use.
If you insist on doing bidirectional M2M transformations, (so-called Bxs), then know that there is an active researcher's community updating that wiki : http://bx-community.wikidot.com.
If you visit it, you will find that they list a bunch of tool suitable for Bx transformations http://bx-community.wikidot.com/relatedtools.
I used ECHO in the past which provides an implementation of QVT-R based on the KodKod constraints solver.
It's definitely worth giving it a try.
Since you specifically asked for bi-directional model transformations, I must say that you have no options. To make it claer, adding to the answer you got form Ed Willink, none of the existing M2M transformation languages (AFAIK) supports bi-directional model transformations.
Work on a QVTr and QVTc execution engine is starting to look promising if you are still interested in this: QVTd Project.

Attributes: Are the current REST-architecture tools limited to a tree-structure?

Historically operating system directory-structures have been trees:
C:
Windows
System32
Program Files
Common Files
Internet Explorer
And the REST architecture emulates the same thing:
http://...//Thomas/
http://...//Thomas/Mexico/Year2003/Photos
http://...//Thomas/Mexico/Year2007/Photos
http://...//Thomas/Finland/Year2005/Photos
http://...//Thomas/Finland/Year2010/Photos
http://...//Thomas/Finland/Year2010/Videos
http://...//Thomas/USA/Year2005/Photos
But, looking the current structure, I need to make searches:
All pictures that are not from
Finland?
All pictures taken in 2005?
All pictures in timeline?
It is not efficient to do a REST-interface with every tree-hierarchy combinations. You need more efficient information management; you need an attribute-system rather than a tree-structure.
(Oh, why the operating systems are not based on attributes?)
StackOverflow and Google seem to use attributes and syntax with "+"-marks like:
http://www.stackoverflow.com/Tags/asp.net+iis7
http://www.google.com/search?&q=iis7+asp.net
Today's frameworks like WCF and ASP.NET MVC have a good support for RESTful tree-structures. But is there support for attribute-structures? Wouldn't you call an attribute-structure still REST?
I would like to make an attribute-WebService and use it with a LINQ in Silverlight-client... Which is the best way to start? :-)
In order to create an effective REST interface you need to identify the resources that make sense for your client application. If you look at you use cases:
All pictures that are not from Finland?
All pictures taken in 2005?
All pictures in timeline?
The question you need to answer, is if this requires three resources or just one. I am assuming you want to have more than just these three queries, so therefore the most flexible solution is to define a generic resource which is a "collection of pictures".
/Thomas/pictures
From here, you want to be able limit contents of this resource by using query parameters.
/Thomas/pictures?country=not-finland
/Thomas/pictures?year=2005
In the case of the third item it may make sense to create a separate resource for that item.
/Thomas/PictureTimeline
There are other scenarios where it may make sense to create additional resource such as
/Thomas/FavouritePictures
The important thing is to identify what key concepts of your application you want to model as resources and then assign those resources an URL. Trying to do REST design via the URL space is going to make you bang your head against the wall.
What you are looking for are URI matrix parameters:
http://www.w3.org/DesignIssues/MatrixURIs.html
When to use query parameters versus matrix parameters?.

ColdFusion CRUD

For quite a long time now, I've been trying to write and have been in search of "a really good" CRUD application. Don't get me wrong - I didn't say "The ultimate" CRUD application. Just one that could be rated 1st class.
What I'm saying is: Please don't respond to this plea with an answer like "Well, every situation is different..."
Q: Is there a blog post or something in the Adobe documentation that shows CRUD on a one-to-many relationship (Header/Detail), that uses web standards css (instead of tables), that uses best practices (CF9 has changed so many things now: scripted components, ORM), that uses the latest UI techniques (jQuery or some of the built-in AJAX features of CF9), that has a nice front-end (a nice looking header and background along with some pretty buttons)?
I know that's a lot to ask, but such is my quest.
A good example of a one-to-many relationship is the city/state xml files built into the Spry examples. There are 23,000 cities in the sample xml files, so I think that's better than just using random data.
I'm not really sure what you're asking, but I just want to respond to a couple of points in your question (this is more a comment than an answer, but since SO is stupidly limited in this, I'll put it here instead.)
that uses web standards css (instead of tables),
There is no "css instead of tables" - they are two distinct and compatible things!
CSS describes visual aspects of a document, whilst tables markup tabular data.
If you're displaying tabular data, then tables is exactly what you should be using, and you can use CSS to make it look more exciting than the plain styles that tables come in.
Since you're asking for a CRUD app, odds are you are going to be wanting to display tabular data so should be using tables.
(The common mistake people make is not understanding the nature of the web, and using tables to apply grid layouts to documents, when they should be using strucuted semantic markup instead.)
that uses best practices (CF9 has changed so many things now:
scripted components, ORM)
Scripted components are not a best practise!
They are an alternative syntax (for people that prefer having non-descriptive braces everywhere) they do not offer anything you can't already do.
i would strongly suggest you check out cfwheels. read the documentation, it's built for doing such crud applications and has an amazing set of features and will save you a lot of time. as for the interface, there are many jquery plugins out there that can handle this. i suggest looking at ajaxrain and find a plugin you like

Admin interface to manage two related data sources

In the project there are two data sources: one is project's own database, another is (semi-)legacy web service. The problem is that admin part has to keep them in sync and manage both so that user doesn't have to know they're separate (or, do know, but they do not care).
Here's an example: there's list of languages. Both apps - project and legacy - need to use them. However, they both add their own meaning. For example, project may need active/inactive, and legacy will need language code.
But admin part has to manage everything - language name, active/inactive, language code. When loading, data from both systems has to be merged and presented, and when saved, data has to be updated in both systems.
Thus, what's the best way to represent this separated data (to be used in the admin page)? Notice that I use ASP.NET MVC / NHibernate.
How do I manage legacy data?
Do I connect admin part to legacy web service external interface - where it currently only has GetXXX() methods - and add the missed C[R]UD methods?
Or, do I connect directly to legacy database - which is possible since I do control it.
Where do I do split/merge of data - in the controller/service layer, or in the repository/data layer?
In the controller layer I'll do "var viewmodel = new ViewModel { MyData = ..., LegacyData = ... }; The problem - code cluttered with legacy issues.
In the data layer, I'll do "var model = repository.Get(id)" and model will contain data from both worlds, and when I do "repository.Save(entity)" it will update both data sources - in local db only project specific fields will be stored. The problems: a) possible leaky abstraction b) getting data from web service always while it is only need sometimes and usually for admin part only
a modification, use ICombinedRepository<Language> which will provide additional split/merge. Problems: still need either new model or IWithLegacy<Language, LegacyLanguage>...
Have a single "sync" method; this will remove legacy items not present in the project item list, update those that are present, create legacy items that are missed, etc...
Well, to summarize the main issues:
do I develop CRUD interface on web service or connect directly to its database (which is under my complete control, so that I may even later decide to move that web service part into the main app or make it use the main db)?
do I have separate classes for project's and legacy entities, thus managed separately, or have project's entities have all the legacy fields, managed transparently when saved/loaded?
Anyway, are there any useful tips on managing mostly duplicated data from different sources? What are the best practices?
In the non-admin part, I'd like to completely hide the notion of the legacy data. Which is what I do now, behind the repository interfaces. But for admin part it's not that clear or easy...
What you are describing here seems to warrant the need for an Anti-Corruption Layer. You can find solutions related to this topic here: DDD, Anti Corruption layer, how-to?
When you have two conceptual Bounded Contexts, but you're only using DDD for one of them, the Anti-Corruption layer comes into play. When reading from your data source (performing a get operation [R]), the anti-corruption layer will translate your legacy data into usable objects for your project. When writing to your data source (performing a set operation [CUD]), the anti-corruption layer will translate your DDD objects into objects understood by your legacy code.
Whether or not to use the existing Web Service depends on whether or not you're willing to change existing code. Sticking with DRY practices, you don't want to duplicate what you already have. If you want to keep the Web Service, you can add CUD methods inside the anti-corruption layer without impacting your legacy application.
In the anti-corruption layer, you will want to make use of adapters and facades to bring together separate classes for your DDD project and the legacy application.
The anti-corruption layer is exactly where you handle splitting and merging.
Let me know if you have any questions on this, as it can be a somewhat advanced topic. I'll try to answer as best I can.
Good luck!