DescriptorEngine { public String getDictionaryType(String identifier) { Entry[] dictEntries = dict.getEntries(); String specRef = getSpecRef(identifier); logger.debug("Got identifier: " + identifier); logger.debug("Final spec ref: " + specRef); for (Entry dictEntry : dictEntries) { if (!dictEntry.getClassName().equals("Descriptor")) continue; if (dictEntry.getID().equals(specRef.toLowerCase())) { Element rawElement = (Element) dictEntry.getRawContent(); Elements classifications = rawElement.getChildElements("isClassifiedAs", dict.getNS()); for (int i = 0; i < classifications.size(); i++) { Element element = classifications.get(i); Attribute attr = element.getAttribute("resource", rdfNS); if ((attr.getValue().indexOf("molecularDescriptor") != -1) || (attr.getValue().indexOf("atomicDescriptor") != -1)) { String[] tmp = attr.getValue().split("#"); return tmp[1]; } } } } return null; } DescriptorEngine(List<String> classNames, IChemObjectBuilder builder);  DescriptorEngine(Class<? extends IDescriptor> c, IChemObjectBuilder builder); void process(IAtomContainer molecule); String getDictionaryType(String identifier); String getDictionaryType(IImplementationSpecification descriptorSpecification); String[] getDictionaryClass(String identifier); String[] getDictionaryClass(IImplementationSpecification descriptorSpecification); String getDictionaryDefinition(String identifier); String getDictionaryDefinition(DescriptorSpecification descriptorSpecification); String getDictionaryTitle(String identifier); String getDictionaryTitle(DescriptorSpecification descriptorSpecification); List<IImplementationSpecification> getDescriptorSpecifications(); void setDescriptorSpecifications(List<IImplementationSpecification> specs); List<String> getDescriptorClassNames(); List<IDescriptor> getDescriptorInstances(); void setDescriptorInstances(List<IDescriptor> descriptors); String[] getAvailableDictionaryClasses(); static List<String> getDescriptorClassNameByInterface(String interfaceName, String[] jarFileNames); static List<String> getDescriptorClassNameByPackage(String packageName, String[] jarFileNames); List<IDescriptor> instantiateDescriptors(List<String> descriptorClassNames); List<IImplementationSpecification> initializeSpecifications(List<IDescriptor> descriptors);  }
@Test public void testDictionaryType() { DescriptorEngine engine = new DescriptorEngine(IMolecularDescriptor.class, DefaultChemObjectBuilder.getInstance()); String className = "org.openscience.cdk.qsar.descriptors.molecular.ZagrebIndexDescriptor"; DescriptorSpecification specRef = new DescriptorSpecification( "http: .getName(), "The Chemistry Development Kit"); Assert.assertEquals("molecularDescriptor", engine.getDictionaryType(className)); Assert.assertEquals("molecularDescriptor", engine.getDictionaryType(specRef)); }