You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Richard Eckart de Castilho <re...@apache.org> on 2016/03/02 23:00:56 UTC

Transitively copied FSes in CasCopier

Hi,

we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.

We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:

  FeatureStructure fsCopy = cc.copyFs(fs);

We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.

I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.

Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.

Cheers,

-- Richard

Re: Transitively copied FSes in CasCopier

Posted by Marshall Schor <ms...@schor.com>.
:-)

On 3/3/2016 9:10 AM, Richard Eckart de Castilho wrote:
> Seems to work :)
>
> -- Richard
>
>> On 03.03.2016, at 12:35, Richard Eckart de Castilho <re...@apache.org> wrote:
>>
>> Actually, I just figured out that copyFS() apparently does
>>
>> 1) not make duplicate copies
>> 2) returns the copy of an FS even if it was created as a transitive operation (i.e. it does not return null in case an FS had already been copied as part of a previous operation)
>>
>> That would actually be sufficient and we'll test that now.
>>
>> Cheers,
>>
>> -- Richard
>>
>>> On 03.03.2016, at 00:02, Richard Eckart de Castilho <re...@apache.org> wrote:
>>>
>>> I think what would work for us would be two methods like this:
>>>
>>> public FeatureStructure getCopy(FeatureStructure aFS) {
>>>     int addr = mFsMap.get(originalSrcCas.getLowLevelCAS().ll_getFSRef(aFS));
>>>     return addr != 0 ? originalTgtCas.getLowLevelCAS().ll_getFSForRef(addr) : null;
>>> }
>>>
>>> public int getCopy(int aFS) {
>>>     return mFsMap.get(aFS);
>>> }
>>>
>>> Since we also have two variants of the alreadyCopied() method, I don't think the two methods above expose significantly more of the internal structure:
>>>
>>> public boolean alreadyCopied(FeatureStructure aFS) {
>>> public boolean alreadyCopied(int aFS) {
>>>
>>> I don't mind doing the indexing externally as long as there is some way of figuring out what is the copied FS given an original FS.
>>>
>>> Cheers,
>>>
>>> -- Richard
>>>
>>>> On 02.03.2016, at 23:55, Marshall Schor <ms...@schor.com> wrote:
>>>>
>>>> As an alternative to exposing internals, we could add some method(s) or
>>>> modifiers to existing methods to the cas copier for doing one-by-one copying. 
>>>> One modifier might index "all" copied FSs (including the one copied); another
>>>> might index just those FSes which are indexed in the "from" view. 
>>>>
>>>> Another thing to note is that FSes are indexed with respect to a particular
>>>> view, so this additional capability would index FSs in the view being copied to.
>>>>
>>>> -Marshall
>>>>
>>>>
>>>> On 3/2/2016 5:00 PM, Richard Eckart de Castilho wrote:
>>>>> Hi,
>>>>>
>>>>> we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.
>>>>>
>>>>> We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:
>>>>>
>>>>> FeatureStructure fsCopy = cc.copyFs(fs);
>>>>>
>>>>> We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.
>>>>>
>>>>> I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.
>>>>>
>>>>> Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> -- Richard
>


Re: Transitively copied FSes in CasCopier

Posted by Richard Eckart de Castilho <re...@apache.org>.
Seems to work :)

-- Richard

> On 03.03.2016, at 12:35, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> Actually, I just figured out that copyFS() apparently does
> 
> 1) not make duplicate copies
> 2) returns the copy of an FS even if it was created as a transitive operation (i.e. it does not return null in case an FS had already been copied as part of a previous operation)
> 
> That would actually be sufficient and we'll test that now.
> 
> Cheers,
> 
> -- Richard
> 
>> On 03.03.2016, at 00:02, Richard Eckart de Castilho <re...@apache.org> wrote:
>> 
>> I think what would work for us would be two methods like this:
>> 
>> public FeatureStructure getCopy(FeatureStructure aFS) {
>>     int addr = mFsMap.get(originalSrcCas.getLowLevelCAS().ll_getFSRef(aFS));
>>     return addr != 0 ? originalTgtCas.getLowLevelCAS().ll_getFSForRef(addr) : null;
>> }
>> 
>> public int getCopy(int aFS) {
>>     return mFsMap.get(aFS);
>> }
>> 
>> Since we also have two variants of the alreadyCopied() method, I don't think the two methods above expose significantly more of the internal structure:
>> 
>> public boolean alreadyCopied(FeatureStructure aFS) {
>> public boolean alreadyCopied(int aFS) {
>> 
>> I don't mind doing the indexing externally as long as there is some way of figuring out what is the copied FS given an original FS.
>> 
>> Cheers,
>> 
>> -- Richard
>> 
>>> On 02.03.2016, at 23:55, Marshall Schor <ms...@schor.com> wrote:
>>> 
>>> As an alternative to exposing internals, we could add some method(s) or
>>> modifiers to existing methods to the cas copier for doing one-by-one copying. 
>>> One modifier might index "all" copied FSs (including the one copied); another
>>> might index just those FSes which are indexed in the "from" view. 
>>> 
>>> Another thing to note is that FSes are indexed with respect to a particular
>>> view, so this additional capability would index FSs in the view being copied to.
>>> 
>>> -Marshall
>>> 
>>> 
>>> On 3/2/2016 5:00 PM, Richard Eckart de Castilho wrote:
>>>> Hi,
>>>> 
>>>> we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.
>>>> 
>>>> We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:
>>>> 
>>>> FeatureStructure fsCopy = cc.copyFs(fs);
>>>> 
>>>> We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.
>>>> 
>>>> I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.
>>>> 
>>>> Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.
>>>> 
>>>> Cheers,
>>>> 
>>>> -- Richard
>>> 
>> 
> 


Re: Transitively copied FSes in CasCopier

Posted by Richard Eckart de Castilho <re...@apache.org>.
Actually, I just figured out that copyFS() apparently does

1) not make duplicate copies
2) returns the copy of an FS even if it was created as a transitive operation (i.e. it does not return null in case an FS had already been copied as part of a previous operation)

