W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2011

RE: Adding p:group gets rid of ERR : Unbound primary output.. why?

From: <vojtech.toman@emc.com>
Date: Thu, 17 Mar 2011 11:34:25 -0400
To: <xproc-dev@w3.org>
Message-ID: <3799D0FD120AD940B731A37E36DAF3FE334C4420F0@MX20A.corp.emc.com>
Yes, inside the oh:save-output step, the "result" port is indeed connected to the "ident" step. But on the outside, when you use the oh:save-output step (SAVEME), there is nothing that connects to (or "consumes") the result of the SAVEME. The specification demands that primary output ports must be connected or p:sink'ed.

Vojtech


--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

From: Alex Muir [mailto:alex.g.muir@gmail.com]
Sent: Thursday, March 17, 2011 4:22 PM
To: Toman, Vojtech
Cc: xproc-dev@w3.org
Subject: Re: Adding p:group gets rid of ERR : Unbound primary output.. why?

Well perhaps I'm not clear on your statements but the declaration oh:save-output specifies the result to be the identity. So when you mention "nothing is connected to the primary output port" the thought comes why in this case should there be something connected? The intention is to save a copy and then move on with a copy of what was saved to be used as input to the next step. Did I do this incorrectly or could it be improved?

<p:declare-step name="saveDocument" type="oh:save-output">
    <p:input port="source" primary="true"/>
    <p:output port="result">
      <p:pipe port="result" step="ident"/>
    </p:output>
    <p:option name="step-name" required="true"/>
    <p:option name="save" select="'false'"/>
    <p:option name="href" required="true"/>
    <p:identity name="ident"/>

    <p:choose>
      <p:when test="$save = 'true'">
        <p:store>

          <p:with-option name="href" select="$href">
            <p:pipe port="result" step="ident"/>
          </p:with-option>
        </p:store>
      </p:when>
      <p:otherwise>
        <p:sink/>
      </p:otherwise>
    </p:choose>
  </p:declare-step>

Thanks
On Thu, Mar 17, 2011 at 3:11 PM, <vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>> wrote:
A Calabash bug; no doubt about it now. You should get the error with or without the p:group wrapper as nothing is connected to the primary output port of SAVEME. If this is intentional and you really don't care about the result of SAVEME, simply add p:sink right after it:

<oh:save-output name="SAVEME" step-name="saveidentifyDifferentOldNewOfficeCodes">
  <p:with-option name="save" select="'true'"/>
  <p:with-option name="href" select="$hrefIdentifyDifferentOldNewOfficeCodes"/>
</oh:save-output>
<p:sink/>

Thank should fix it.


Vojtech


--

Vojtech Toman

Consultant Software Engineer

EMC | Information Intelligence Group

vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>

http://developer.emc.com/xmltech



From: Alex Muir [mailto:alex.g.muir@gmail.com]<mailto:[mailto:alex.g.muir@gmail.com]>
Sent: Thursday, March 17, 2011 3:56 PM
To: Toman, Vojtech
Cc: xproc-dev@w3.org<mailto:xproc-dev@w3.org>
Subject: Re: Adding p:group gets rid of ERR : Unbound primary output.. why?

Good call Vojtech,, I added a name to the save-output step and the error message is related to that step. I hadn't noticed that I was thinking the step-name was the name I suppose.

E [Calabash XProc] ERR : Unbound primary output: [output result on SAVEME]

   <oh:save-output name="SAVEME" step-name="saveidentifyDifferentOldNewOfficeCodes">
      <p:with-option name="save" select="'true'"/>
      <p:with-option name="href" select="$hrefIdentifyDifferentOldNewOfficeCodes"/>
    </oh:save-output>


