Hi,
I got the request on my table that the computation of the result spec
for the capabilityLanguageFlow takes to much time.
I looked at the code and found something interesting... maybe I'm wrong,
I'm not sure.
When looking at the ASB_impl.java at processUntilNextOutputCas() I found
the following:
//check if we have to set result spec, to support
capability language flow
if (nextStep instanceof SimpleStepWithResultSpec) {
ResultSpecification rs =
((SimpleStepWithResultSpec)nextStep).getResultSpecification();
if (rs != null) {
nextAe.setResultSpecification(rs);
}
}
// invoke next AE in flow
CasIterator casIter = null;
CAS outputCas = null; //used if the AE we call outputs a
new CAS
try {
casIter = nextAe.processAndOutputNewCASes(cas);
When a capabilityLanguageFlow is used, the ResultSpec for the flow
engines are precomputed if possible. The code above takes this
precomputed ResultSpec from the flow node and set it for the current AE.
When I go deeper to
casIter = nextAe.processAndOutputNewCASes(cas);
I found in the PrimitiveAnalysisEngine_impl.java class in the
callAnalysisComponentProcess() method the following:
if (mResultSpecChanged || mLastTypeSystem != view.getTypeSystem()) {
mLastTypeSystem = view.getTypeSystem();
mCurrentResultSpecification.compile(mLastTypeSystem);
// the actual ResultSpec we send to the component is formed by
// looking at this primitive AE's declared output types and
eliminiating
// any that are not in mCurrentResultSpecification.
ResultSpecification analysisComponentResultSpec =
computeAnalysisComponentResultSpec(
mCurrentResultSpecification,
getAnalysisEngineMetaData().getCapabilities());
// compile result spec - necessary to get type subsumption to
work properly
analysisComponentResultSpec.compile(mLastTypeSystem);
mAnalysisComponent.setResultSpecification(analysisComponentResultSpec);
mResultSpecChanged = false;
}
any time when the ResultSpec changed, the ResultSpec is recomputed. But
the ResultSpec is changed any time when setResultSpecification() is called.
So what does this mean. The first code fragment in the email shows how
to get the ResultSpec from the flow controller and set it on the AE.
- So the result spec changed - The second code fragment shows what is
executed if the ResultSpec has been changed and how it is recomputed.
This means that the ResultSpec is recomputed each time process is
called. I don't think this is necessary.
Beyond that it seems to me that the ResultsSpec
mCurrentResultSpecification
and the computed ResultSpec
analysisComponentResultSpec
have the same content.
Opinions? Did I miss something?
-- Michael