Service Registry 3 2005Q4 Developer's Guide

Creating and Using Classification Schemes and Concepts

You can create your own classification schemes and concept hierarchies for classifying registry objects. To do so, follow these steps:

  1. Use the LifeCycleManager.createClassificationScheme method to create the classification scheme.

  2. Use the LifeCycleManager.createConcept method to create concepts.

  3. Use the ClassificationScheme.addChildConcept method to add the concepts to the classification scheme.

  4. For a deeper hierarchy, use the Concept.addChildConcept method to add child concepts to the concepts.

  5. Save the classification scheme.

The LifeCycleManager.createClassificationScheme method has several forms. You can specify two arguments, a name and description, as either String or InternationalString values. For example, to create a classification scheme to describe how books are shelved in a library, you could use the following code fragment:


ClassificationScheme cs =
     blcm.createClassificationScheme("LibraryFloors",
         "Scheme for Shelving Books");

An alternate form of the createClassificationScheme method takes one argument, a Concept, and converts the concept to a ClassificationScheme.

The createConcept method takes three arguments: a parent, a name, and a value. The parent can be either a ClassificationScheme or another Concept. You can specify a value but no name.

The following code fragment creates a concept for each floor of the library by using a static String array that contains the names of the floors. The code fragment then adds the concept to the classification scheme.


for (int i = 0; i < floors.length; i++) {
    Concept con = blcm.createConcept(cs, floors[i], floors[i]);
    cs.addChildConcept(con);
    ...

For each concept, you can create more new concepts and call Concept.addChildConcept to create another level of the hierarchy. When you save the classification scheme, the entire concept hierarchy is also saved.

Creating and Displaying Classification Schemes: Examples

For an example of creating a classification scheme, see JAXRPublishScheme.java in the directory <INSTALL>/registry/samples/classification-schemes/src. This example creates a classification scheme named LibraryFloors and a concept hierarchy that includes each floor of the library and the subject areas that can be found there.

To display the concept hierarchy, use the program JAXRSearchScheme.java in the same directory. This example displays the concept hierarchy for any classification scheme you specify.

To delete the classification scheme and concepts, use the program JAXRDeleteScheme.java in the same directory.

ProcedureTo Run the JAXRPublishScheme Example

Steps
  1. Go to the directory <INSTALL>/registry/samples/classification-schemes.

  2. Type the following command:


    asant pub-scheme
    

ProcedureTo Run the JAXRSearchScheme Example

Steps
  1. Go to the directory <INSTALL>/registry/samples/classification-schemes.

  2. Type the following command:


    asant search-scheme -Dname=LibraryFloors
    

ProcedureTo Run the JAXRDeleteScheme Example

Steps
  1. Go to the directory <INSTALL>/registry/samples/classification-schemes.

  2. Type the following command:


    asant del-scheme -Dname=LibraryFloors