Overview | Package | Class | Tree | Deprecated | Index | Help
| Protege 3.5 alpha
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.smi.protege.model
Class ModelUtilities

    java.lang.Object
      edu.stanford.smi.protege.model.ModelUtilities

    public class ModelUtilities

extends Object

Convenience utilities for dealing with the Knowledge Base. Most of these methods take frame names (strings) rather than frames and convert them. Note that there is a serious performance penalty for using these methods if they are used repeatedly to perform some operation. For repeat operations you should look up the needed frames once and then store them and use the stored values. Nevertheless, for some rare or one-off operations these methods can be useful and convenient.

Author:
  Ray Fergerson

Constructor Summary
`ModelUtilities()`

Method Summary
`static void` | `addOwnSlotValue(Frame frame, String slotName, Object value)`
`static Map` | `createValueMap(KnowledgeBase sourceKB, KnowledgeBase targetKB)`
`static Object` | `getDirectOwnSlotValue(Frame frame, String name)`
`static List` | `getDirectOwnSlotValues(Frame frame, String name)`
`static Object` | `getOwnSlotValue(Frame frame, String name)`
`static Collection` | `getOwnSlotValues(Frame frame, String name)`
`List<Cls>` | `getPath(Cls cls, List<Cls> list)`
`static Collection<List<Cls>>` | `getPathsToRoot(Cls cls)` Computes all paths from a class to the root node by navigating on the direct superclasses slot.
`static List<Cls>` | `getPathToRoot(Cls cls)`
`static Collection<List<Instance>>` | `getPropertyClosureToRoot(Instance resource, Slot parentSlot, Instance rootResource)` Computes all paths from an instance to the "root instance" node by navigating on a given slot.
`static void` | `getPropertyClosureToRoot(Instance resource, Slot parentSlot, Instance rootResource, List<Instance> path, Collection<List<Instance>> pathLists)`
`static Map<Object,List<Instance>>` | `getPropertyValuesOnAllSuperclasses(Cls cls, Slot slot)` Returns all own slot values for the slot `slot` for every superclass of a class.
`static Map<Object,List<Instance>>` | `getPropertyValuesOnPropertyClosureToRoot(Instance resource, Slot parentSlot, Instance rootResource, Slot slot)` Returns all own slot values for the slot `slot` for every instance in any of the paths between an instance (`resource`) and a root instances (`rootResource`) following the relationships defined by the `parentSlot` slot.
`static Object` | `getTemplateFacetValue(Cls cls, Slot slot, String facetName)`
`static Collection` | `getTemplateFacetValues(Cls cls, Slot slot, String facetName)`
`static boolean` | `isVisibleInGUI(Frame frame)`
`static void` | `removeOwnSlotValue(Frame frame, String slotName, Object value)`
`static void` | `setOwnSlotValue(Frame frame, String slotName, Object value)`
`static void` | `setOwnSlotValues(Frame frame, String slotName, Collection values)`
`static void` | `setTemplateFacetValue(Cls cls, Slot slot, String facetName, Object value)`
`static void` | `setTemplateFacetValues(Cls cls, Slot slot, String facetName, Collection values)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ModelUtilities

    public ModelUtilities()

Method Detail

### addOwnSlotValue

    public static void addOwnSlotValue(Frame frame,
                                       String slotName,
                                       Object value)

### createValueMap

    public static Map createValueMap(KnowledgeBase sourceKB,
                                     KnowledgeBase targetKB)

### getOwnSlotValue

    public static Object getOwnSlotValue(Frame frame,
                                         String name)

### getDirectOwnSlotValue

    public static Object getDirectOwnSlotValue(Frame frame,
                                               String name)

### getOwnSlotValues

    public static Collection getOwnSlotValues(Frame frame,
                                              String name)

### getDirectOwnSlotValues

    public static List getDirectOwnSlotValues(Frame frame,
                                              String name)

### getPath

    public List<Cls> getPath(Cls cls,
                             List<Cls> list)

### getPropertyClosureToRoot

    public static void getPropertyClosureToRoot(Instance resource,
                                                Slot parentSlot,
                                                Instance rootResource,
                                                List<Instance> path,
                                                Collection<List<Instance>> pathLists)

### getPropertyClosureToRoot

    public static Collection<List<Instance>> getPropertyClosureToRoot(Instance resource,
                                                                      Slot parentSlot,
                                                                      Instance rootResource)

  Computes all paths from an instance to the "root instance" node by navigating on a given slot.

  Parameters:
    `resource` - - an instance
    `parentSlot` - - slot to navigate on towards a "root node"
    `rootResource` - - an instance considered as the root of the navigation tree, necessary to stop the navigation.
  Returns:
    a collection of the paths from the resource to the root resource

### getPropertyValuesOnPropertyClosureToRoot

    public static Map<Object,List<Instance>> getPropertyValuesOnPropertyClosureToRoot(Instance resource,
                                                                                      Slot parentSlot,
                                                                                      Instance rootResource,
                                                                                      Slot slot)

  Returns all own slot values for the slot `slot` for every instance in any of the paths between an instance (`resource`) and a root instances (`rootResource`) following the relationships defined by the `parentSlot` slot.

  Parameters:
    `resource` - - a resource
    `parentSlot` - - the slot that is used to traverse the instance graph to the `rootResource`
    `rootResource` - - the resource that is the
    `slot` - - a slot
  Returns:
    a map containing all own slot values as keys, and each value is mapped to a list of instances which contained the value as their own slot value

### getPropertyValuesOnAllSuperclasses

    public static Map<Object,List<Instance>> getPropertyValuesOnAllSuperclasses(Cls cls,
                                                                                Slot slot)

  Returns all own slot values for the slot `slot` for every superclass of a class.

  Parameters:
    `cls` - - a class
    `slot` - - a slot
  Returns:
    a map containing all own slot values as keys, and each value is mapped to a list of classes which contained the value as their own slot value

### getPathToRoot

    public static List<Cls> getPathToRoot(Cls cls)

### getPathsToRoot

    public static Collection<List<Cls>> getPathsToRoot(Cls cls)

  Computes all paths from a class to the root node by navigating on the direct superclasses slot.

  Parameters:
    `cls` - - the resource
  Returns:
    a collection of the paths from the resource to the root

### getTemplateFacetValue

    public static Object getTemplateFacetValue(Cls cls,
                                               Slot slot,
                                               String facetName)

### getTemplateFacetValues

    public static Collection getTemplateFacetValues(Cls cls,
                                                    Slot slot,
                                                    String facetName)

### isVisibleInGUI

    public static boolean isVisibleInGUI(Frame frame)

### removeOwnSlotValue

    public static void removeOwnSlotValue(Frame frame,
                                          String slotName,
                                          Object value)

### setOwnSlotValue

    public static void setOwnSlotValue(Frame frame,
                                       String slotName,
                                       Object value)

### setOwnSlotValues

    public static void setOwnSlotValues(Frame frame,
                                        String slotName,
                                        Collection values)

### setTemplateFacetValue

    public static void setTemplateFacetValue(Cls cls,
                                             Slot slot,
                                             String facetName,
                                             Object value)

### setTemplateFacetValues

    public static void setTemplateFacetValues(Cls cls,
                                              Slot slot,
                                              String facetName,
                                              Collection values)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Protege 3.5 alpha
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2012 Stanford University.