Exhibit: one facet to serve multiple data types with a shared field for views with different collections

21 views
Skip to first unread message

Paweł

unread,
May 21, 2008, 12:17:08 AM5/21/08
to SIMILE Widgets
Hi,

Another situation I am dreaming of having in my website.

Scenario:
- There are two data types: typeA and typeB
- Elements of both of these types have a field called 'featureX' which
has the same
semantics for both types
- There are three views:
a) one that presents typeA elements only
b) one that presents typeB elements only
c) one that presents both typeA and typeB elements

Question:
How to make a facet that would filter elements on featureX that would
work for all views
for both types?
It is acceptable that for view a) the facet will present values of
featuresX which
are used only by the typeB, and vice versa, because selecting them
will of course
just result in an empty list of elements, which is natural for the
user to get.

regards,
Pawel Mazur

David Huynh

unread,
May 27, 2008, 4:34:00 PM5/27/08
to simile-...@googlegroups.com
I'm not sure if I totally understand the scenario. Let's be a little
more concrete. Say we're building an exhibit of people in a
school--teachers and students. And featureX would be something like
"salary", which applies only to teachers. Then what do you want to happen?

David

Paweł

unread,
Jun 8, 2008, 8:02:27 AM6/8/08
to SIMILE Widgets
Hi,

Oops I missed your reply and have been waiting for it all the time :)

Imagine we have a school with Teachers and Students. Items of both of
these types
have a feature "Zodiac".
Now, we have 3 views of data:
a) a list of Teachers (tile view)
b) a list of Students (tile view)
c) a timeline with two bands: one displays Teachers, another one
displays Students.

For this purpose I have three collections:
1. items of Teachers - used for the view a)
2. items of Students - used for the view b)
3. all items - used for the view c)

I would like to have one facet for selecting Zodiac signs of which I
want to display items of both types
on all 3 views.

At the moment I have 3 facets for Zodiac: one per each view (because
the facet that uses the collection with all items
does not work for views with collections which are subsets of the
collection with all items).

regards,
Pawel

On May 28, 6:34 am, David Huynh <dfhu...@alum.mit.edu> wrote:
> Paweł wrote:
> > Hi,
>
> > Another situation I am dreaming of having in my website.
>
> > Scenario:
> > - There are two data types: typeA and typeB
> > - Elements of both of these types have a field called 'featureX' which
> > has the same
> > semantics for both types
> > - There are three views:
> > a)onethat presents typeA elements only
> > b)onethat presents typeB elements only
> > c)onethat presents both typeA and typeB elements
>
> > Question:
> > How to make afacetthat would filter elements on featureX that would
> > work for all views
> > for both types?
> > It is acceptable that for view a) thefacetwill present values of

Josh Aresty

unread,
Jun 9, 2008, 8:23:43 PM6/9/08
to SIMILE Widgets
Hi Pawel,

I believe that this is currently possible. All you need to do is
specify ex:itemTypes="typeA, typeB" on the view that would show both,
ex:itemTypes="typeA" to show just typeA, and ex:itemTypes="typeB" to
show just typeB. The facets that you specify will apply to all
views. Does that help?

Best,
Josh Aresty

Paweł

unread,
Jun 9, 2008, 9:27:53 PM6/9/08
to SIMILE Widgets
Hi,

Not really. I do not have a problem with creating a view that can
display elements of two types.
The problem is with having a facet that would work for two types.
So I would like to have sth like:
<div ex:role="facet" ex:collectionID="typeA-things,typeB-things"
ex:expression=".featureX" ex:facetLabel="Select featureX values"></
div>

Both typeA and typeB have the featureX field.

regards,
Pawel

Josh Aresty

unread,
Jun 9, 2008, 9:52:28 PM6/9/08
to SIMILE Widgets
Hmm.... do you have an example I could take a look at? Why are you
specifying ex:collectionID? If there's one collection that contains
both item types, I would expect that the .featureX facet (assuming
that both types use the same string for .featureX) would filter both
types.

Josh

David Huynh

unread,
Jun 10, 2008, 11:28:32 AM6/10/08
to simile-...@googlegroups.com
I think what Pawel need are 4 collections

teachers
/ \
everybody1 everybody2
\ /
students

The teachers collection can be defined as

<div ex:role="collection" ex:baseCollectionID="everybody1"
ex:expression="filter(value, .type = 'Teacher')"
></div>

You would need to link to the api-dev version of Exhibit where I just
added "filter" recently.

And everybody2 is the union of teachers and students, which I think
we've talked about how to do before.

You need to link the various facets to different collections.

If you get this working, please do give us a URL so we can use it as an
example for other people in the future.

David

Josh Aresty

unread,
Jun 10, 2008, 12:15:36 PM6/10/08
to SIMILE Widgets
Hey David,

Wouldn't everybody1 and everybody2 be the same set? Why is it
necessary to create this structure?

Josh

David Huynh

unread,
Jun 18, 2008, 1:32:35 AM6/18/08
to simile-...@googlegroups.com
Hi Josh,

They are different because "teachers" and "students" might be filtered.
So, attaching facets to "everybody1" and then making selections in those
facets will restrict the sets of items in "teachers" and "students". And
then, attaching facets to "teachers" and to "students", and making
selections in those facets will restrict the set of items in "everybody2".

David

Paweł

