Chavan, Girish wrote:
> Thanks a lot for your reply.
>
> I wanted to know if there was a way to do this entirely programmatically
> without having a type system descriptor file with an imported type
> system as you suggested. This is because I build the CPE dynamically and
> I need to add my types to the original type system dynamically.
>
> However I got an idea from your reply to do the merging using imports
> programmatically using the setImports method on TypeSystemDescription.
>
> This is how I solved my problem.
>
> public static void addMyTypesToTypeSystem(TypeSystemDescription tsd) {
> TypeSystemDescription tsd;
> public addTypeSystem,
> Import[] imports = tsd.getImports();
> Import myImport = new Import_impl();
> myImport.setName("qualified.name.to.my.typesystem.xml");
>
> List<Import> newImports = new ArrayList<Import>();
> newImports.addAll(Arrays.asList(imports));
> newImports.add(myImport);
>
> tsd.setImports(newImports.toArray(new Import[]{}));
> tsd.resolveImports();
> }
A perfectly good solution. There is also a utility method
CasCreationUtils.mergeTypeSystems() that does a similar
thing:
http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/api/org/apache/uima/util/CasCreationUtils.html#mergeTypeSystems(java.util.Collection)
--Thilo
>
> Thanks again,
>
> _______________
> Girish Chavan, MSIS
> Department of Biomedical Informatics (DBMI)
> University of Pittsburgh
>
>
> -----Original Message-----
> From: Matthias Wendt [mailto:[email protected]]
> Sent: Wednesday, July 08, 2009 3:55 AM
> To: [email protected]
> Subject: Re: Merging Type Systems
>
> Hi,
>
> we have used the type system merging feature for some of our pipelines.
> (It came in handy because we needed some special features for the Token
> type in our NER).
>
> Chavan, Girish schrieb:
>> The problem is that I have another Type System that needs to be merged
>> with this one before I persist it.
>>
> The way we achieved this was simply by importing the type system to be
> merged in the type system descriptor of the overall type system.
>
> So if you have two type systems t1, t2 you could create a third type
> system t3 that simply imports t1 and t2.
>
> TypeSystem ts = createCAS(tsDesc).getTypeSystem();
>
>
> Your tsDesc would be t3 then.
>
> Hope this helps,
>
> Matthias
>
>> I could use the TypeSystemDescription.addType method to add the types
>> individually, but is there an easier way to merge two type system
>> descriptions?
>>
>>
>>
>> Thanks
>>
>> _______________
>>
>> Girish Chavan, MSIS
>>
>> Department of Biomedical Informatics (DBMI)
>> University of Pittsburgh
>> UPMC Cancer Pavilion, 302D
>> 5150 Centre Avenue
>> Pittsburgh, PA 15232
>>
>> Office: 412-623-4084
>>
>> Email: [email protected]
>>
>>
>>
>>
>>
>
>