/** * Convert a {@link TypeSystem} to an equivalent {@link TypeSystemDescription}. * * @param aTypeSystem * type system object to convert * @return a TypeSystemDescription that is equivalent to <code>aTypeSystem</code> */ public static TypeSystemDescription typeSystem2TypeSystemDescription(TypeSystem aTypeSystem) { ResourceSpecifierFactory fact = UIMAFramework.getResourceSpecifierFactory(); TypeSystemDescription tsDesc = fact.createTypeSystemDescription(); Iterator<Type> typeIter = aTypeSystem.getTypeIterator(); ArrayList<TypeDescription> typeDescs = new ArrayList<TypeDescription>(); while (typeIter.hasNext()) { Type type = typeIter.next(); if (!type.getName().startsWith("uima.cas") && !type.getName().equals("uima.tcas.Annotation") && !type.isArray()) { typeDescs.add(type2TypeDescription(type, aTypeSystem)); } } TypeDescription[] typeDescArr = new TypeDescription[typeDescs.size()]; typeDescs.toArray(typeDescArr); tsDesc.setTypes(typeDescArr); return tsDesc; }
.createTypeSystemDescription(); TypeDescription[] types = new TypeDescription[typeNameMap.values().size()]; typeNameMap.values().toArray(types);
.createTypeSystemDescription(); Iterator<FeatureStructure> iter = aCasData.getFeatureStructures(); List<TypeDescription> typesArr = new ArrayList<TypeDescription>();
public AnalysisEngineDescription createAnalysisEngineDescription(RutaDescriptorInformation desc, TypeSystemDescription typeSystemDescription, String typeSystemOutput, String engineOutput, RutaBuildOptions options, String[] scriptPaths, String[] enginePaths, String[] resourcePaths) throws InvalidXMLException, IOException { TypeSystemDescription aets = uimaFactory.createTypeSystemDescription(); Import_impl import_impl = null; boolean needToIncludeTypeSystemDescriptor = true; if (options.isImportByName()) { if (typeSystemDescription != null) { import_impl = new Import_impl(); import_impl.setName(typeSystemDescription.getName()); needToIncludeTypeSystemDescriptor = false; } } else { if (typeSystemOutput != null) { String relativeLocation = getRelativeLocation(new File(typeSystemOutput).toURI(), engineOutput); import_impl = new Import_impl(); import_impl.setLocation(relativeLocation); needToIncludeTypeSystemDescriptor = false; } } AnalysisEngineDescription analysisEngineDescription = configureEngine(desc, engineOutput, options, scriptPaths, enginePaths, resourcePaths, import_impl, aets); if(needToIncludeTypeSystemDescriptor) { analysisEngineDescription.getAnalysisEngineMetaData().setTypeSystem(typeSystemDescription); } return analysisEngineDescription; }
throws SAXException { ResourceSpecifierFactory factory = UIMAFramework.getResourceSpecifierFactory(); TypeSystemDescription tsDesc = factory.createTypeSystemDescription();
/** * Sets the type system description. * * @param typeSystemDescription the new type system description * @throws ResourceInitializationException the resource initialization exception */ // Also called for aggregate TAEs public void setTypeSystemDescription(TypeSystemDescription typeSystemDescription) throws ResourceInitializationException { boolean doValidation = true; this.typeSystemDescription = typeSystemDescription; // This could be a tsd associated with a primitive TAE descriptor, or // it could be a tsd from a tsd if (typeSystemDescription == null) { if (!isAggregate()) { this.typeSystemDescription = UIMAFramework.getResourceSpecifierFactory() .createTypeSystemDescription(); doValidation = false; // speed up by 1/3 second } } setMergedTypeSystemDescription(); // setImportedTypeSystemDescription(); // done in above call if (aeDescription == null) aeDescription = UIMAFramework.getResourceSpecifierFactory().createAnalysisEngineDescription(); aeDescription.getAnalysisEngineMetaData().setTypeSystem(this.typeSystemDescription); if (doValidation) descriptorCAS.validate(); }
URISyntaxException { TypeSystemDescription typeSystemDescription = uimaFactory.createTypeSystemDescription();