Search Mailing List Archives
[protege-discussion] How Does One Retrieve a MetaSlot Value ?
Schultz, Ron
ron.schultz at vectorsgi.com
Sun Jan 21 20:36:16 PST 2007
I created a MetaSlot class that has the additional property Synonym. I
did this in the same way recommended on the Wiki for adding a Synonym to
a class, but I extended STANDARD SLOT instead of STANDARD CLASS. How do
I retrieve the synonym for a slot in Java code? Below is the code I have
for doing this to an instance of a class.
Thanks
Ron Schultz
This is the code I am using to retrieve a class's synonym
/*
* This method, when passed a frame, returns the synonym, if
present.
*/
private String getSynonym(Frame frame) {
List ownSlots = new
ArrayList<Frame>(frame.getOwnSlots());
Iterator i = ownSlots.iterator();
while (i.hasNext()) {
Slot ownSlot = (Slot) i.next();
String ownSlotName = ownSlot.getBrowserText();
if (ownSlotName.startsWith("SYNONYMS")) {
Collection ownSlotValues =
frame.getOwnSlotValues(ownSlot);
Iterator iValues =
ownSlotValues.iterator();
while (iValues.hasNext()) {
Object obj = iValues.next();
// Return the first value of the
Synonyms list
return obj.toString();
}
}
}
return null;
}
[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