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 <[email protected]> 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 <[email protected]> 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 >> >
