Actually I think it's better for most people to "think spreadsheet",
which has me leaning towards treating an empty string as missing.  Note
that exhibit already treat missing values as empty strings when
necessary, so it's only relatively sophisticated programmers who are
likely to design pages that rely on the difference between an empty
string and a missing value.  That's not the important group to support,
since they are best equipped to deal with the problem.

On 12/3/2015 5:17 PM, Jay Gray wrote:
> TY for your analysis, David. This is definitely not a Severity 1 or 2
> issue. If I do not have an image, I won't use the field. When I get an
> image I'll use the field and its value. I need to think about this,
> but it may be better programming practice to avoid using fields with
> null values (i.e. ""). As you observe, a spreadsheet must have a
> column for a variable (with a blank cell if there is no value); but
> JSON does not. May be better to "think JSON" rather than "think
> spreadsheet."
>
> /jay
>
> On Thursday, December 3, 2015 at 4:05:47 PM UTC-6, David Karger wrote:
>
>     (obviously, this inconsistent behavior is not ideal, so we will
>     think about how to fix it)
>
>     On 12/3/2015 5:03 PM, David Karger wrote:
>>     I've taken a closer look and I don't think this has anything to
>>     do with exhibit 2 vs. 3.
>>     Your "exhibit 2" example (which is actually running exhibit 3)
>>     gets its data from a google spreadsheet.  your "exhibit 3"
>>     example uses a data.json file
>>     In a google spreadsheet, a blank cell is treated as a missing
>>     value.  So, some of your items have *no* image attribute (so
>>     if-exists work as you expect)
>>     In a json file, setting a property="" does make that property
>>     exist, with an empty string value.  So if-exists=that property
>>     reacts as if that property exists.
>>
>>     On 12/3/2015 4:26 PM, David Karger wrote:
>>>     so one thing to point out right away.  you claim your first
>>>     example uses exhibit 2, but it's actually using exhibit 2
>>>     *syntax* in (an early release of) exhibit 3: note your script
>>>     link is
>>>
>>>     <script
>>>     src="http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js
>>>     
>>> <http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js>"></script
>>>     &g t; it would be helpful to know if you continue to have the
>>>     same experience using the latest (HEAD) exhibit with the exhibit
>>>     2 syntax, or whether it is a problem that goes away in
>>>     HEAD---that could help us track down the inconsistency. Note
>>>     there is some mystery about what the *right* behavior is for
>>>     image: "".  This is an example of a "falsy" value in
>>>     programming.  Some programming languages like to treat the empty
>>>     string as null/false, while others recognize that the empty
>>>     string that just happens to be empty but should not be treated
>>>     as null/false.  In your case you want to treat "" as null, but
>>>     there may be other cases where it's important to know that the
>>>     string exists and is empty.  We'll need to think about this (at
>>>     the same time as we're tracking down the inconsistent handling
>>>     of exhibit 2 syntax).
>>>     On 12/3/2015 5:13 AM, Jay Gray wrote:
>>>>     Here's an update David. ========= Exhibit 2 ========= Exhibit 2
>>>>     catalog
>>>>     
>>>> <http://ontomatica.com/public_new/project/test/Exhibit_implementations/Exhibit_images_seeds/_index_1_exhibit_2_.html>
>>>>     Here is the Exhibit code:     <td style="position:
>>>>     relative"><div class="itemThumbnail-blocker"></div>        
>>>>     <div ex:if-exists=".image">             <img
>>>>     ex:src-content=".image" />         </div>         <div
>>>>     ex:display-style-subcontent="{{ if(not(exists(.image)),
>>>>     'block', 'none') }}">             <img
>>>>     src="NoImageAvailable.png" />         </div>     </td> Comment:
>>>>     Works as expected. =================== Exhibit 3 version 1
>>>>     =================== Exhibit 3 Catalog - version 1
>>>>     
>>>> <http://ontomatica.com/public_new/project/test/Exhibit_implementations/Exhibit_images_seeds/_index_4_.html>
>>>>     Here is the Exhibit code:     <td style="position: relative">
>>>>             <div class="itemThumbnail-blocker"></div>         <div
>>>>     data-ex-if-exists=".image">             <img
>>>>     data-ex-src-content=".image" />         </div>         <div
>>>>     data-ex-display-style-subcontent="{{ if(not(exists(.image)),
>>>>     'block', 'none') }}">             <img
>>>>     src="NoImageAvailable.png" />         </div>     </td> Comment:
>>>>         In the JSON file when the key:value pair is -        
>>>>     "image":"",     Exhibit does not display NoImageAvailable.png.
>>>>         If the key:value pair is absent (null),
>>>>     NoImageAvailable.png is displayed as expected.
>>>>     =================== Exhibit 3 version 2 ===================
>>>>     Exhibit 3 catalog - version 2
>>>>     
>>>> <http://ontomatica.com/public_new/project/test/Exhibit_implementations/Exhibit_images_seeds/_index_5_.html>
>>>>     Here is the Exhibit code (per my interpretation of your
>>>>     advice):     <td style="position: relative">         <div
>>>>     class="itemThumbnail-blocker"></div>         <div
>>>>     data-ex-if-exists=".image">             <img
>>>>     data-ex-src-content=".image" />         </div>         <div
>>>>     data-ex-style-subcontent="display:{{'if(not(exists(.image)),
>>>>     'block', 'none')'}}">             <img
>>>>     src="NoImageAvailable.png" />         </div>     </td> Comment:
>>>>         Applying the proposed changes to Exhibit 3-version 2, the
>>>>     "No Image Available" image is in every Lens. Motivation: I have
>>>>     a version that works correctly if the "image":"" field is
>>>>     absent for an item. But I would like to keep that field in the
>>>>     items file to be able to easily add an image.png when I find
>>>>     one. /jay On Tuesday, December 1, 2015 at 11:42:27 PM UTC-6,
>>>>     David Karger wrote:
>>>>
>>>>         I don't know what 'key image - value null' means.  But if
>>>>         you want to set the display attribute based on your if
>>>>         test, I think what you want is   data-ex-style-subcontent =
>>>>         "display: {{'if(...your stuff...)'}}"
>>>>         On 11/24/2015 3:37 AM, Jay Gray wrote:
>>>>>         Roger that David. Here is a working Exhibit:    
>>>>>         
>>>>> http://ontomatica.com/public_new/project/test/Exhibit_implementations/Exhibit_images_seeds/index_exhibit_4_.html
>>>>>         
>>>>> <http://ontomatica.com/public_new/project/test/Exhibit_implementations/Exhibit_images_seeds/index_exhibit_4_.html>
>>>>>         Am using this expression:     <div
>>>>>         data-ex-display-style-subcontent="{{
>>>>>         if(not(exists(.image)), 'block', 'none') }}">         <img
>>>>>         src="NoImageAvailable.png" />     </div> In original JSON,
>>>>>         a null URL was set as follows:     "image": "", Let's call
>>>>>         this 'key image - value null' For 'key image - value null'
>>>>>         the above expression doesn't work. Example is "Pepper,
>>>>>         Early Jalepeno". However, if I delete 'key image - value
>>>>>         null' from the items file, the expression does work.
>>>>>         Examples are "Pepper, Anaheim" and "Pepper, Cal Wonder".
>>>>>         Would like to keep the 'key image - value null' fields in
>>>>>         the JSON items file to simplify addition of new images in
>>>>>         the future. Is there a way to re-write the expression to
>>>>>         handle the 'key image value null' condition? Also have a
>>>>>         second issue in the same Exhibit. For Zones, the
>>>>>         expression is set as:     data-ex-show-missing="false"
>>>>>         However, the number of keys with missing values does
>>>>>         appear in the facet list. What am I doing wrong here? ----
>>>>>         On Monday, November 23, 2015 at 2:43:23 PM UTC-6, Jay Gray
>>>>>         wrote:
>>>>>
>>>>>             I have a structure below that worked for Exhibit 2.
>>>>>                  If an image is not available, the image
>>>>>             'NoImageAvailable.png' is used in its place. <td
>>>>>             valign="bottom"
>>>>>             class="itemThumbnail-thumbnailContainer">     <div
>>>>>             style="position: relative">         <div
>>>>>             class="itemThumbnail-blocker"></div>         <div
>>>>>             ex:if-exists=".image">             <img
>>>>>             ex:src-content=".image" />         </div>         <div
>>>>>             ex:display-style-subcontent="{{
>>>>>             if(not(exists(.image)), 'block', 'none') }}">        
>>>>>                 <img src="NoImageAvailable.png" />         </div>
>>>>>                 </div> </td> However, its equivalent for Exhibit 3
>>>>>             does not work: <td valign="bottom"
>>>>>             class="itemThumbnail-thumbnailContainer">     <div
>>>>>             style="position: relative">         <div
>>>>>             class="itemThumbnail-blocker"></div>         <div
>>>>>             data-ex-if-exists=".image">             <img
>>>>>             data-ex-src-content=".image" />         </div>        
>>>>>             <div data-ex-display-style-subcontent="{{
>>>>>             if(not(exists(.image)), 'block', 'none') }}">        
>>>>>                 <img src="NoImageAvailable.png" />         </div>
>>>>>                 </div> </td> meaning that NoImageAvailable.png is
>>>>>             not displayed when a planned image is not available.
>>>>>             What am I doing wrong? /jg
>>>>>
>>>>>         -- You received this message because you are subscribed to
>>>>>         the Google Groups "SIMILE Widgets" group. To unsubscribe
>>>>>         from this group and stop receiving emails from it, send an
>>>>>         email to simile-widget...@googlegroups.com. To post to
>>>>>         this group, send email to simile-...@googlegroups.com.
>>>>>         Visit this group at
>>>>>         http://groups.google.com/group/simile-widgets
>>>>>         <http://groups.google.com/group/simile-widgets>. For more
>>>>>         options, visit https://groups.google.com/d/optout
>>>>>         <https://groups.google.com/d/optout>. 
>>>>
>>>>     -- You received this message because you are subscribed to the
>>>>     Google Groups "SIMILE Widgets" group. To unsubscribe from this
>>>>     group and stop receiving emails from it, send an email to
>>>>     simile-widget...@googlegroups.com <javascript:>. To post to
>>>>     this group, send email to simile-...@googlegroups.com
>>>>     <javascript:>. Visit this group at
>>>>     http://groups.google.com/group/simile-widgets
>>>>     <http://groups.google.com/group/simile-widgets>. For more
>>>>     options, visit https://groups.google.com/d/optout
>>>>     <https://groups.google.com/d/optout>. 
>>     -- You received this message because you are subscribed to the
>>     Google Groups "SIMILE Widgets" group. To unsubscribe from this
>>     group and stop receiving emails from it, send an email to
>>     simile-widget...@googlegroups.com <javascript:>. To post to this
>>     group, send email to simile-...@googlegroups.com <javascript:>.
>>     Visit this group at http://groups.google.com/group/simile-widgets
>>     <http://groups.google.com/group/simile-widgets>. For more
>>     options, visit https://groups.google.com/d/optout
>>     <https://groups.google.com/d/optout>. 
>
> -- You received this message because you are subscribed to the Google
> Groups "SIMILE Widgets" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> simile-widgets+unsubscr...@googlegroups.com
> <mailto:simile-widgets+unsubscr...@googlegroups.com>. To post to this
> group, send email to simile-widgets@googlegroups.com
> <mailto:simile-widgets@googlegroups.com>. Visit this group at
> http://groups.google.com/group/simile-widgets. For more options, visit
> https://groups.google.com/d/optout. 

-- 
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to simile-widgets+unsubscr...@googlegroups.com.
To post to this group, send email to simile-widgets@googlegroups.com.
Visit this group at http://groups.google.com/group/simile-widgets.
For more options, visit https://groups.google.com/d/optout.

Reply via email to