Here is the code.
---------
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:oh="http://oami.europa.eu" version="1.0">

  <p:input port="source">
    <p:inline>
      <xml/>
    </p:inline>
  </p:input>

  <p:output port="result"/>

  <p:declare-step name="saveDocument" type="oh:save-output">
    <p:input port="source" primary="true"/>
    <p:output port="result">
      <p:pipe port="result" step="ident"/>
    </p:output>
    <p:option name="step-name" required="true"/>
    <p:option name="save" select="'false'"/>
    <p:option name="href" required="true"/>
    <p:identity name="ident"/>

    <p:choose>
      <p:when test="$save = 'true'">
        <p:store>
          <p:with-option name="href" select="$href">
            <p:pipe port="result" step="ident"/>
          </p:with-option>
        </p:store>
      </p:when>
      <p:otherwise>
        <p:sink/>
      </p:otherwise>
    </p:choose>
  </p:declare-step>


  <p:variable name="debugOutput" select="true()"/>
  <p:variable name="regexOffices" select="'^(Portugal):'"/>
  <p:variable name="regexSelectSchemaTypes" select="'\{\{Schema\s+(E(lement|numeration)|Type|Attribute)'"/>
  <p:variable name="regexOfficeCodeList" select="'(PT)$'"/>
  <p:variable name="OfficeCodeList" select="'PT'" oh:doc="the office code list one wants to make a schema for"/>
  <p:variable name="OfficeCodeArgSeperator" select="','"/>
  <p:variable name="category" select="'D7'"/>


  <p:variable name="hrefdebugOutputFolder" select="'../debug/'"/>
  <p:variable name="hrefWikiDumpInput" select="'../in/p13-wikidump.xml'"/>
  <p:variable name="hrefFullRDF" select="'../in/p13.rdf'"/>
  <p:variable name="hrefRDF" select="'../in/p13_slim.rdf'"/>
  <p:variable name="hrefSchemaOutput" select="'../out/TM-XML-V1-4.xsd'"/>
  <p:variable name="hrefOfficeSpecificWikiDump" select="'../out/officeSpecificOutput.xml'"/>
  <p:variable name="hrefOfficeSpecificWikiDumpCategoryAppended" select="'../out/officeSpecificWikiDumpCategoryAppended.xml'"/>

  <p:variable name="hrefIdentifyDifferentOldNewOfficeCodes" select="'../out/DifferentOldNewOfficeCodes.xml'"/>

  <p:group name="SlimRDF">
    <p:load>
      <p:with-option name="href" select="$hrefFullRDF"/>
    </p:load>

    <p:xslt name="slim_RDF" version="1.0" oh:doc="run the stylesheet that slims the full RDF to be an office specific RDF">
      <p:input port="stylesheet">
        <p:document href="../xslt/slim_RDF.xsl"/>
      </p:input>
      <p:with-param name="regexOffices" select="$regexOffices"/>
      <p:with-param name="regexOfficeCodeList" select="$regexOfficeCodeList"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output step-name="saveSlim_RDF">
      <p:with-option name="save" select="'true'"/>
      <p:with-option name="href" select="$hrefRDF"/>
    </oh:save-output>

    <p:sink/>
  </p:group>

  <p:group name="GenerateOfficeSpecificWIkiDump">

    <p:load>
      <p:with-option name="href" select="$hrefWikiDumpInput"/>
    </p:load>

    <oh:save-output step-name="debugOutputBeforeStripPagesNotInRDF">
      <p:with-option name="save" select="$debugOutput"/>
      <p:with-option name="href" select="concat($hrefdebugOutputFolder,'debugOutputBeforeStripPagesNotInRDF.xml')"/>
    </oh:save-output>

    <p:xslt name="removePagesWithoutReferencedComponent" version="1.0">
      <p:input port="stylesheet">
        <p:document href="../xslt/removePagesWithoutReferencedComponentKeyed.xsl"/>
      </p:input>
      <p:with-param name="hrefRDF" select="$hrefRDF"/>
      <p:with-param name="regexOfficeCodeList" select="$regexOfficeCodeList"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output step-name="debugOutputBeforeGenerateOfficeCode">
      <p:with-option name="save" select="$debugOutput"/>
      <p:with-option name="href" select="concat($hrefdebugOutputFolder,'debugOutputBeforeGenerateOfficeCode.xml')"/>
    </oh:save-output>

    <p:xslt name="GenerateOfficeCode" version="1.0" oh:doc="run xslt to append the office code list">
      <p:input port="stylesheet">
        <p:document href="../xslt/GenerateOfficeCodeKeyed.xsl"/>
      </p:input>
      <p:with-param name="hrefRDF" select="$hrefRDF"/>
      <p:with-param name="regexSelectSchemaTypes" select="'\{\{Schema\s+(E(lement|numeration)|Type|Attribute)'"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output step-name="saveOfficeSpecificWikiDump">
      <p:with-option name="save" select="'true'"/>
      <p:with-option name="href" select="$hrefOfficeSpecificWikiDump"/>
    </oh:save-output>
  </p:group>

 <!-- <p:group name="CreateOfficeSpecificWikiDumpCategoryAppended">-->
    <p:identity name="PutCopyOfficeSpecificWikiDump"/>

    <p:xslt name="identifyDifferentOldNewOfficeCodes" version="1.0" oh:doc="Creates a list of pages that have different old and new office codes">
      <p:input port="stylesheet">
        <p:document href="../xslt/identifyDifferentOldNewOfficeCodes.xsl"/>
      </p:input>
      <p:with-param name="hrefRDF" select="$hrefRDF"/>
      <p:with-param name="regexSelectSchemaTypes" select="'\{\{Schema\s+(E(lement|numeration)|Type|Attribute)'"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output name="SAVEME" step-name="saveidentifyDifferentOldNewOfficeCodes">
      <p:with-option name="save" select="'true'"/>
      <p:with-option name="href" select="$hrefIdentifyDifferentOldNewOfficeCodes"/>
    </oh:save-output>

    <p:identity name="GetCopyOfficeSpecificWikiDump">
      <p:input port="source">
        <p:pipe port="result" step="PutCopyOfficeSpecificWikiDump"/>
      </p:input>
    </p:identity>


    <p:xslt name="AppendCategory" version="1.0" oh:doc="Appends the category to things that have changed">
      <p:input port="stylesheet">
        <p:document href="../xslt/AppendCategory.xsl"/>
      </p:input>
      <p:with-param name="hrefDiff" select="$hrefIdentifyDifferentOldNewOfficeCodes"/>
      <p:with-param name="regexSelectSchemaTypes" select="'\{\{Schema\s+(E(lement|numeration)|Type|Attribute)'"/>
      <p:with-param name="category" select="$category"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output step-name="saveOfficeSpecificWikiDumpCategoryAppended">
      <p:with-option name="save" select="'true'"/>
      <p:with-option name="href" select="$hrefOfficeSpecificWikiDumpCategoryAppended"/>
    </oh:save-output>

    <p:identity name="GetSecondCopyOfficeSpecificWikiDump">
      <p:input port="source">
        <p:pipe port="result" step="PutCopyOfficeSpecificWikiDump"/>
      </p:input>
    </p:identity>

