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

Tania Tudorache tudorache at
Thu Jan 18 11:57:42 PST 2007


You can set the metaclass of a slot as have, using the method:

or, you can set the metaclass for all subslots of a slot with the call:


You can also add a slot metaclass (rather than setting it) with the call:


If  you have to do repetitive tasks, maybe you could use the ScriptTab. 
With a few script lines and no compiling you can do a lot of automated 
processing of your ontology.


Schultz, Ron wrote:
> 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();
> 			ownSlot.setDirectType(newCls);
> 			}
> 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.]
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at
> Instructions for unsubscribing: 

More information about the protege-discussion mailing list