Hi all,
I'm trying to make a simple function which take an annotation and a Type and print all the value associated with all the feature present in the Type.
This is the recursive function:

public void printTypeSystem(Type uimaType, Annotation annotation, int level){
        String levelString="\t";
        for (int i=0; i<level; ++i)
            levelString += "\t";
        List <Feature> feauturesList = uimaType.getFeatures();
        if(level == 1)
            System.out.println("T.S. = "+uimaType.getName());
        for(int i=0; i<feauturesList.size(); ++i){
            Feature feature = (Feature) feauturesList.get(i);
            String nameFeat = feature.getName();
            if(!nameFeat.startsWith("uima.")){
                Type typeRange = feature.getRange();
                if(typeRange.isPrimitive()){
String value = annotation.getFeatureValueAsString(feature); System.out.println(levelString+"F: "+nameFeat+" = "+" V: "+value);
                }
                else{
System.out.println(levelString+"F: "+nameFeat+" = "+" TS: "+typeRange.getName());
                    printTypeSystem(typeRange, annotation, level+1);
                }
            }
        }
    }


The problem is that I'm able to print only the values associated with the "first level" of features (when they are primitive). If for example a Type has a feature that as a value as another Type (the else in the source code) when I do annotation.getFeatureValueAsString(feature) to print the values associated with the feature of this "inside" Type all I get is an empty String (not an error or a null value).

Is there a problem in my code or the error is somewhere else?

Thanks

Andrea Turbati

--

-------------------------------------------------

Dott. Andrea Turbati

AI Research Group PhD student,

Dept. of Computer Science, Systems and Production

University of Roma, Tor Vergata

Via del Politecnico 1 00133 ROMA (ITALY)

tel: +39 06 7259 7332 (lab)

e_mail: [email protected]

home page: http://art.uniroma2.it/turbati/

--------------------------------------------------

Reply via email to