Dynamically define new classes of annotation

14 views
Skip to first unread message

Alain Désilets

unread,
Jun 7, 2019, 11:08:05 AM6/7/19
to dkpro-core-user
I have a webapp that needs to support the creation of brand new Entity types and to have those new types be active without needing to restart the webapp.

I understand that I can define the new entities in a typesystem.xml file, but is there a streamlined way to:

- generate the annotation .class files from this typesystem.xml file
- load those classes dynamically in the currently running webapp?

Thx.

Richard Eckart de Castilho

unread,
Jun 10, 2019, 4:26:40 PM6/10/19
to dkpro-c...@googlegroups.com
Hi,
There is no need to generate class files from the typesystem.xml. It is not even necessary to have a typesystem.xml file at all since you can set up a type definition purely programmatically.

In the WebAnno/INCEpTION annotation editors, we do this:

1) use uimaFIT to scan for type system files in the classpath (org.apache.uima.fit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription())
2) programmatically generate type definitions for any of the custom types that the users have created as part of their annotation projects
3) merge the two (org.apache.uima.util.CasCreationUtils.mergeTypeSystems(Collection<? extends TypeSystemDescription>))
4) create a CAS object from the merged type systems (org.apache.uima.util.CasCreationUtils.createCas(TypeSystemDescription, TypePriorities, FsIndexDescription[]))
5) use the CAS API (not the JCas API) to store/access annotations in the CAS - the CAS API does not rely on pre-generated classes (contrary to the JCas API)

Cheers,

-- Richard

Alain Désilets

unread,
Jun 11, 2019, 6:46:29 AM6/11/19
to dkpro-c...@googlegroups.com
As usual, thanks Richard.

Alain

--
You received this message because you are subscribed to a topic in the Google Groups "dkpro-core-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dkpro-core-user/z5PC4r-1T38/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dkpro-core-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dkpro-core-user/0823AA76-EA0F-4830-8047-A8C9073FBBAA%40gmail.com.

Alain Désilets

unread,
Jun 11, 2019, 7:12:59 AM6/11/19
to dkpro-c...@googlegroups.com



1) use uimaFIT to scan for type system files in the classpath (org.apache.uima.fit.factory.TypeSystemDescriptionFactory.createTypeSystemDescription())
 
2) programmatically generate type definitions for any of the custom types that the users have created as part of their annotation projects

In my particular case, I have a typesystem.xml  on disk, but it's not in the classpath. Is there a way I can read this file into the TypeSystemDescription created in step 1)? I have been snooping around the doc for DKpro and UIMA and I can't find such methods.

Richard Eckart de Castilho

unread,
Jul 6, 2019, 4:36:26 AM7/6/19
to dkpro-c...@googlegroups.com
On 11. Jun 2019, at 13:12, Alain Désilets <alainde...@gmail.com> wrote:
>
> In my particular case, I have a typesystem.xml on disk, but it's not in the classpath. Is there a way I can read this file into the TypeSystemDescription created in step 1)? I have been snooping around the doc for DKpro and UIMA and I can't find such methods.

https://uima.apache.org/d/uimafit-current/api/org/apache/uima/fit/factory/TypeSystemDescriptionFactory.html#createTypeSystemDescriptionFromPath-java.lang.String...-

Cheers,

-- Richard
Reply all
Reply to author
Forward
0 new messages