Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Changing many slots to a new metaclass

Schultz, Ron ron.schultz at
Tue Jan 16 18:49:10 PST 2007

I am unsure whether this helps anyone, but I had a need to reassign hundreds of slots to a new metaclass in order to add synonyms to each slot. While the Protégé user interface allows one to assign a new metaclass to a slot, the effort is time consuming and tedious. I could not find any specific references to how to accomplish this. I needed to do this on only selected classes. The following code snippet, and in particular the last few lines, show the basics. 

		List ownSlots = new ArrayList(frame.getOwnSlots());
		Cls newCls = cls.getKnowledgeBase().getCls("NEW_META_SLOT");
		Iterator i = ownSlots.iterator();

		while (i.hasNext()) {
			Slot ownSlot = (Slot);
			// Test Code to change the metaclass for a slot
			Cls cls= ownSlot.getDirectType();

If anyone has a more complete example, or knows of another way to accomplish this, please let me know. I was hoping the Protégé Project Wizard plugin would provide this facility but it currently does not.

Ron Schultz

[This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed.  Any use, distribution, copying or disclosure by any other person is strictly prohibited.  If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy.]

More information about the protege-discussion mailing list