<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 28, 2013 at 1:03 PM, Christos Vasilakis <span dir="ltr">&lt;<a href="mailto:cvasilak@gmail.com" target="_blank">cvasilak@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">Hi team,<div><br></div><div>
on the last couple of days I have been playing with the idea on how  to support nested path in resources (a.k.a subresources). I am more keen in the idea to treat the nested resources as full-time citizens. That is, treat the nested resource as a Pipe.</div>
</div></blockquote><div><br></div><div><br></div><div style>I agree w/ Luke - interesting proposal</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>I came up with the following proposal (showing here in iOS)</div><div><br></div><div>For demonstration I use an imaginative Soccer API</div><div><br></div><div>e.g.</div>
<div><a href="http://soccer.org/leagues/" target="_blank">soccer.org/leagues/</a>{id}/teams/{id}/players</div><div><br></div><div>when expanded with sample {ids}:</div><div><a href="http://soccer.org/leagues/seattle/teams/trebuchet/players" target="_blank">soccer.org/leagues/seattle/teams/trebuchet/players</a></div>
<div><br></div><div>During registration of the &quot;parent pipe&quot; (leagues) we specify the nested resources for this Pipe using  the &quot;setNestedPipes&quot;  config option. Internally the Pipeline during the setup of this pipe creates the corresponding nested pipes, initialising their URL accordingly.</div>
<div><br></div><div>e.g.</div><div>-----</div><div>AGPipeline* pipeline = [AGPipeline pipelineWithBaseURL:BASE_SOCCER_APP_URL];</div><div><div><br></div><div>id&lt;AGPipe&gt; leagues = [pipeline pipe:^(id&lt;AGPipeConfig&gt; config) {</div>
<div>    [config setName:@&quot;leagues&quot;];</div><div><br></div><div>    [config setNestedPipes:[@&quot;teams&quot;, @&quot;players&quot;];  // an array of nested resources for this pipe</div></div></div></blockquote>
<div><br></div><div><br></div><div style>I would read the nested pipes here as:</div><div>* <a href="http://soccer.org/leagues/" target="_blank">soccer.org/leagues/</a>{id}/teams<br></div><div>* <a href="http://soccer.org/leagues/" target="_blank">soccer.org/leagues/</a>{id}/players<br>
</div><div><br></div><div style>which does not match the above URL samples, you gave;</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div>}];</div></div><div>-----</div><div><br></div><div>A new &quot;pipe&quot; method is added in the pipeline with params the Parent ID&#39;s of this nested resource. Once returned you have a fill Pipe to invoke operations on.</div>
<div><br></div><div>-----</div><div><a href="http://soccer.org/leagues/seattle/teams/trebuchet" target="_blank">soccer.org/leagues/seattle/teams/trebuchet</a> - &gt; </div><div><span style="white-space:pre-wrap">        </span>[[pipeline pipe:@&quot;teams&quot; pathParams:@[@&quot;seattle&quot;]] <b>read:@</b>&quot;trebuchet&quot;] ...</div>
</div></blockquote><div><br></div><div><br></div><div style>Hrm..... I am confused...</div><div style>What is the name of the first argument? Also the path params, not sure about them...</div><div style><br></div><div style>
I think this proposal differs from how we currently read a specific entry:<br></div><div style>(<a href="http://soccer.org/leagues/seattle">soccer.org/leagues/seattle</a>)</div><div style><br></div><div style><br></div><div style>
<pre class="" style="padding:8.5px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:10px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902)">
<code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px">[leaguesPipe read:@&quot;seattle&quot; success:callback failure:othercallback];</code></pre>
</div><div style><br></div><div style>So i guess ... the above would return details about the &quot;Seattle League&quot;, right? </div><div style><br></div><div style>Now... I think... If I wanted a &quot;sub&quot;/&quot;nested&quot; pipe, from that leagues pipe (e.g. to work with teams in the &quot;Seattle Leaguue&quot; ... I think there are two ways...</div>
<div style><br></div><div style>a) use the Pipeline as it&#39;s factory (I guess that&#39;s what you proposed)</div><div style>b) use the actual pipe to create a nested pipe, by leveraging the available information</div><div style>
<br></div><div style><br></div><div style>Here is, I think, how the b) could look for this URL:</div><div style><br></div><div><pre class="" style="padding:8.5px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:10px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902)">
<code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px"><br class="">
id&lt;AGPipe&gt; allTeamsInSeattlePipe = [leaguesPipe subPipe:@&quot;teams&quot; for:@&quot;seattle&quot;];</code></pre></div><div><br></div><div style>Now we have a subPipe that has this (inherited) URL: -&gt; <a href="http://soccer.org/leagues/seattle/teams">soccer.org/leagues/seattle/teams</a></div>
<div><br></div><div><br></div><div style>And, if I want to issue a a read against &quot;<a href="http://soccer.org/leagues/seattle/teams/trebuchet">soccer.org/leagues/seattle/teams/trebuchet</a>&quot; would look like:</div>
<div style><br></div><div style><div><pre class="" style="padding:8.5px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:10px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902)">
<code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px">[<span style="background-color:transparent;color:inherit">allTeamsInSeattlePipe </span></code><span style="background-color:transparent;color:inherit;font-size:12px"> read:@&quot;trebuchet&quot; success:callback failure:othercallback];</span></pre>
</div><div><code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px"><br>
</code></div></div><div><br></div><div style>Now, imagine the API could also return the owners of a certain lagues - the &quot;sub pipe creation&quot; could be done like:</div><div style><br></div><div style><div>Here is, I think, how the b) could look for this URL:</div>
<div><br></div><div><pre class="" style="padding:8.5px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:10px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902)">
<code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px">id&lt;AGPipe&gt; allOwnersInNewYorkPipe = [leaguesPipe subPipe:@&quot;owners&quot; for:@&quot;newyork&quot;];</code></pre>
</div><div><br></div><div style>Reading details about Mr. Brown (some owner in the list, that has the ID 19) would be like:</div><div><br></div><div><pre class="" style="padding:8.5px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:10px;color:rgb(51,51,51);border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;margin-top:0px;margin-bottom:9px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;background-color:rgb(245,245,245);border:1px solid rgba(0,0,0,0.14902)">
<code class="" style="padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;color:inherit;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px">[<span style="background-color:transparent;color:inherit">allOwnersInNewYorkPipe</span></code><code class="" style="color:inherit;padding:0px;font-family:Menlo,Monaco,Consolas,&#39;Courier New&#39;,monospace;font-size:12px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;border:0px"><span style="background-color:transparent;color:inherit"> </span></code><span style="color:inherit;background-color:transparent;font-size:12px"> read:@&quot;19&quot; success:callback failure:othercallback];</span></pre>
</div></div><div style>So... this would match a read to: &quot;<a href="http://soccer.org/leagues/newyork/owners/19">soccer.org/leagues/newyork/owners/19</a>&quot;</div><div><br></div><div><br></div><div style><br></div><div style>
<br></div><div style>Does that make sense ? Any thoughts ?</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div><a href="http://soccer.org/leagues/seattle/teams/trebuchet/players/foo" target="_blank">soccer.org/leagues/seattle/teams/trebuchet/players/foo</a> - &gt;</div><div><span style="white-space:pre-wrap">        </span> [[pipeline pipe:@&quot;players&quot; pathParams:@[@&quot;seattle&quot;, @&quot;trebuchet&quot;]] <b>read</b>:@&quot;foo&quot;] ..</div>
<div>-----</div><div><br></div><div><br></div><div>Wdyt?</div><div><br></div><div>Thanks</div><span class=""><font color="#888888"><div>Christos</div></font></span><div><div class="h5"><div><br></div><div>On Mar 18, 2013, at 1:12 PM, Sebastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt; wrote:</div>
<div><div><br><blockquote type="cite">Well, that would not be possible, for that you will have to create a &quot;child&quot; pipe. But I agree, that is maybe no optimal ...<div><br><br><div class="gmail_quote">On Fri, Mar 15, 2013 at 6:44 PM, Summers Pittman <span dir="ltr">&lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div>
    <div>On 03/15/2013 01:34 PM, Sebastien Blanc
      wrote:<br>
    </div>
    <blockquote type="cite">I like the idea but I will more see that has a
      method/function for the pipelineManager (and will be easier to
      implement in JS, I think) :
      <div><br>
      </div>
      <div>var myParentPipe =
        Aerogear.Pipeline({name:&quot;parentPipe&quot;}).pipes.parentPipe</div>
      <div><br>
      </div>
      <div>var myChildPipe = Aerogear.Pipeline.fromParent(myParentPipe,
        {options} )</div>
    </blockquote></div>
    What would it look like to get a child record from a parent?<div><div><br>
    <blockquote type="cite">
      <div> <br>
        <br>
        <div class="gmail_quote">On Fri, Mar 15, 2013 at 5:37 PM,
          Douglas Campos <span dir="ltr">&lt;<a href="mailto:qmx@qmx.me" target="_blank">qmx@qmx.me</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">What about
            this?<br>
            <br>
            Pipeline&lt;Post&gt; postPipeline = …<br>
            Post post = // get from the pipeline<br>
            Pipeline&lt;Comment&gt;
            postPipeline.childPipelineForOrOtherWeirdName(Comment.class,
            post)<br>
            <div>
              <div><br>
                <br>
                On 15/03/2013, at 12:26, Summers Pittman &lt;<a href="mailto:supittma@redhat.com" target="_blank">supittma@redhat.com</a>&gt;
                wrote:<br>
                <br>
                &gt; On 03/14/2013 04:48 AM, Matthias Wessendorf wrote:<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; On Thu, Mar 14, 2013 at 9:32 AM, Sebastien
                Blanc &lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;
                wrote:<br>
                &gt;&gt; Hi,<br>
                &gt;&gt; While I was playing with scaffolding and tried
                to build a simple Blog Application with Aerogear I faced
                the current situation :<br>
                &gt;&gt; I have a Post object which contains many
                Comment objects. Now I want to call my Post pipe to
                retrieve the related  comments, I have currently 2
                options :<br>
                &gt;&gt;<br>
                &gt;&gt; /posts/1 -&gt; assuming comments will be
                implicitly retrieved (eager loading)<br>
                &gt;&gt; /comments/?postid=1<br>
                &gt;&gt;<br>
                &gt;&gt; But regarding our model the correct form should
                be :<br>
                &gt;&gt;<br>
                &gt;&gt; /posts/1/comments<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; +1<br>
                &gt;&gt; that is the ideal way to model URIs for
                &quot;nested&quot; resources.<br>
                &gt;&gt;<br>
                &gt;&gt; See [1], extracted from [2]<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; But, AFAIK,  with the current API, it is not
                possible to define this last pattern  (at least for JS
                and iOs, confirmed by Matzew). When doing a read we can
                pass an id option but as mentioned in the doc, this id
                will always be append to the endpoint.<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; Well, it is possible - but in a very (IMO) ugly
                way:<br>
                &gt;&gt;<br>
                &gt;&gt; <a href="https://gist.github.com/matzew/6ab432e437b9a017a21d" target="_blank">https://gist.github.com/matzew/6ab432e437b9a017a21d</a><br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; IMO, we should be able to support this pattern
                but for now I&#39;m not really sure how to specify this in
                our API, so if you have any ideas feedback this thread
                has been made for you !<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; Suggestion: Enhance the read function -
                example:<br>
                &gt;&gt;<br>
                &gt;&gt; <a href="https://gist.github.com/matzew/04f069dfbed2cc77a8b4" target="_blank">https://gist.github.com/matzew/04f069dfbed2cc77a8b4</a><br>
                &gt; I&#39;m thinking of the inverse myself.  Add a
                &quot;ParentPath&quot; property which can be used to extract
                information from parent objects.<br>
                &gt;<br>
                &gt; <a href="https://gist.github.com/secondsun/17ce96082eda37dbd10e" target="_blank">https://gist.github.com/secondsun/17ce96082eda37dbd10e</a><br>
                &gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; -Matthias<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; [1] <a href="http://www.infoq.com/resource/articles/rest-introduction/en/resources/figure2.jpg" target="_blank">http://www.infoq.com/resource/articles/rest-introduction/en/resources/figure2.jpg</a><br>


                &gt;&gt; [2] <a href="http://www.infoq.com/articles/rest-introduction" target="_blank">http://www.infoq.com/articles/rest-introduction</a><br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; Seb<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; _______________________________________________<br>
                &gt;&gt; aerogear-dev mailing list<br>
                &gt;&gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
                &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;<br>
                &gt;&gt; --<br>
                &gt;&gt; Matthias Wessendorf<br>
                &gt;&gt;<br>
                &gt;&gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
                &gt;&gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
                &gt;&gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
                &gt;&gt;<br>
                &gt;&gt; _______________________________________________<br>
                &gt;&gt; aerogear-dev mailing list<br>
                &gt;&gt;<br>
                &gt;&gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
                &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                &gt;<br>
                &gt; _______________________________________________<br>
                &gt; aerogear-dev mailing list<br>
                &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
                &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
                <br>
              </div>
            </div>
            -- qmx<br>
            <div>
              <div><br>
                <br>
                _______________________________________________<br>
                aerogear-dev mailing list<br>
                <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
                <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
aerogear-dev mailing list
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></blockquote>
</div><br></div></div></div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>