Re: uima jcas get annotation type from string

2014-02-14 Thread hannes schantl
 thanks for the answers.

Is there also a way to get a Type from a String, which can be used as
argument for the JCasUtil.select method?

I want to use the type object to get all Annotations of type Sentence from
the Cas. And further extract all Annotations within this
sentence. There for sure other ways to solve this issue without using
JCasUtil, but it seems JCasUtil provide an easy way to do this by using the
methods
JCasUtil.select and JCasUtil.selectCovered.

greetings Hannes


Am 13.02.2014 22:11, schrieb Thomas Ginter:

There are a couple of different ways to get a pointer to specific Type object.

jcas.getRequiredType(mypackage.AnnotationType);
(cas|jcas).getTypeSystem.getType(mypackage.AnnotationType);

The question is what do you want to do with the Type object once you have it.

Thanks,

Thomas ginter801-448-7676thomas.gin...@utah.edu




On Feb 13, 2014, at 6:03 AM, hannes schantl
johannes.scha...@gmail.com johannes.scha...@gmail.com wrote:


 Hi,

Is there a way to get an annotation Type from the cas(or Jcas) from a
string.
For example, i am looking for something like that:
jcas.getCasType(AnnotationName)

greetings Hannes


Re: uima jcas get annotation type from string

2014-02-14 Thread Richard Eckart de Castilho
On 14.02.2014, at 09:50, hannes schantl johannes.scha...@gmail.com wrote:

 thanks for the answers.
 
 Is there also a way to get a Type from a String, which can be used as
 argument for the JCasUtil.select method?

The JCasUtil methods assume that you have access to JCas classes, e.g.

  import mypackage.AnnotationType;
  JCasUtil.select(jcas, AnnotationType.class)

If you want to select based on names/types, not on JCas-classes, you could
consider using the CasUtil methods:

  CAS cas = jcas.getCas(); // Or use inherit from CasAnnotator_ImplBase
  Type annotationType = CasUtil.getType(cas, mypackage.AnnotationType);
  CasUtil.select(cas, annotationType);

Of course, you could also use reflection to get the class for your annotation
type and pass it to JCasUtil - but that would be redundant and would require
handling various exceptions:

  JCasUtil.select(jcas, Class.forName(mypackage.AnnotationType))

 I want to use the type object to get all Annotations of type Sentence from
 the Cas. And further extract all Annotations within this
 sentence. There for sure other ways to solve this issue without using
 JCasUtil, but it seems JCasUtil provide an easy way to do this by using the
 methods
 JCasUtil.select and JCasUtil.selectCovered.

CasUtil largely mirrors the functionality of JCasUtil. In fact, JCasUtil calls
out to CasUtil for most of the grunt work.

Cheers,

-- Richard

 greetings Hannes
 
 
 Am 13.02.2014 22:11, schrieb Thomas Ginter:
 
 There are a couple of different ways to get a pointer to specific Type object.
 
 jcas.getRequiredType(mypackage.AnnotationType);
 (cas|jcas).getTypeSystem.getType(mypackage.AnnotationType);
 
 The question is what do you want to do with the Type object once you have it.
 
 Thanks,
 
 Thomas ginter801-448-7676thomas.gin...@utah.edu
 
 On Feb 13, 2014, at 6:03 AM, hannes schantl
 johannes.scha...@gmail.com johannes.scha...@gmail.com wrote:
 
 
 Hi,
 
 Is there a way to get an annotation Type from the cas(or Jcas) from a
 string.
 For example, i am looking for something like that:
 jcas.getCasType(AnnotationName)
 
 greetings Hannes



Re: uima jcas get annotation type from string

2014-02-14 Thread Thomas Ginter
Once you have the Type object you can get all and index to all the annotations 
in the case using:

AnnotationIndexAnnotation mySentenceIndex = 
jcas.getAnnotationIndex(mySentenceTypeObj);

Then you can get an iterator over the index using:

FSIteratorAnnotation mySentenceIterator = mySentenceIndex.iterator();

or you could just use the iterator loop syntax in Java such as:

for(Annotation sentence : mySentenceIndex) {
/** Do something cool **/
}

The AnnotationLibrarian class in the Leo framework provides some pretty 
convenient methods for this as well such as:

CollectionSentence sentenceList = 
AnnotationLibrarian.getAllAnnotationsOfType(jcas, mySentenceTypeObj);

which returns a list of Sentence annotation types.  You can find more 
information about the Leo framework at the following URL:

http://decipher.chpc.utah.edu/sites/gov.va.vinci/leo/2014.01.8/

Thanks,

Thomas Ginter
801-448-7676
thomas.gin...@utah.edu




On Feb 14, 2014, at 2:50 AM, Richard Eckart de Castilho r...@apache.org wrote:

 On 14.02.2014, at 09:50, hannes schantl johannes.scha...@gmail.com wrote:
 
 thanks for the answers.
 
 Is there also a way to get a Type from a String, which can be used as
 argument for the JCasUtil.select method?
 
 The JCasUtil methods assume that you have access to JCas classes, e.g.
 
  import mypackage.AnnotationType;
  JCasUtil.select(jcas, AnnotationType.class)
 
 If you want to select based on names/types, not on JCas-classes, you could
 consider using the CasUtil methods:
 
  CAS cas = jcas.getCas(); // Or use inherit from CasAnnotator_ImplBase
  Type annotationType = CasUtil.getType(cas, mypackage.AnnotationType);
  CasUtil.select(cas, annotationType);
 
 Of course, you could also use reflection to get the class for your annotation
 type and pass it to JCasUtil - but that would be redundant and would require
 handling various exceptions:
 
  JCasUtil.select(jcas, Class.forName(mypackage.AnnotationType))
 
 I want to use the type object to get all Annotations of type Sentence from
 the Cas. And further extract all Annotations within this
 sentence. There for sure other ways to solve this issue without using
 JCasUtil, but it seems JCasUtil provide an easy way to do this by using the
 methods
 JCasUtil.select and JCasUtil.selectCovered.
 
 CasUtil largely mirrors the functionality of JCasUtil. In fact, JCasUtil calls
 out to CasUtil for most of the grunt work.
 
 Cheers,
 
 -- Richard
 
 greetings Hannes
 
 
 Am 13.02.2014 22:11, schrieb Thomas Ginter:
 
 There are a couple of different ways to get a pointer to specific Type 
 object.
 
 jcas.getRequiredType(mypackage.AnnotationType);
 (cas|jcas).getTypeSystem.getType(mypackage.AnnotationType);
 
 The question is what do you want to do with the Type object once you have it.
 
 Thanks,
 
 Thomas ginter801-448-7676thomas.gin...@utah.edu
 
 On Feb 13, 2014, at 6:03 AM, hannes schantl
 johannes.scha...@gmail.com johannes.scha...@gmail.com wrote:
 
 
 Hi,
 
 Is there a way to get an annotation Type from the cas(or Jcas) from a
 string.
 For example, i am looking for something like that:
 jcas.getCasType(AnnotationName)
 
 greetings Hannes
 



Re: ducc_ling only switches the default group

2014-02-14 Thread Jim Challenger
I attached a patch to Jira UIMA-3616 and instructions on how to apply 
it.  If there are any problems let me know and I'll get right on it.   
Note that you don't need a source-level distribution (ducc_ling source 
is supplied in the binary distro) but you do need a current 1.0.0 
ducc_ling.c.  ducc_ling is back-compatible quite a ways, so if you're 
still on a pre 1.0.0 version, it should be safe to get the 1.0.0 
ducc_ling, patch it, and install it in the beta.


Jim

On 2/14/14 9:25 AM, Jim Challenger wrote:

Erdem,
Sorry, I'd only been watching the devlist up to now.

This is just an oversight, I'll fix and get a patch soon.
Jim