<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:12px">Hi Jose,</span><div style="font-family:arial,sans-serif;font-size:12px"><br></div><div style="font-family:arial,sans-serif;font-size:12px">The problem you ran into is described in chapter 14 of the new Ptolemy book, page 517, available for download here:</div>
<div style="font-family:arial,sans-serif;font-size:12px"><a href="http://ptolemy.eecs.berkeley.edu/books/Systems/chapters/TheTypeSystem.pdf" target="_blank">http://ptolemy.eecs.berkeley.edu/books/Systems/chapters/TheTypeSystem.pdf</a><br>
</div><div style="font-family:arial,sans-serif;font-size:12px"><br></div><div style="font-family:arial,sans-serif;font-size:12px">In summary, due to the nature of the JSONToToken actor (it takes an arbitrary string, interprets it as JSON, and then creates a record token out of it), the type system has no means infer the shape of record that JSONToToken outputs. To fix this, you can either declare a type manually, or enable backward type inference (right-click on the canvas of the composite actor ->Customize->Configure, then check the box in front of the parameter enableBackwardTypeInference). The latter solution lets the type of the port JSONToToken.output be inferred by means of downstream type constraints, resulting in a type that reflects the requirements of downstream actors that operate on the token. In the given example, JSONToToken.output will resolve to type general, as the downstream Display actor accepts any token.</div>
<div style="font-family:arial,sans-serif;font-size:12px"><br></div><div style="font-family:arial,sans-serif;font-size:12px">Best,</div><div style="font-family:arial,sans-serif;font-size:12px"><br></div><div style="font-family:arial,sans-serif;font-size:12px">
Marten</div><div class="gmail_extra"><br clear="all"><div><br>--<br>Marten Lohstroh, Msc. | Associate Specialist<br>University of California | 545Q Cory Hall<br>Berkeley, CA 94720 | +1 510 282 9135</div>
<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>-------- Original Message --------
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap valign="BASELINE">Subject:
</th>
<td>[kepler-users] TokenToJSON followed by JSONToToken
results in error</td>
</tr>
<tr>
<th align="RIGHT" nowrap valign="BASELINE">Date: </th>
<td>Thu, 17 Oct 2013 15:43:05 -0400</td>
</tr>
<tr>
<th align="RIGHT" nowrap valign="BASELINE">From: </th>
<td>Jose Borreguero <a href="mailto:borreguero@gmail.com" target="_blank"><borreguero@gmail.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap valign="BASELINE">To: </th>
<td>kepler-users <a href="mailto:kepler-users@kepler-project.org" target="_blank"><kepler-users@kepler-project.org></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<div dir="ltr">
<div style="color:rgb(0,0,153)">Dear
Kepler users,<br>
<br>
</div>
<div style="color:rgb(0,0,153)">I am
having trouble with the conversion from JSON to Token. As a
test,<br>
</div>
<div style="color:rgb(0,0,153)">I created
a very simple workflow that results in error:<br>
<br>
</div>
<div style="color:rgb(0,0,153)">1- I
packed an integer and a string with Actor "Record Assembler"
into a record<br>
</div>
<div style="color:rgb(0,0,153)">2- I apply
Actor "TokenToJSON" to output of "Record Assembler"<br>
</div>
<div style="color:rgb(0,0,153)">3- I apply
Actor "JSONToToken" to output of "TokenToJSON"<br>
</div>
<div style="color:rgb(0,0,153)">4- I apply
Actor "Display" to output of "TokenToJSON"<br>
<br>
</div>
<div style="color:rgb(0,0,153)">This is
the error stack Trace:<br>
<span style="color:rgb(0,0,0)">ptolemy.actor.TypeConflictException:
Types resolved to unacceptable types in .Unnamed3 due to the
following objects:<br>
(port .Unnamed3.JSONToToken.output: unknown)<br>
at
ptolemy.actor.TypedCompositeActor.resolveTypes(TypedCompositeActor.java:406)<br>
at ptolemy.actor.Manager.resolveTypes(Manager.java:1140)<br>
at
ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:976)<br>
at ptolemy.actor.Manager.initialize(Manager.java:659)<br>
at ptolemy.actor.Manager.execute(Manager.java:340)<br>
at ptolemy.actor.Manager.run(Manager.java:1191)<br>
at
ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1734)</span><br>
<br>
</div>
<div style="color:rgb(0,0,153)">Any help
or hints to debug this, please?<br>
<br>
</div>
<div style="color:rgb(0,0,153)">Best
regards,<br>
</div>
<div style="color:rgb(0,0,153)">-Jose
Borreguero<br>
</div>
<div style="color:rgb(0,0,153)">
<br>
</div>
<div style="color:rgb(0,0,153)"><br>
<br>
</div>
</div>
<br>
</div>
<br>
</div>
</blockquote></div><br></div></div>