<div dir="ltr"><div><div><div><div><div>Hi Rich,<br></div>The devel version of Ptolemy II has support for a JSON token, see<br><a href="http://sisyphus.eecs.berkeley.edu:8079/hudson/job/ptII/javadoc/ptolemy/actor/lib/conversions/json/JSONToToken.html">http://sisyphus.eecs.berkeley.edu:8079/hudson/job/ptII/javadoc/ptolemy/actor/lib/conversions/json/JSONToToken.html</a><br>
<br></div>The code is in $PTII/ptolemy/actor/lib/conversions/json<br><br>To get this to work, we had to do quite a bit with type propagation.  Marten Lohstroh implemented backward type propagation, which is useful with JSON because the types are not always well defined.<br>
<br></div>To my knowledge, there is no support for YAML.<br><br></div>Ptolemy II does support RecordTokens which are structured.<br><br></div><div>There is a an attribute for use with files, see ptolemy/kernel/attributes/FileAttribute.java<br>
</div><div><br>Java-style Serialization is not supported.  This could be done, but would require quite a bit of work.<br><br></div><div>_Christopher<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Mar 12, 2014 at 2:48 PM, Rich Morin <span dir="ltr"><<a href="mailto:rdm@cfcl.com" target="_blank">rdm@cfcl.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Section 3.2.6 of the User Manual (Data Types) details the kinds of data<br>
that can be put into a token.  Unfortunately, I don't see anything that<br>
talks about semi-structured data in general, let alone specific ways of<br>
serializing it (eg, JSON, YAML).<br>
<br>
YAML is my preferred format for passing data between processes.  Each<br>
message (ie, file, token) is a tree of polymorphic hashes (ie, maps,<br>
dictionaries) and lists, with scalars as the leaf nodes.  Web-based<br>
applications (eg, composable web services) might use JSON encoding,<br>
but the data structures would be the same.<br>
<br>
I'm sure that I could make this work in Kepler, if only by putting the<br>
file path into a String token.  However, I wonder if I'm missing some<br>
sort of Best Practice.  Help?<br>
<br>
-r<br>
<br>
 --<br>
<a href="http://www.cfcl.com/rdm" target="_blank">http://www.cfcl.com/rdm</a>           Rich Morin           <a href="mailto:rdm@cfcl.com">rdm@cfcl.com</a><br>
<a href="http://www.cfcl.com/rdm/resume" target="_blank">http://www.cfcl.com/rdm/resume</a>    San Bruno, CA, USA   +1 650-873-7841<br>
<br>
Software system design, development, and documentation<br>
<br>
<br>
_______________________________________________<br>
Kepler-users mailing list<br>
<a href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a><br>
<a href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users" target="_blank">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a><br>
</blockquote></div><br></div>