Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[smila-user] BPEL if condition in pipeline

Hi,

I'm writing a SMILA pipeline that updates the Solr, just with records that have a certain attribute set. I started from the AddPipeline definition, in which there is an if condition on the "MimeType" attribute, modifying it as follows:

FrameMatchingPipeline.bpel

<process name="FrameMatchingPipeline" targetNamespace="http://www.eclipse.org/smila/processor"
  xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:proc="http://www.eclipse.org/smila/processor" xmlns:rec="http://www.eclipse.org/smila/record"
  xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable">

  <import location="processor.wsdl" namespace="http://www.eclipse.org/smila/processor"
    importType="http://schemas.xmlsoap.org/wsdl/" />

  <partnerLinks>
    <partnerLink name="Pipeline" partnerLinkType="proc:ProcessorPartnerLinkType" myRole="service" />
  </partnerLinks>

  <extensions>
    <extension namespace="http://www.eclipse.org/smila/processor" mustUnderstand="no" />
  </extensions>

  <variables>
    <variable name="request" messageType="proc:ProcessorMessage" />
  </variables>
   
    <sequence name="FrameMatchingPipeline">
    <receive name="start" partnerLink="Pipeline" portType="proc:ProcessorPortType"
      operation="process" variable="request" createInstance="yes" />

         <extensionActivity>
           <proc:invokePipelet name="FrameMatchingPipelet">
             <proc:pipelet class="it.polimi.FrameMatching.FrameMatchingPipelet" />
             <proc:variables input="request" output="request" />
             <proc:configuration>
                 <rec:Val key="matcherPath">D:/Matcher/Matcher.exe</rec:Val>
                 <rec:Val key="threshold">0.025</rec:Val>
                 <rec:Val key="upperBound">0.07</rec:Val>
                 <rec:Val key="serverAddress">https://85.18.109.178:443/logodetection/listfolder.cgi</rec:Val>
                 <rec:Val key="userID">polmi</rec:Val>
                 <rec:Val key="password">logo_detection_2012</rec:Val>
             </proc:configuration>
           </proc:invokePipelet>
         </extensionActivity>
        
         <forEach counterName="index" parallel="yes" name="iterateRecords">
           <startCounterValue>1</startCounterValue>
           <finalCounterValue>count($request.records/rec:Record)</finalCounterValue>
           <scope>

            <sequence>
             <if name="MatchScoreGreaterThanZero">
               <condition>not($request.records/rec:Record[position()=$index]/rec:Val[@key="MimeType"])</condition>
               <extensionActivity>
                 <proc:invokePipelet name="SolrIndexPipelet">
                     <proc:pipelet class="org.eclipse.smila.solr.index.SolrIndexPipelet" />
                     <proc:variables input="request" index="index"/>
                     <proc:configuration>
                          <rec:Val key="ExecutionMode">ADD</rec:Val>
                          <rec:Val key="CoreName">MatchCore</rec:Val>
                          <rec:Seq key="CoreFields">
                            <rec:Map>
                                  <rec:Val key="FieldName">frameURI</rec:Val>
                            </rec:Map>
                            <rec:Map>
                                  <rec:Val key="FieldName">videoName</rec:Val>
                               </rec:Map>
                            <rec:Map>
                                 <rec:Val key="FieldName">logoURI</rec:Val>
                            </rec:Map>
                            <rec:Map>
                                  <rec:Val key="FieldName">brandName</rec:Val>
                            </rec:Map>
                            <rec:Map>
                                  <rec:Val key="FieldName">matchScore</rec:Val>
                            </rec:Map>
                          </rec:Seq>
                    </proc:configuration>
                  </proc:invokePipelet>
            </extensionActivity>
          </if>
        </sequence>
      </scope>
    </forEach>
   
    <extensionActivity>
           <proc:invokePipelet name="MatchFilterPipelet">
             <proc:pipelet class="it.polimi.FrameMatching.MatchFilterPipelet" />
             <proc:variables input="request" output="request" />
             <proc:configuration>
                 <rec:Val key="lowerBound">0.03</rec:Val>
                 <rec:Val key="upperBound">0.07</rec:Val>
             </proc:configuration>   
           </proc:invokePipelet>
         </extensionActivity>
        
    <reply name="end" partnerLink="Pipeline" portType="proc:ProcessorPortType" operation="process"
      variable="request" />
    <exit />
  </sequence>
</process>

Here the pipelet in which I set (or not) the attribute according to a condition,

FrameMatchingPipelet.java

public String[] process(Blackboard blackboard, String[] recordIds)
            throws ProcessingException {   
             
                               ...
       
                                String recordID=keyframeURI+logoURI;
                                Record record = blackboard.getRecord(recordID, Get.NEW);   
                                record.setSource("matches");
                                record.getMetadata().put("videoRecordId", videoRecordId);
                                record.getMetadata().put("frameURI", keyframeURI);
                                record.getMetadata().put("logoURI", logoURI);
                                record.getMetadata().put("brandName", brandName);
                                record.getMetadata().put("matchScore", score);
                               
                                if (score<upperBound){
                                   
                                    record.getMetadata().put("MimeType", "WHATEVER");
                                    ....
                                }
                                matchRecordIds.add(recordID);
                         ...  
       
        return matchRecordIds.toArray(new String[matchRecordIds.size()]);
    }

I would like to change the attribute "MimeType" with another one, but as I change it, all the records will be indexed in the Solr index, as if the new record attribute is not seen in the BPEL condition.
Is there any other configuration to set?

Thank you,

Nicolò Aquilini

Back to the top