unread,
Jun 19, 2008, 1:12:14 AM6/19/08
to SIMILE Widgets
Hi David,

I do not quite understand this suggestion. I want to have one facet
only that will
select both Teachers and Students in all 3 views, but one view
displays only teachers,
another only students and yet another both students and teachers.

A way to achieve similar effect would be having just one view which
displays both teachers
and students and have additional item where user can decide which data
type to display...

Pawel

Josh Aresty

unread,
Jun 19, 2008, 10:15:12 AM6/19/08
to simile-...@googlegroups.com
Hey all,

David asked me to forward this message to the list.

Josh

---------- Forwarded message ----------
From: David Huynh <dfh...@alum.mit.edu>
Date: 2008/6/18
Subject: Re: Exhibit: one facet to serve multiple data types with a shared field for views with different collections
To: Josh Aresty <jar...@gmail.com>


Josh Aresty wrote:
Hey David,

I took a look at the thread
(http://groups.google.com/group/simile-widgets/browse_thread/thread/a82473a411f30cf5/1560fd3aba732939?lnk=gst&q=union+collection#1560fd3aba732939),
and I think the situation is a bit different here.  A brief glance at
the data in the example (I made a copy
http://web.mit.edu/~jaresty/Public/pawel/ex2.html) doesn't show any
links between Events and Announcements, so I don't think that I can
use the same technique.  I'm thinking about modifying baseCollectionID
to take a comma-separated list of IDs and split them; do you think
that would work?
 
Hi Josh, Scott,

Here is an example that works:

  http://people.csail.mit.edu/dfhuynh/misc/exhibit-examples/split-collections/test.html

I think this is what you want, but let me know if that's not the case.

Note that my suggestion of filter(value, .type = 'Teacher') was wrong in that .type evaluates to a set but = compares that set against a string and always returns false. So I changed that to filter(value, contains(.type, 'Teacher')). But there is also a bug in "contains" and so I need to add a little fix to "contains" in that example.

Josh, your suggestion of having baseCollectionID be a list of collection IDs would be very convenient for union-ing collections. But I wonder if we should use a different attribute, e.g.,
  <div ex:role="collection" ex:union="c1, c2"></div>
This is because ex:baseCollectionID can go together with ex:expression and ex:restrictBaseCollection, which are not applicable when you're doing unions.

David




--
Best,
Josh Aresty
Systems Administrator/Programmer
MIT LLARC

Paweł

unread,
Jun 19, 2008, 11:59:26 PM6/19/08
to SIMILE Widgets
Hi,

Great, that solves my problem! I tested it on values which have sets
of strings, not just strings - seems to be working OK.
I note that the example uses the api-dev not api-2.0 (for which it
does not work), I believe things won't stop working at some point? :)
On the other hand maybe with api-3.0 things like this will be easier
to do?

Thanks a lot for your help with this!

Pawel



On Jun 20, 12:15 am, "Josh Aresty" <jare...@gmail.com> wrote:
> Hey all,
>
> David asked me to forward this message to the list.
>
> Josh
>
> ---------- Forwarded message ----------
> From: David Huynh <dfhu...@alum.mit.edu>
> Date: 2008/6/18
> Subject: Re: Exhibit: one facet to serve multiple data types with a shared
>
> field for views with different collections
> To: Josh Aresty <jare...@gmail.com>
>
> Josh Aresty wrote:
>
> > Hey David,
>
> > I took a look at the thread
> > (
> >http://groups.google.com/group/simile-widgets/browse_thread/thread/a8...
> > ),
> > and I think the situation is a bit different here.  A brief glance at
> > the data in the example (I made a copy
> >http://web.mit.edu/~jaresty/Public/pawel/ex2.html<http://web.mit.edu/%7Ejaresty/Public/pawel/ex2.html>)
> > doesn't show any
> > links between Events and Announcements, so I don't think that I can
> > use the same technique.  I'm thinking about modifying baseCollectionID
> > to take a comma-separated list of IDs and split them; do you think
> > that would work?
>
> Hi Josh, Scott,
>
> Here is an example that works:
>
> http://people.csail.mit.edu/dfhuynh/misc/exhibit-examples/split-colle...

David Huynh

unread,
Jun 20, 2008, 12:13:41 PM6/20/08
to simile-...@googlegroups.com
Paweł wrote:
> Hi,
>
> Great, that solves my problem! I tested it on values which have sets
> of strings, not just strings - seems to be working OK.
> I note that the example uses the api-dev not api-2.0 (for which it
> does not work), I believe things won't stop working at some point? :)
> On the other hand maybe with api-3.0 things like this will be easier
> to do?
>
> Thanks a lot for your help with this!
>
Glad it works :-) Please do share with us the URL to your exhibit, if
it's public, so that we can use it as an example for other people should
they need to do the same thing!

api-dev is automatically refreshed hourly from our Subversion repository
code base. There's no guarantee that it won't break if someone makes a
broken check-in. If you're really worried about having it work, then you
could check out the source code and host it yourself :-) Sorry but I'm
not being so rigorous with official releases.

David

VinayK...@hotmail.com

unread,
Jun 25, 2008, 6:40:53 PM6/25/08
to SIMILE Widgets
I was looking for exactly the same thing and this example works great!
Thanks.
Vinay
Reply all
Reply to author
Forward
0 new messages