[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536041#comment-16536041
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

reckart closed pull request #13: [UIMA-5793] FSUtil.getFeature fails when 
called with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/13
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536039#comment-16536039
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

reckart closed pull request #12: [UIMA-5793] FSUtil.getFeature fails when 
called with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/12
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536021#comment-16536021
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

asfgit commented on issue #12: [UIMA-5793] FSUtil.getFeature fails when called 
with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/12#issuecomment-403270590
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Apache%20UIMA%20uimaFIT%20(GitHub%20PR)/26/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536018#comment-16536018
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

asfgit commented on issue #13: [UIMA-5793] FSUtil.getFeature fails when called 
with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/13#issuecomment-403269882
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Apache%20UIMA%20uimaFIT%20(GitHub%20PR)/25/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535942#comment-16535942
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

asfgit commented on issue #13: [UIMA-5793] FSUtil.getFeature fails when called 
with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/13#issuecomment-403250375
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Apache%20UIMA%20uimaFIT%20(GitHub%20PR)/24/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535937#comment-16535937
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

asfgit commented on issue #13: [UIMA-5793] FSUtil.getFeature fails when called 
with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/13#issuecomment-403249490
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Apache%20UIMA%20uimaFIT%20(GitHub%20PR)/22/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535933#comment-16535933
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

asfgit commented on issue #12: [UIMA-5793] FSUtil.getFeature fails when called 
with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/12#issuecomment-403249086
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Apache%20UIMA%20uimaFIT%20(GitHub%20PR)/21/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535934#comment-16535934
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

reckart opened a new pull request #13: [UIMA-5793] FSUtil.getFeature fails when 
called with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/13
 
 
   - Support retrieving values using Object as class
   - Also support various additional ways of retrieving feature values using 
suitable target types
   - Added more tests


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-07-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535930#comment-16535930
 ] 

ASF GitHub Bot commented on UIMA-5793:
--

reckart opened a new pull request #12: [UIMA-5793] FSUtil.getFeature fails when 
called with Object.class on multi-valued features
URL: https://github.com/apache/uima-uimafit/pull/12
 
 
   - Support retrieving values using Object as class
   - Also support various additional ways of retrieving feature values using 
suitable target types
   - Added more tests


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 3.0.0uimaFIT, 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (UIMA-5793) FSUtil.getFeature fails when called with Object.class on multi-valued features

2018-06-12 Thread Richard Eckart de Castilho (JIRA)


[ 
https://issues.apache.org/jira/browse/UIMA-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16509704#comment-16509704
 ] 

Richard Eckart de Castilho commented on UIMA-5793:
--

While at it, would be good to also support getting arrays as ArrayFS:

{code}

value = FSUtil.getFeature(aFS, aFeature.getName(), ArrayFS.*class*);

{code}

yields

{noformat}

Error: Unable to coerce value of feature 
[de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
[de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
[org.apache.uima.cas.ArrayFS]

{noformat}

> FSUtil.getFeature fails when called with Object.class on multi-valued features
> --
>
> Key: UIMA-5793
> URL: https://issues.apache.org/jira/browse/UIMA-5793
> Project: UIMA
>  Issue Type: Improvement
>  Components: uimaFIT
>Reporter: Richard Eckart de Castilho
>Assignee: Richard Eckart de Castilho
>Priority: Minor
> Fix For: 2.5.0uimaFIT
>
>
> When FSUtil.getFeature(fs, feature, type) is called on a feature that is 
> multi-valued and type is Object, then the method fails with a message like
> {noformat}
> Unable to coerce value of feature 
> [de.tudarmstadt.ukp.inception.api.kb.type.Fact:object] with type 
> [de.tudarmstadt.ukp.inception.api.kb.type.FactObjectLink[]] into 
> [java.lang.Object]
> {noformat}
> This is because Object is no an array or collection type. However, 
> FSUtil.getFeatures should handle this as a special case. When the Object is 
> used, basically any return value is acceptable. FSUtil should have defined 
> behavior here, e.g. returning either an array or a list representation of the 
> multi-value.
> This is what current work-around code looks like:
> {code}
> private Object getValue(FeatureStructure fs, AnnotationFeature aFeature)
> {
> Object value;
> 
> Feature f = fs.getType().getFeatureByBaseName(aFeature.getName());
> if (f.getRange().isPrimitive()) {
> value = FSUtil.getFeature(fs, aFeature.getName(), Object.class);
> }
> else if (FSUtil.isMultiValuedFeature(fs, f)) {
> value = FSUtil.getFeature(fs, aFeature.getName(), List.class);
> }
> else {
> value = FSUtil.getFeature(fs, aFeature.getName(), 
> FeatureStructure.class);
> }
> 
> return value;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)