background image

Defining a Taxonomy

<< Using Taxonomies in JAXR Clients | Taxonomy structure >>
<< Using Taxonomies in JAXR Clients | Taxonomy structure >>
U
SING
T
AXONOMIES IN
JAXR C
LIENTS
195
JAXRConcept
elements are children and grandchildren. A
JAXRConcept
element
may have children, but it is not required to do so.
In all element definitions, attribute order and case are significant.
To add a user-defined taxonomy, follow these steps.
1. Publish the
JAXRClassificationScheme
element for the taxonomy as a
ClassificationScheme
object in the registry that you will be accessing.
To publish a
ClassificationScheme
object, you must set its name. You
also give the scheme a classification within a known classification scheme
such as
uddi-org:types
. In the following code fragment, the name is the
first argument of the
LifeCycleManager.createClassificationScheme
method call.
InternationalString sn =
blcm.createInternationalString("MyScheme");
InternationalString sd = blcm.createInternationalString(
"A Classification Scheme");
ClassificationScheme postalScheme =
blcm.createClassificationScheme(sn, sd);
String uuid_types =
"uuid:c1acf26d-9672-4404-9d70-39b756e62ab4";
ClassificationScheme uddiOrgTypes =
(ClassificationScheme) bqm.getRegistryObject(uuid_types,
LifeCycleManager.CLASSIFICATION_SCHEME);
if (uddiOrgTypes != null) {
Classification classification =
blcm.createClassification(uddiOrgTypes,
"postalAddress", "postalAddress" );
postalScheme.addClassification(classification);
InternationalString ld =
blcm.createInternationalString("My Scheme");
ExternalLink externalLink =
blcm.createExternalLink(
"http://www.mycom.com/myscheme.xml", ld);
postalScheme.addExternalLink(externalLink);
Collection<ClassificationScheme> schemes =
new ArrayList<ClassificationScheme>();
schemes.add(cScheme);
BulkResponse br =
blcm.saveClassificationSchemes(schemes);
}
The
BulkResponse
object returned by the
saveClassificationSchemes
method contains the key for the classification scheme, which you need to
retrieve: