uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ludwig Wildner <ludwig.wild...@scai.fraunhofer.de>
Subject Re: How to create a FeaturePath when using JCas?
Date Tue, 07 Aug 2012 16:46:17 GMT
Hi Peter,

try this:

FeaturePath featurePath = aJCas.createFeaturePath();
featurePath.addFeature(aJCas.getCasType(SearchProfile.type).getFeatureByBaseName("isCaseSensitive"));

-Ludwig

----- Urspr√ľngliche Mail -----
Von: "Peter Thygesen" <pt.activemq@gmail.com>
An: user@uima.apache.org
Gesendet: Dienstag, 7. August 2012 16:34:10
Betreff: How to create a FeaturePath when using JCas?

I'm trying to write the code for a filtered iterator using
createFilteredIterator and FSMatchConstraint.

I used jcasgen to create java classes for my type system.

I have a type calles SearchProfile which has a feature isCaseSensitive.

I cannot figure out how to get the path to "isCaseSensitive" from my type
SearchProfile. I want to do it in a type safe way (compile-time).

code:

ConstraintFactory constraintFactory = aJCas.getConstraintFactory();

    FSBooleanConstraint booleanConstraint = new FSBooleanConstraintImpl();
    booleanConstraint.eq(true);

    FeaturePath featurePath = ???

    FSMatchConstraint matchConstraint = constraintFactory.embedConstraint(
featurePath ,booleanConstraint);

    FSIndex profileFSIndex = aJCas.getAnnotationIndex(SearchProfile.type);
    FSIterator<SearchProfile> profileIterator =
aJCas.createFilteredIterator(profileFSIndex.iterator(), matchConstraint);



cheers,

Peter Thygesen

Mime
View raw message