<!--  </p:group>-->

  <p:group name="convertToSchemaWiki">

    <oh:save-output step-name="debugOutputBeforeWikiMediaDumpToSchema">
      <p:with-option name="save" select="$debugOutput"/>
      <p:with-option name="href" select="concat($hrefdebugOutputFolder,'debugOutputBeforeWikiMediaDumpToSchema.xml')"/>
    </oh:save-output>

    <p:xslt name="WikiMediaDumpToSchema" version="1.0" oh:doc="run the stylesheet that extracts the schema widgets from the wikimedia dump">
      <p:input port="stylesheet">
        <p:document href="../xslt/WikiMediaDumpToSchema.xsl"/>
      </p:input>
      <p:with-param name="OfficeCodeList" select="$OfficeCodeList"/>
      <p:with-param name="OfficeCodeArgSeperator" select="$OfficeCodeArgSeperator"/>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xslt>

    <oh:save-output step-name="debugOutputBeforeUnescape-markup">
      <p:with-option name="save" select="$debugOutput"/>
      <p:with-option name="href" select="concat($hrefdebugOutputFolder,'debugOutputBeforeUnescape-markup.xml')"/>
    </oh:save-output>

    <p:viewport match="//document" oh:doc="Convert the unescaped markup to xml">
      <p:unescape-markup>
        <p:with-option name="content-type" select="'application/xml'"/>
      </p:unescape-markup>
    </p:viewport>

    <p:unwrap match="/document" oh:doc="remove the surrounding element document"/>
  </p:group>

  <oh:save-output step-name="output">
    <p:with-option name="save" select="'true'"/>
    <p:with-option name="href" select="$hrefSchemaOutput"/>
  </oh:save-output>

  <p:identity/>
</p:declare-step>


---------
On Thu, Mar 17, 2011 at 2:23 PM, <vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>> wrote:
I assume that "!1.29" is the oh:save-output step as the other steps in the sub-pipeline have explicit names. I don't know what the declaration of oh:save-output looks like, but if the step has a primary output port, then this output port is unconnected (no steps inside p:group are connected to it, and no steps outside of the p:group can connect it as it is out of scope). If you look at the connections between the steps in the subpipeline, there are actually two branches:

- PutCopyCitySpecificWikiDump -> identifyDifferentOldNewOfficeCodes -> oh:save-output
- PutCopyCitySpecificWikiDump -> GetCopyCitySpecificWikiDump

My guess is that Calabash gets it wrong and somehow thinks that oh:save-output is the last step of the subpipeline, in which case it creates an implicit output port to p:group and connects it to the primary output port of oh:save-output. That would explain why you don't get the error with p:group, but I think that is a bug in Calabash.

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com<mailto:vojtech.toman@emc.com>
http://developer.emc.com/xmltech



--
Alex
-----
Currently:
Freelance Software Engineer 6+ yrs exp

Previously:
https://sites.google.com/a/utg.edu.gm/alex/


A Bafila, is two rivers flowing together as one:
http://www.facebook.com/pages/Bafila/125611807494851




--
Alex
-----
Currently:
Freelance Software Engineer 6+ yrs exp

Previously:
https://sites.google.com/a/utg.edu.gm/alex/


A Bafila, is two rivers flowing together as one:
http://www.facebook.com/pages/Bafila/125611807494851
Received on Thursday, 17 March 2011 15:56:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 17 March 2011 15:56:19 GMT