I am new to Protégé. I am using version 5.5.0. I want to learn by developing a simple ontology: 2 Classes {Employee, Organization} and 3 Object Properties {WorksAt, HasEmployee, and HasColleague}. I want to declare an object property called "HasColleague" as shown in this such that two entities of Class Employee that work at the same Organization have the HasColleague property. As of now, my object property looks like this but it does not work as I hoped it would. I appreciate your help.
Related
I am using a blank core data proj and trying to copy the code from this examples.
https://www.and
rewcbancroft.com/2015/02/18/core-data-cheat-sheet-for-swift-ios-developers/
As there is no managedContext i am not able o proceed.
I am new to IOS programming. Please can anybody share me a simple example that i can start with. But i need it with Xcode8 beta4 version.
I tried many other examples but once i convert them to my current version they are not working.
The error message reads:
Value of type 'ViewController' has no member 'managedObjectContext'
What this means is that somewhere (your screenshot does not show where) you are attempting to assign a value to a property named managedObjectContext, on an instance of your ViewController class. Except that this class doesn't have a property named managedObjectContext, so Swift complains and doesn't compile.
This is not actually a Core Data question-- it's basic Swift. It would happen for any attempt to assign a value to a nonexistent property.
You probably (again, your screenshot does not provide enough detail to be sure) need to create this property on your view controller class, with type NSManagedObjectContext.
Coded ui- How to update properties of object in UImap.uitest file which has changed in application? for example a window which has version of software changes with every build. The issue is if I try to record anything on new version of software it creates new objects in UImap and the whole object tree again. This makes UImap too huge adding duplicates of objects with slightly different property.
You don't want to update the properties to latest, but make the property values dynamic. Just updating the properties will mean more work the next time your code changes.
Also, try to only use properties to search on that do not change between application runs/versions. Example, a class property will likely remain static between runs, while the title of your parent window may change based on the version number. Check out this article to see how to modify the recording's search properties to fit your needs, specifically the section on modifying UI action properties.
Another method to look into would be to create the objects and methods yourself using C#. By adding controls yourself to the uimap.cs partial class of the .uitest, you have can specify at design time what properties and values that Coded UI uses to execute your tests.
I would like a bit of clarification about why each class (or nearly each class) in VBA (when you scroll through Object Browser) has an Application property.
MSDN says
When used without an object qualifier, this property returns an
Application object that represents the Microsoft Excel application.
When used with an object qualifier, this property returns an
Application object that represents the creator of the specified object
(you can use this property with an OLE Automation object to return the
application of that object). Read-only.
The first sentence is pretty clear. Your hosting application used without a qualifier can be one of the MS Office products supporting VBA.
In Excel Debug.Print Application = Microsoft Excel
In Word Debug.Print Application = Microsoft Word
etc...
but...the second sentence is totally unclear to me... So I am thinking like no matter where you call .Application from it will always return the host of an object...
So, what is the point of each class in VBA to have an Application property?
PS. you can always call .Parent => .Parent to go up the hierarchy... can't you? You can just call the Application wit no qualifier to get that...
I can't even think of one SSCCE OLE scenario for this so I am sorry I am not providing an example. The Application property (not to be confused with Application class) is poorly documented this is why I am asking for someone with more experience to clarify this for me.
One (well, sort of) scenario, but not sure it even applies here could be using Interop for Office. Like, when you have an external application that opens two files ( one Excel, and one Word ) then by getting references to Ranges in both, you may be able to return Microsoft Excel and Microsoft Word.. but would this be even useful to anyone? hmm..Am I not understanding this entire concept?
There are two levels to this. First, the reason every class has an Application property is because somebody thought it would be a good idea and they made a base class from which every other class inherits. Kind of like the decision to have a Value property or an Item property consistently applied through classes.
The real question is why somebody thought it was a good idea. I don't know, but it was probably Spolsky's idea, so he should answer. I can tell you how I use it.
If I'm automating Outlook from Excel, I'll generally create an olApp variable to hold the Outlook Application. But I don't have to. I could just create, say, a MailItem and reference Application via that. Where I do use the Application property is debugging. I have a MailItem object instantiated and I'm getting an error. I could, for instance, see how many items are in the inbox even though I don't have an application object variable in scope. In the immediate window:
?olMailItem.Application.GetDefaultFolder(1).Items.Count
I could string a bunch of .Parent calls together, but I don't necessarily know how many I would need. Here's where the second part of the MSDN description comes into play. If I use Application with not qualifier (I'm in Excel), it defaults to Excel.Application. But the Application property of olMailItem returns Outlook.Application because that's what's at the top of the object hierarchy that includes the MailItem class.
I think it's just a handy shortcut that somebody thought was so handy they coded it into the base class for all objects.
I know that there are ways to access an EAttribute of an Eclipse EMF model by its featureID or by its name via different indirect approaches. For that I found the following: Eclipse EMF: How to get access EAttribute by name?
But what if I don't know the name of the attribute I want to get? Let's say, based on the design, the model has some fixed attributes by the developer, along with the features that can be set dynamically by the user.
So, for the time being I use the getEAllStructuralFeatures() and use indexes via get() to reach to the by-the-user-created attributes, since I know that the list I get will have the fixed attributes of the model as its first elements beginning with the index 0. But I find this solution unclear and inefficient. Also in some cases, that I want to work, not suitable.
E.g: IEMFEditProperty prop = EMFEditProperties.list(editingDomain, EMFMODELPackage.Literals.EMFMODEL.getEAllStructuralFeatures().get(X));
Do you know a solution or a workaround for this problem? As far as I can see, there are no direct methods to get such dynamically created features of the model.
Every help will be appreciated.
I have been working on a similar case recently where I first tried to define an EStructuralFeature to access exactly the setting/attribute of the object that I needed.
But if you look at how things work internally in ECore, you will find out, that there is no way this will ever work, since the indices are bound to the object identity of the EStructuralFeature objects created at runtime for the specific context (i.e. EClass instance).
My approach was then to either inspect the features proposed by EClass.getEAllStructuralFeatures or to iterate over the features and inspect the object returned by EObject.eGet for this very feature (where EClass eClass = eObject.eClass()).
Example: In a UML profile I have defined a UML Stereotype called "Bean" with a property called FactoryEntity. The property shall reference a UML Class with the Stereotype "Entity" that is closest to this very bean and for which a static factory method will be generated.
In the model I would then have one UML Class typed as Bean and one as Entity.
And for the Class typed as "Bean" I would then set a value for the attribute/property factoryEntity defined in the profile.
The question was then how the property value would be accessible in ECore. I ended up iterating the List of available EStructuralFeature of the EClass of the EObject and checking the type of the object returned by eGet.
final EObject eObject = (EObject) holdingClass.getValue(stereotype, stereoTypePropertyName);
final EList<EStructuralFeature> allEStructFeats = eObject.eClass().getEAllStructuralFeatures();
for(EStructuralFeature esf : allEStructFeats)
{
final Object o = eobject.eGet(esf);
if(o instanceof org.eclipse.uml2.uml.Class)
{
return (org.eclipse.uml2.uml.Class) o;
}
}
Maybe that is not the most elegant way to access structural features but it is the only one I thought was robust enough to last.
Please let me know if you have any suggestions on how to improve this.
I try to use the great propertygrid from exceed.wpftoolkit but I have to problems based on the application I have to create.
First I didn't know at compile time the number of properties the grid has to show. So I couldn't use a simple class with properties/attributes and annotations as datacontext or source for the grid, I need a list or dictionary in which I place a number of grid properties at runtime.
I google for several hours and try to find an example in the sample folders of the toolkit sources but nothing has help me.
Second problem or apply is to replace the usage of annotations in the property class. I need to create the properties at runtime and place the propertyeditor and annotation settings at runtime to the property.
Could anybody help me with some simple examples or good places to look for. I believe the propertygrid is very powerful and could do this.
You need to create a class that implements the ICustomTypeDescriptor interface to provide all the PropertyDescriptor instances that represent your dynamic properties.
After that you can set an instance of the class that implements the ICustomTypeDescriptor interfaces as SelectedObject to the PropertyGrid.
You can find an example here.