[kepler-users] TokenToJSON followed by JSONToToken results in error
Marten Lohstroh
marten at eecs.berkeley.edu
Thu Oct 17 19:23:08 PDT 2013
Hi Jose,
The problem you ran into is described in chapter 14 of the new Ptolemy
book, page 517, available for download here:
http://ptolemy.eecs.berkeley.edu/books/Systems/chapters/TheTypeSystem.pdf
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.
Best,
Marten
--
Marten Lohstroh, Msc. | Associate Specialist
University of California | 545Q Cory Hall
Berkeley, CA 94720 | +1 510 282 9135
-------- Original Message -------- Subject: [kepler-users] TokenToJSON
> followed by JSONToToken results in error Date: Thu, 17 Oct 2013 15:43:05
> -0400 From: Jose Borreguero <borreguero at gmail.com> <borreguero at gmail.com> To:
> kepler-users <kepler-users at kepler-project.org><kepler-users at kepler-project.org>
>
> Dear Kepler users,
>
> I am having trouble with the conversion from JSON to Token. As a test,
> I created a very simple workflow that results in error:
>
> 1- I packed an integer and a string with Actor "Record Assembler" into a
> record
> 2- I apply Actor "TokenToJSON" to output of "Record Assembler"
> 3- I apply Actor "JSONToToken" to output of "TokenToJSON"
> 4- I apply Actor "Display" to output of "TokenToJSON"
>
> This is the error stack Trace:
> ptolemy.actor.TypeConflictException: Types resolved to unacceptable types
> in .Unnamed3 due to the following objects:
> (port .Unnamed3.JSONToToken.output: unknown)
> at
> ptolemy.actor.TypedCompositeActor.resolveTypes(TypedCompositeActor.java:406)
> at ptolemy.actor.Manager.resolveTypes(Manager.java:1140)
> at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:976)
> at ptolemy.actor.Manager.initialize(Manager.java:659)
> at ptolemy.actor.Manager.execute(Manager.java:340)
> at ptolemy.actor.Manager.run(Manager.java:1191)
> at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1734)
>
> Any help or hints to debug this, please?
>
> Best regards,
> -Jose Borreguero
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20131017/45e7d832/attachment.html>
More information about the Kepler-users
mailing list