exhibit, many to many without multiple entries in one field

19 views
Skip to first unread message

mowi

unread,
Feb 19, 2009, 4:09:43 AM2/19/09
to SIMILE Widgets
hi,
I have some data with many to many relationships just like the
articles and authors in the example website about ISWC 2007 + ASWC
2007. http://people.csail.mit.edu/dfhuynh/projects/graph-based-exhibit/graph-based-exhibit2.html

there it is solved by putting multiple persons in the "author" field.

I have a problem getting multiple values in one field because the
data is from acces 2003. I have got one table with articles, one with
authors and one with relationships. The relationship list has three
columns:id (which I do not really use), author and article. Can i also
do it like that in exhibit? how can I do that?
In the example you use ".author.affiliation" to get a value from the
author list in the article overview. Author is an id there. In my
relationship list both author and article cannot be id because they
appear multiple times.

David Karger

unread,
Feb 19, 2009, 8:52:58 AM2/19/09
to simile-...@googlegroups.com
It's ok; you can use author and article as ID even if they appear
multiple times. First do the obvious thing, creating items for the
exhibit corresponding to the authors and articles (using author name as
id for the authors, and article title as id for the articles):
{type: "Author", id: "name of author", affiliation: "affiliation of
author"...}
{type: "Article", id: "title of article", year: "year of publication", ....}

Finally, take your relationship table. Suppose it has a row (authorX,
articleY)
add another fragment of json to the collection of "items":
{id: "articleY", author: "authorX"}
Do this for every row. This will accomplish what you want.

To understand what is going on, note how exhibit will interpret these
final fragments from the relationship table. It will say "ok, this
person is specifying an item whose id is articleY and has an author
property with value authorX. But I already know about an item whose id
is articleY---namely, the one that was defined at the beginning of type
"Article". So, I'm not going to create a new item with id articleY.
Instead, I will _merge_ the attributes of the new item (in particular,
the author relationship to authorX) into the already existing item. And
if that item already has a value of the author property, because I
already saw an author of that article, then I will _add_ authorX as an
additional value for the now-multivalued author property on articleX."

mowi

unread,
Feb 26, 2009, 8:55:03 AM2/26/09
to SIMILE Widgets
Hi David,

I tried it like you said and made a third excel sheet for the
connections. The authors are now connected to the articles but
instead of multiple authors only the last author got connected to the
article in the JSON file. I used Babel to convert the excel file to
JSON. I have also tried to convert to JSONP but that didn`t matter.
Any ideas?
> > 2007.http://people.csail.mit.edu/dfhuynh/projects/graph-based-exhibit/grap...

David Karger

unread,
Feb 26, 2009, 10:21:43 AM2/26/09
to simile-...@googlegroups.com
Take a look at
http://people.csail.mit.edu/karger/Exhibit/example.html
and you'll see that "thing" has three children first, second, and
third. If you look at the data file
http://people.csail.mit.edu/karger/Exhibit/data.js
you will see that those children were introduced using two separate
mentions of "thing"

mowi

unread,
Feb 26, 2009, 11:00:50 AM2/26/09
to SIMILE Widgets
Hi David,

Thanks for making a quick example. I understand how my JSON file
should look like but I do not make my JSON by hand, that would be too
much work..
I generate my JSON file with babel from an excel sheet.
I cannot figure out how I can get babel to generate a file like
your .js file

my excel file looks like this:
http://spreadsheets.google.com/pub?key=pEBZe9K5tabOdZXuL1uEoRQ

and the JSON that is generated by Babel like this.
http://www.moniquedewilt.com/test/manytomanytest.js

I have tried making to seperate JSONs, one with the items and one with
the connections but that did not work either. Babel only makes one
"record" for each item and only one value in each field. when the item
appears multiple times in excel with the same field, babel only uses
the last value for that field.
Any clues how to get Babel to do this?

David Karger

unread,
Feb 26, 2009, 11:07:14 AM2/26/09
to simile-...@googlegroups.com
ah, so you are describing a babel bug rather than an exhibit bug.
for that it might be necessary to invoke a higher power (davidh).

One quick hack you could do is as follows:
for your spreadsheet, rename the current "label" column as "intendedLabel"
create a new "label" column that you fill with _distinct_ values (eg,
increasing integers).
after your json is generated, do a global replace in it of "label" by
"fakeLabel" and then replace "intendedLabel" with "label"

Because babel is presumably using the label field to merge items, your
use of distinct labels will prevent the merge. But after you rename the
properties, exhibit will carry out the correct merge on the client side.

David Huynh

unread,
Feb 26, 2009, 11:08:58 AM2/26/09
to simile-...@googlegroups.com
Try to put first, second and third into the same cell in the {child}
column, separated by semicolons

first; second; third

David

mowi

unread,
Feb 26, 2009, 11:18:17 AM2/26/09
to SIMILE Widgets
Hi David,

I know it works when I put multiple values in one excel field but I
cannot do that because I am also using the same data in Access 2003.
Access cannot handle multiple values in one field.

mowi

unread,
Feb 26, 2009, 11:33:28 AM2/26/09
to SIMILE Widgets
Thanks David K,

your workaround works. It is a bit awkward though, I hope the higher
power looks upon me with kindness and fixes the babel bug ;)

David Huynh

unread,
Feb 28, 2009, 4:50:19 PM2/28/09
to simile-...@googlegroups.com
You could actually create a column called id, and I believe Babel should
correctly merge rows with the same id.

David

mowi

unread,
Mar 5, 2009, 5:32:40 AM3/5/09
to SIMILE Widgets
Hi David H,

I have just tried that. It merged the rows but it has only put the
last value in the field, not multiple values.

so i have changed the excel so it looks like this:
http://spreadsheets.google.com/pub?key=pEBZe9K5tabOdZXuL1uEoRQ

Babel translates it to this .js:
http://www.moniquedewilt.com/test/data%20with%20id.js
or run through exhibit:
http://www.moniquedewilt.com/test/example%20with%20ids.html

David Huynh

unread,
Mar 6, 2009, 4:39:04 PM3/6/09
to simile-...@googlegroups.com
mowi wrote:
> Hi David H,
>
> I have just tried that. It merged the rows but it has only put the
> last value in the field, not multiple values.
>
> so i have changed the excel so it looks like this:
> http://spreadsheets.google.com/pub?key=pEBZe9K5tabOdZXuL1uEoRQ
>
> Babel translates it to this .js:
> http://www.moniquedewilt.com/test/data%20with%20id.js
> or run through exhibit:
> http://www.moniquedewilt.com/test/example%20with%20ids.html
>
You're right--that's a bug. The Excel Babel converter only takes the
last row. If you care to fix it for your own use, the code in question
is here


http://simile.mit.edu/repository/babel/trunk/converters/xls-converter/src/main/java/edu/mit/simile/babel/xls/XLSReader.java

The offending line is

item.m_properties.put(column, cell);
m_properties is a hashmap from column to cell, but it should be from
column to a list of cells.

David

David Huynh

unread,
Mar 17, 2009, 4:08:18 PM3/17/09
to simile-...@googlegroups.com
mowi wrote:
> Hi David H,
>
> I have just tried that. It merged the rows but it has only put the
> last value in the field, not multiple values.
>
> so i have changed the excel so it looks like this:
> http://spreadsheets.google.com/pub?key=pEBZe9K5tabOdZXuL1uEoRQ
>
> Babel translates it to this .js:
> http://www.moniquedewilt.com/test/data%20with%20id.js
> or run through exhibit:
> http://www.moniquedewilt.com/test/example%20with%20ids.html
>
I've fixed this, I think. You could try to feed
http://service.simile-widgets.org/babel/
with this

http://simile-widgets.googlecode.com/svn/babel/trunk/converters/xls-converter/tests/test1.xls

You'd see that the later King Kong movie has both Naomi Watts and Adrien
Brody.

David

Reply all
Reply to author
Forward
0 new messages