Setting up RDF class instances in KOMMA - eclipse

Looking at the documentation for KOMMA plug-in for Eclipse IDE, there doesn't seem to be any way of setting up class instances in its OWL editor, only through Java code:
http://komma.enilink.net/docs/editors/owl_editor/index.html.
Is there something I'm missing here?

You can use the views called "Instances" or "Instance Tree" to create instances of RDFS/OWL classes. First select a class, for example in the classes view, and then use one of the plus buttons to create a corresponding instance.

Related

use Ecore/XMI editor for instance creation from Ecore metamodel

I have a metamodel in the form of an Ecore file.
I saw in some previous projects that is possible to generate an xmi file from which it is possible to edit an instance of the Ecore metamodel.
I have generated the XMI file by clicking a class in the metamodel then "Create Dynamic Instance ..." but then when I click nodes in xmi file, I miss the *new Child* command that let me to create the instance fields as in the folowing picture :
Any idea how to solve this
Well, without your metamodel and more information about exactly from which root object you created your dynamic instance, it's hard to answer properly.
Usually, if the New Child menu doesn't pop up, it's because your metaclass misses containment EReferences. The generic EMF tree editor relies on the EStructuralFeatures of each metaclass to display the various panels/menu to set information of your instances. If there is no containment references, then, no child can be created.

how to create new class files based on existing ones - in Xcode

Is there a way to create a new class based on another which already exists in the project?
Ideally one could just make a copy of a group (which may inlude .h, .m -xib) and change whatever code on this copy to create a new class.
Currently I create a new group, create the new class with it's new name and then copy the code for these files - immediately renaming the old class name into the new class name
The alternative would be to do "Show in Finder" and create duplicates for the files, drag them back into xCode, create a new group and drag them there...
Is there some better way to do this?
ps in Eclipse there is even an explicit option in the menu for this purpose
Many thanks
I think you should use a subclass for that. Create a new Objective-C class, and choose your old class as the parent class.
Have a look a this, it may help you understand this principle if you're not familiar with it : http://www.techotopia.com/index.php/Objective-C_Inheritance
The concept of inheritance brings something of a real-world view to programming. It allows a class to be defined that has a certain set of characteristics (such as methods and instance variables) and then other classes to be created which are derived from that class. The derived class inherits all of the features of the parent class and typically then adds some features of its own.
I don't know what will happen to the xib file, but at least you can re-use your classes as much as you want !

CodeDom - Linking multiple classes within a single Assembly

I have a C# application that I am trying to re-create through the use of CodeDom. This application has four classes inside of it. If I were to go into this applications directory, I would find the project file (App.csproj), and if I were to start this project file, all four classes would load together. Furthermore, if I were to build this application, all four classes would build together.
My Question: How on earth can I create this functionality through the use of CodeDom?
I have sucessfully created one of the four classes using CodeDom, but how can I go about creating the next three classes (and linking them) to the first class that I already created?
I know this may sound confusing but I will explain more if necessary.
If the classes are in the same namespace you can add them all to one CodeNamespace object and generate the code from that.
If there in different namespaces you can add the namespace of the other Classes to your first class by adding the namespaces reference of the other class's to the namespace object you are working in:-
// Add the Namespace of the other class to the current namespace onject
defaultNameSpace.Imports.Add(new CodeNamespaceImport("Project.Namespace.Namespace"));
Where defaultNameSpace is a type of CodeNamespace. The first Class you have built is added to this CodeNamespace object as below and then the code is generated from that :-
defaultNameSpace.Types.Add(mainClass);
mainClass being a type of CodeTypeDeclaration.
Hope this helps.

Wrapping my mind around MEF: how to load View(Model)?

I'm learning prism V4 using MEF to load my modules. Loading modules does work, but in one module I want to load a View/ViewModel (MVVM) and don't really know how I get MEF to resolve all this stuff for me.
First: how do I need to mark the ViewModel (I follow the StockTraderRI example) so it is not loaded on startup but instead can be loaded during runtime into a region?
Second: how do I load the ViewModel using MEF so it gets connected to the corresponding interfaces?
MEF does this very nicely for things on startup which are marked as [Export], but I got no idea how to achieve this during runtime.
You can use what is known as a Lazy Export so that the interface is not resolved until you explicitly use it.
If you need to create multiple instances, MEF doesn't support this particularly well. You can either do your own discovery and instantiation, or you can define the Export like this:
[PartCreationPolicy(CreationPolicy.NonShared)]
[Export(typeof(ISomething)]
public class Something : ISomething { }
The downside is that now wherever you need to create the instance, you need to have a reference to the actual Container instance. Then you can do:
var something = _container.GetExportedObject<ISomething>();
EDIT: Okay, I think I understand better what you're after. Here is how I've typically resolved this issue:
I implement my View objects as UserControl instances and don't set a DataContext anywhere in their code or XAML.
I create a DataTemplate that binds from the Type of the ViewModel to the UserControl.
On my MainViewModel (or whatever corresponds to the View hosting the regions), I expose a general RegionX Object (possibly typed to an interface if all of my ViewModels will share some common functionality, but Object works fine).
I create a ContentPresenter with Content bound to the RegionX property.
Now my MainViewModel can import different ViewModel instances corresponding to the types of ViewModels that might be hosted by the RegionX. When I want to switch the 'active' View in the region, I simply set RegionX to the corresponding ViewModel.

AspectJ problem

Hi I am new to AspectJ and I would like to find out if creating variants of a class using Aspects - I will create another instance of the class as well?
I am guessing that the question is, if I am adding aspects would a new class be created.
The answer is no, as the weaving, either when compiling or at run-time, using AspectJ, will add the changes to the classes that are affected by the aspects, so there is no new class created, it is just that the byte code for the original class and the final class are different.
What do you mean by variants?
If you are asking if AspectJ instantiates copies of your class, the answer is no.
AspectJ uses a design pattern called proxy to intercept calls to your class.