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] How to recover slot values?

Jonathan Carter jonathan.carter at
Wed Oct 1 01:52:33 PDT 2008

Hi Emmanuel,

Try something like this:

aSlotValue = anInstance.getDirectOwnSlotValue(kb.getSlot("slot_name"))

The argument for the kb.getSlot() method is a string which is the name  
of the slot you want to get the value of.

As you can see from the code snippet, you need to get a reference to  
the specific instance. It might be that you need to get all the  
Instances of a class and then iterate through them (this is Python  
[Jython] code from a script but you can see the method calls that you  
need to make - the Jython script calls the Java API), for example:

anInstanceList = kb.getCls("My_Class").getDirectInstances()

for anInstance in anInstanceList:
	aSlotValue = anInstance.getDirectOwnSlotValue(kb.getSlot("slot_name"))

The methods that have the word 'Direct' in them just return Instances  
or values of the specific class - which is normally what I want. You  
can, however, use similar methods that have not got 'Direct' in their  
name and they generally give you back things for the class that you  
specified AND subclasses.

Have a look at the Javadoc, 
  and look at the Cls, Instance and Slot classes.

Hope this helps


Jonathan Carter - Head of Technical Architecture
Enterprise Architecture Solutions Ltd

Assess your EA maturity at:

On 1 Oct 2008, at 02:14, Emmanuel Ramos wrote:

> Wath methods to use to recover slot values?
> Novos endereços, o Yahoo! que você conhece. Crie um email novo com a  
> sua cara ou  
> protege-discussion mailing list
> protege-discussion at
> Instructions for unsubscribing:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-discussion mailing list