Java Code Examples for org.apache.uima.resource.metadata.TypeDescription#setDescription()
The following examples show how to use
org.apache.uima.resource.metadata.TypeDescription#setDescription() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Type update. * * @param td the td * @param dialog the dialog */ private void typeUpdate(TypeDescription td, AddTypeDialog dialog) { td.setName(setValueChanged(dialog.typeName, td.getName())); td.setDescription(setValueChanged(multiLineFix(dialog.description), td.getDescription())); td.setSupertypeName(setValueChanged(dialog.supertypeName, td.getSupertypeName())); }
Example 2
Source File: CasCreationUtils.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Extracts a TypeSystem definition from a CasData. * * @param aCasData * the CAS Data from which to extract the type system * * @return a description of a TypeSystem to which the CAS Data conforms */ public static TypeSystemDescription convertData2TypeSystem(CasData aCasData) { TypeSystemDescription result = UIMAFramework.getResourceSpecifierFactory() .createTypeSystemDescription(); Iterator<FeatureStructure> iter = aCasData.getFeatureStructures(); List<TypeDescription> typesArr = new ArrayList<>(); while (iter.hasNext()) { FeatureStructure casFS = iter.next(); TypeDescription newType = UIMAFramework.getResourceSpecifierFactory().createTypeDescription(); newType.setName(casFS.getType()); newType.setSupertypeName("uima.tcas.annotation"); newType.setDescription("CasData Type"); String features[] = casFS.getFeatureNames(); if (features != null) { for (int i = 0; i < features.length; i++) { String featName = features[i]; String rangeName = ""; String description = ""; PrimitiveValue pVal = (PrimitiveValue) casFS.getFeatureValue(featName); if (pVal.get().getClass().getName().equals("java.lang.String")) { System.out.println(" the feature is a String "); rangeName = "uima.cas.String"; description = " featue of the casDataType"; } newType.addFeature(featName, description, rangeName); } } typesArr.add(newType); } TypeDescription td[] = new TypeDescription[typesArr.size()]; for (int j = 0; j < typesArr.size(); j++) { td[j] = typesArr.get(j); } result.setTypes(td); return result; }
Example 3
Source File: Ecore2UimaTypeSystem.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Eenum 2 uima type. * * @param aEEnum the a E enum * @param aUimaNamespace the a uima namespace * @param aOptions the a options * @return the type description * @throws URISyntaxException the URI syntax exception */ private static TypeDescription eenum2UimaType(EEnum aEEnum, String aUimaNamespace, Map aOptions) throws URISyntaxException { TypeDescription type = uimaFactory.createTypeDescription(); // set name if (aUimaNamespace != null) { type.setName(aUimaNamespace + "." + aEEnum.getName()); } else { type.setName(aEEnum.getName()); } // set supetype to String type.setSupertypeName(CAS.TYPE_NAME_STRING); // try to get desecription from EAnnotation EAnnotation eannot = aEEnum.getEAnnotation("http://uima.apache.org"); if (eannot != null) { type.setDescription((String) eannot.getDetails().get("description")); } // set allowed values EList literals = aEEnum.getELiterals(); AllowedValue[] vals = new AllowedValue[literals.size()]; for (int i = 0; i < literals.size(); i++) { EEnumLiteral literal = (EEnumLiteral) literals.get(i); vals[i] = uimaFactory.createAllowedValue(); vals[i].setString(literal.getName()); EAnnotation literalAnnot = literal.getEAnnotation("http://uima.apache.org"); if (literalAnnot != null) { vals[i].setDescription((String) literalAnnot.getDetails().get("description")); } } type.setAllowedValues(vals); return type; }