That would actually be sufficient and we'll test that now.

Cheers,

-- Richard

> On 03.03.2016, at 00:02, Richard Eckart de Castilho <re...@apache.org> wrote:
> 
> I think what would work for us would be two methods like this:
> 
>  public FeatureStructure getCopy(FeatureStructure aFS) {
>      int addr = mFsMap.get(originalSrcCas.getLowLevelCAS().ll_getFSRef(aFS));
>      return addr != 0 ? originalTgtCas.getLowLevelCAS().ll_getFSForRef(addr) : null;
>  }
> 
>  public int getCopy(int aFS) {
>      return mFsMap.get(aFS);
>  }
> 
> Since we also have two variants of the alreadyCopied() method, I don't think the two methods above expose significantly more of the internal structure:
> 
>  public boolean alreadyCopied(FeatureStructure aFS) {
>  public boolean alreadyCopied(int aFS) {
> 
> I don't mind doing the indexing externally as long as there is some way of figuring out what is the copied FS given an original FS.
> 
> Cheers,
> 
> -- Richard
> 
>> On 02.03.2016, at 23:55, Marshall Schor <ms...@schor.com> wrote:
>> 
>> As an alternative to exposing internals, we could add some method(s) or
>> modifiers to existing methods to the cas copier for doing one-by-one copying. 
>> One modifier might index "all" copied FSs (including the one copied); another
>> might index just those FSes which are indexed in the "from" view. 
>> 
>> Another thing to note is that FSes are indexed with respect to a particular
>> view, so this additional capability would index FSs in the view being copied to.
>> 
>> -Marshall
>> 
>> 
>> On 3/2/2016 5:00 PM, Richard Eckart de Castilho wrote:
>>> Hi,
>>> 
>>> we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.
>>> 
>>> We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:
>>> 
>>> FeatureStructure fsCopy = cc.copyFs(fs);
>>> 
>>> We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.
>>> 
>>> I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.
>>> 
>>> Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.
>>> 
>>> Cheers,
>>> 
>>> -- Richard
>> 
> 


Re: Transitively copied FSes in CasCopier

Posted by Richard Eckart de Castilho <re...@apache.org>.
I think what would work for us would be two methods like this:

  public FeatureStructure getCopy(FeatureStructure aFS) {
      int addr = mFsMap.get(originalSrcCas.getLowLevelCAS().ll_getFSRef(aFS));
      return addr != 0 ? originalTgtCas.getLowLevelCAS().ll_getFSForRef(addr) : null;
  }

  public int getCopy(int aFS) {
      return mFsMap.get(aFS);
  }

Since we also have two variants of the alreadyCopied() method, I don't think the two methods above expose significantly more of the internal structure:

  public boolean alreadyCopied(FeatureStructure aFS) {
  public boolean alreadyCopied(int aFS) {

I don't mind doing the indexing externally as long as there is some way of figuring out what is the copied FS given an original FS.

Cheers,

-- Richard

> On 02.03.2016, at 23:55, Marshall Schor <ms...@schor.com> wrote:
> 
> As an alternative to exposing internals, we could add some method(s) or
> modifiers to existing methods to the cas copier for doing one-by-one copying. 
> One modifier might index "all" copied FSs (including the one copied); another
> might index just those FSes which are indexed in the "from" view. 
> 
> Another thing to note is that FSes are indexed with respect to a particular
> view, so this additional capability would index FSs in the view being copied to.
> 
> -Marshall
> 
> 
> On 3/2/2016 5:00 PM, Richard Eckart de Castilho wrote:
>> Hi,
>> 
>> we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.
>> 
>> We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:
>> 
>>  FeatureStructure fsCopy = cc.copyFs(fs);
>> 
>> We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.
>> 
>> I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.
>> 
>> Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.
>> 
>> Cheers,
>> 
>> -- Richard
> 


Re: Transitively copied FSes in CasCopier

Posted by Marshall Schor <ms...@schor.com>.
As an alternative to exposing internals, we could add some method(s) or
modifiers to existing methods to the cas copier for doing one-by-one copying. 
One modifier might index "all" copied FSs (including the one copied); another
might index just those FSes which are indexed in the "from" view. 

Another thing to note is that FSes are indexed with respect to a particular
view, so this additional capability would index FSs in the view being copied to.

-Marshall


On 3/2/2016 5:00 PM, Richard Eckart de Castilho wrote:
> Hi,
>
> we think we have a case in DKPro Core where we need to know the FSes that are transitively copied by CasCopier.
>
> We have an FS that references other FSes. When we copy the initial FS, CasCopier also copies all the transitively referenced FSes - but it does not index them in the new CAS. The call we use is:
>
>   FeatureStructure fsCopy = cc.copyFs(fs);
>
> We collect all the copies and later index the, but we have no idea about the transitively references FSes and fail to index those.
>
> I imagine what we would need is either access to the private mFsMap in CasCopier or that cc.copyFS(fs) returns a list/set of FSes or some alternative solution.
>
> Any comments or insights how to index transitively references FSes when doing a one-by-one copy would be appreciated.
>
> Cheers,
>
> -- Richard