uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <eckar...@tk.informatik.tu-darmstadt.de>
Subject Re: How to deal with types which define allowed values?
Date Mon, 06 Jun 2011 11:51:29 GMT
Hi Jörn,

> Does LowLevelTypeSystem.getStringSet simply return an empty array in the case someone
defined a string subtype but does not define allowed values? Or is it possible to define a
string subtype with an empty set of allowed values?


It is possible to define a string sub-type without any allowed values and it this case you
get an empty array. I used this little test case:

		TypeSystemDescription tsd = TypeSystemDescriptionFactory
				.createTypeSystemDescriptionFromPath("TypeSystem.xml");
		CAS cas = CasCreationUtils.createCas(tsd, null, null);

		ResourceSpecifierFactory factory = UIMAFramework.getResourceSpecifierFactory();
		TypeSystem typeSystem = cas.getTypeSystem();
		Type type = typeSystem.getType("POS");

		// check for string subtypes
		LowLevelTypeSystem lts = typeSystem.getLowLevelTypeSystem();
		final int typeCode = lts.ll_getCodeForType(type);
		String[] strings = lts.ll_getStringSet(typeCode);
		System.out.println(strings.length);
		for (int i = 0; i < strings.length; i++) {
			System.out.println(strings[i]);
		}

Cheers,

Richard

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
eckartde@tk.informatik.tu-darmstadt.de 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 





Mime
View raw message