Interested in a json service

7 views
Skip to first unread message

Mike Giddens

unread,
Jul 10, 2008, 11:48:50 AM7/10/08
to Biodiversity Collections Index
After reviewing the new and wonderful services I saw the comment:

It would be feasible to generate RSS, ATOM or similar harvest/
syndication feeds should they be required. If you have a need for such
a service please raise it as a topic in the forum.

I am a Biodiversity Informatics software developer and could see some
potential uses to look up information via ajax and for me that would
be JSON format.

It seems like it would be very easy to have something very similar to
the RDF output mixed with the REST search to return a list of id's

I could see for example:
http://www.biocol.org/json/lookup/code/LSU
or
http://www.biocol.org/json/lookup/code/LSU?callback="foobar"

Return:
[{
urn: urn:lsid:biocol.org:col:15590
, name: 'Louisiana State University Herbarium'
}]

or
foobar( [{
urn: urn:lsid:biocol.org:col:15590
, name: 'Louisiana State University Herbarium'
}])

Here is a good reference on JSON
http://developer.yahoo.com/common/json.html

So now that we have codes we could
http://www.biocol.org/json/urn/urn:lsid:biocol.org:col:15590

and possibly get back something similar to:

{
collection:{
about:'urn:lsid:biocol.org:col:15590',
sameas:{
resource:'http://biocol.org/urn:lsid:biocol.org:col:
15590'
},
title:'Louisiana State University Herbarium',
identifier:'LSU',
formationperiod:1869,
created:1869,
geospatialcoverage:'\nLouisiana; lichens of southeastern
U.S.; crustose lichens worldwide; Asteraceae, Fabaceae, and Poaceae
worldwide.\n',
hascontact:{
contactdetails:{
fn:'Lowell E. Urbatsch',
role:'Director',
email:'l...@lsu.edu',
relation:[
{
resource:'http://www.herbarium.lsu.edu/
plants'
},
'http://biocol.org/collection/rdf/id/15590'
],
adr:[
'\nBiological Sciences Department Herbarium,
202 Life Sciences Building, Baton Rouge, Louisiana, U.S.A., US\n',
'A257 Life Sciences Annex., BATON ROUGE,
Louisiana'
],
tel:[
{
parsetype:'Resource',
type:{
resource:'http://www.w3.org/1999/02/22-
rdf-syntax-ns#voice'
},
value:'[1] 225/ 578-8564.'
},
{
parsetype:'Resource',
type:{
resource:'http://www.w3.org/1999/02/22-
rdf-syntax-ns#fax'
},
value:'[1] 225/ 578-2597.'
}
],
hasowner:{
institution:{
type:'University (State)'
}
},
description:{
about:'http://biocol.org/collection/rdf/id/
15590',
sameas:{
resource:'http://biocol.org/collection/rdf/
id/15590/record_id/90311'
},
created:'2008-03-05 12:33:17',
modified:'2008-05-26 09:38:53',
creator:'Biodiversity Collections Index',
publisher:{
resource:'http://
www.biodiversitycollectionsindex.org'
},
datecopyrighted:'2008-05-26 09:38:53',
description:'\nRDF formated description of the
entry in the Biodiversity Collections Index with id
urn:lsid:biocol.org:col:15590\n',
subject:'\nNatural Biodiversity Collections
Descriptions Specimen Repository\n',
format:'text/xml',
language:'en',
hasformat:{
resource:'http://biocol.org/collection/
view/id/15590'
},
isformatof:{
resource:'http://biocol.org/collection/
view/id/15590'
},
license:{
resource:'http://creativecommons.org/
licenses/by-sa/3.0/'
},
references:[
{
resource:'urn:lsid:biocol.org:col:
15590'
},
{
resource:'http://biocol.org/
urn:lsid:biocol.org:col:15590'
}
],
hasversion:{
resource:'http://biocol.org/collection/rdf/
id/15590/record_id/73561'
}
}
}
}
}
}

If you need any help or someone to help test I will be happy to
contribute.

rogerhyam

unread,
Jul 10, 2008, 12:25:44 PM7/10/08
to Biodiversity Collections Index
Hi Mike,

I'd be happy to work something up. BCI uses AJAX + JSON to run the
interface forms so the base technology is in place.

What I would like to do is develop such a service around a particular
use case rather than a generic system of exposing the data as JSON and
hoping some one comes along and uses it. I can see examples where
people would want to embed look up services in a web page or data
entry screen for example.

I think it would be good to produce something people could see working
in production systems.

Do you have a specific use case we could work on together?

All the best,

Roger


On Jul 10, 4:48 pm, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
> After reviewing the new and wonderful services I saw the comment:
>
> It would be feasible to generate RSS, ATOM or similar harvest/
> syndication feeds should they be required. If you have a need for such
> a service please raise it as a topic in the forum.
>
> I am a Biodiversity Informatics software developer and could see some
> potential uses to look up information via ajax and for me that would
> be JSON format.
>
> It seems like it would be very easy to have something very similar to
> the RDF output mixed with the REST search to return a list of id's
>
> I could see for example:http://www.biocol.org/json/lookup/code/LSU
> orhttp://www.biocol.org/json/lookup/code/LSU?callback="foobar"
>
> Return:
> [{
> urn: urn:lsid:biocol.org:col:15590
> , name: 'Louisiana State University Herbarium'
>
> }]
>
> or
> foobar( [{
> urn: urn:lsid:biocol.org:col:15590
> , name: 'Louisiana State University Herbarium'
>
> }])
>
> Here is a good reference on JSONhttp://developer.yahoo.com/common/json.html
>
> So now that we have codes we couldhttp://www.biocol.org/json/urn/urn:lsid:biocol.org:col:15590
>
> and possibly get back something similar to:
>
> {
> collection:{
> about:'urn:lsid:biocol.org:col:15590',
> sameas:{
> resource:'http://biocol.org/urn:lsid:biocol.org:col:
> 15590'
> },
> title:'Louisiana State University Herbarium',
> identifier:'LSU',
> formationperiod:1869,
> created:1869,
> geospatialcoverage:'\nLouisiana; lichens of southeastern
> U.S.; crustose lichens worldwide; Asteraceae, Fabaceae, and Poaceae
> worldwide.\n',
> hascontact:{
> contactdetails:{
> fn:'Lowell E. Urbatsch',
> role:'Director',
> email:'...@lsu.edu',

Mike Giddens

unread,
Jul 10, 2008, 2:22:26 PM7/10/08
to Biodiversity Collections Index
Once case study would be to see regional herbaria group use actual bci
data instead of tring to repeat the process and possible having out of
date data. An existing example is the SERNEC group http://www.sernec.org.
If you click on the map it goes to the state then that state shows the
list of members in SERNEC. I could envision a widget similar to
something long these grouped by states.
http://extjs.com/deploy/dev/examples/grid/binding-with-classes.html
This would be a basic urn request like the original example. This way
different groups could simply add the "ID" to a to their config list
of members and the rest would show up-to-date information about each
group.

If you wish I would be interested in making such a widget using the
ExtJS framework and posting it as an open source widgit contributed by
SilverBiology. I know you guys use dojo but have been working for the
past 1.5 years with Ext and I am most comfortable with its growth and
usability.

I could also see using it myself for a list of clients of
SilverBiology that would take on the same type of widget.

A complete example would be all the different Herbarium Corsortia like
SERNEC, Torch, New England, Great Lakes, Northern Great Plains,
Pacific Northwest, California Consortium, Cirh, Rockies, Arizona & new
mexico, and Central Great Plains.

Let me know your thoughts.

-Mike

rogerhyam

unread,
Jul 16, 2008, 8:34:09 AM7/16/08
to Biodiversity Collections Index
Mike,

This seems like good stuff. Would it help if I started by making a
simple URI that you could call, passing in the collection LSID, that
would return the most commonly populated fields for that collection in
a JSON array. I should be able to do this in the next few days (bugs
depending).

If I do that and you can consume it then I could add JSON to the
current REST lookup for codes or expand it to a search of some kind.

The issue with doing individual states within the US at the moment is
with the data not being scored to them correctly. The state field
isn't a controlled vocabulary as I'd have to get bogged down in
tracking political boundaries within all the countries of the world
to implement it. (Australia has states and territories, the UK jumps
to counties if you don't count the 'Nations' etc). There would be
nothing to stop the client having a list of LSIDs held locally that
comprised the collections of interest to their network.

Some one else has suggested an iFrame based search box that could be
deployed on multiple sites. This might work well in combination with a
JSON service.

What do you think?

Roger





On Jul 10, 7:22 pm, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
> Once case study would be to see regional herbaria group use actual bci
> data instead of tring to repeat the process and possible having out of
> date data. An existing example is the SERNEC grouphttp://www.sernec.org.
> If you click on the map it goes to the state then that state shows the
> list of members in SERNEC. I could envision a widget similar to
> something long these grouped by states.http://extjs.com/deploy/dev/examples/grid/binding-with-classes.html

Mike Giddens

unread,
Jul 17, 2008, 10:26:49 AM7/17/08
to Biodiversity Collections Index
A simple url with a JSON return object would be a great start. I
would be able to hold my own array of lsid's for now and get a simple
proof of concept up to show you how the data can be used. I think it
would also be important to be able to pass multiple lsid's as well
since it is easier to make one request then multiple requests. Just
let me know when you have a test url and I will put something
together.

As for the state thing I understand the issues with State/Provinces
around the world. In the future it might be helpful to cross
reference that with a dataset but for now that is easy to work around
for my initial idea.

The iframe solution is always a solution too. Something like:
<iframe src="http://www.biocol.org/html/embed?{arguments}"
style="border: 0" width="300" height="200" frameborder="0"
scrolling="no"></iframe>
This way only allows the user freedom to customize it based on what
you allow as options. This is a very common practice for say google
with their calender or other embeded solutions and I think would be a
good option for people who have no programming experience and just
want to copy paste something onto their website.

-Mike

Mike Giddens

unread,
Jul 28, 2008, 10:49:07 AM7/28/08
to Biodiversity Collections Index
Roger,

Any progress on this topic? I am excited to get a practical case for
this API.

-Mike

On Jul 17, 9:26 am, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
> ...
>
> read more »

rogerhyam

unread,
Jul 28, 2008, 10:57:57 AM7/28/08
to Biodiversity Collections Index
Hi Mike,

Sorry for the delay. I have been dragged off on a couple of other
things. I got as far creating the stub for the class so it is
underway. I should get back to it later this week.

Meanwhile if you are interested I have created CSV snapshots for use
in db lookups etc.

http://www.biodiversitycollectionsindex.org/static/webserves.html

All the best,

Roger


On Jul 28, 3:49 pm, Mike Giddens <mikegidd...@silverbiology.com>
> ...
>
> read more »

Mike Giddens

unread,
Jul 29, 2008, 11:06:42 AM7/29/08
to Biodiversity Collections Index
I will play with that data in the meantime.

ATTENTION!!!!

Your first link on the csv download is broken you probably wanted to
have http://biocol.org/downloads/lookup_lsid.csv.zip and it is not
that.

-Mike
> ...
>
> read more »

rogerhyam

unread,
Jul 29, 2008, 11:49:42 AM7/29/08
to Biodiversity Collections Index
Hi Mike

I just uploaded the initial, early, tentative JSON service. It is
linked off the web services page here:

http://www.biodiversitycollectionsindex.org/static/webserves.html

The interesting bit is here

http://biocol.org/json

Here is an example:

http://biocol.org/json/fetch/lsid/urn:lsid:biocol.org:col:15670

I have not even tried to consume the JSON so please have a play and
get straight back to me if it doesn't work. I figure it is better to
take baby steps and bat something back and forward rather than risk
going off in the wrong direction.

There are a lot of nulls in any data you get back reflecting the
nature of the data. I figured it is better to return everything than
faff with configurable list of properties to return but this may lead
to out of memory problems with large numbers of objects in a browser.

This is a very simple approach to JSON but I note that the zend
framework includes a JSON-RPC server. It may be worth considering this
approach - if I had time....

Anyhow let me know how you get on and thanks for the broken link - tis
fixed.

All the best,

Roger

On Jul 29, 4:06 pm, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
> I will play with that data in the meantime.
>
> ATTENTION!!!!
>
> Your first link on the csv download is broken you probably wanted to
> havehttp://biocol.org/downloads/lookup_lsid.csv.zipand it is not
> ...
>
> read more »

Mike Giddens

unread,
Jul 30, 2008, 11:49:34 AM7/30/08
to Biodiversity Collections Index
Wonderful. Just at first glance it looks like it will be easy to work
with. I will work something up over the next few days. I am at
Botany 2008 in Vancouver at the moment and when I get a few hours I
will put something together.

-Mike
> > havehttp://biocol.org/downloads/lookup_lsid.csv.zipandit is not
> ...
>
> read more »

Mike Giddens

unread,
Aug 6, 2008, 6:05:26 PM8/6/08
to Biodiversity Collections Index
I have started with the widget I had in mind and there is an issue
before I can get this to work.

There needs to be a callback option. If there is no callback then
there is no way to do a cross-domain request without using a local
proxy. This would defeat the purpose of someone easily adding a
script to their website. What I suggest is "callback" be a default
argument. so it would look something like callback([....]).

Optionally the possibility of passing an argument say
http://biocol.org/json/fetch/lsid/urn:lsid:biocol.org:col:15670?callback=foobar
or ..:15670/foobar where foobar will be the name of the callback. The
benefit of this is unique callback can be cancelled if the request are
taking too long or other queuing reasons.

Also the [ ] is not necessary for the argument unless you have some
way of sending back multiple lsid's in one return result.

-Mike

Mike Giddens

unread,
Aug 6, 2008, 6:46:36 PM8/6/08
to Biodiversity Collections Index
I looked more at the http://biocol.org/json page and see that
http://biocol.org/json/fetch?lsid=... is the actual script and the
other is just an easy mod rewrite. So the easiest thing would be to
have another parameter called "callback" so I can pass
http://biocol.org/json/fetch?callback=foobar&lsid=...

Now that I see you can pass multiple arguments then the [ ] should
stay.

-Mike

rogerhyam

unread,
Aug 8, 2008, 6:50:31 AM8/8/08
to Biodiversity Collections Index
Mike,

I have added the behaviour you suggest to the service. I am new to
this cross site scripting so I'll be really interested to see what you
come up with.

Let me know if you need any other changes,

Roger


On Aug 6, 11:46 pm, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
> I looked more at thehttp://biocol.org/jsonpage and see thathttp://biocol.org/json/fetch?lsid=...  is the actual script and the
> other is just an easy mod rewrite.  So the easiest thing would be to
> have another parameter called "callback" so I can passhttp://biocol.org/json/fetch?callback=foobar&lsid=...

Mike Giddens

unread,
Aug 9, 2008, 1:02:32 AM8/9/08
to Biodiversity Collections Index
Roger,

Here is a simple test to show that your service is working.

Sample Ajax widget showing the use of the Json api:
http://www.silverbiology.com/services/biocol (Only html and javascript
on my side)

I plan on making this complete with different configs and explaining
how to use it so that people can just make a list of lsid's, place the
code onto their website and it will do the rest.

My example case should be a complete interactive widget to show all
the sernec.org 100+ herbaria easily in this interactive manner. I
will post when I have something more to show.

-Mike

Mike Giddens

unread,
Sep 13, 2008, 9:11:14 PM9/13/08
to Biodiversity Collections Index
http://biocol.org/json/fetch?callback=mycallback&lsid=undefined

I was using the JSON api service and realized if that you throw a
plain txt message:

"Error: You must provide at least one valid BCI LSID"

Ideally it should go with the normal callback and do something like:

mycallback({error_num: 1, error: ''Error: You must provide at least
one valid BCI LSID'});

-Mike

rogerhyam

unread,
Sep 16, 2008, 11:35:13 AM9/16/08
to Biodiversity Collections Index
Mike,

This now returns a JSON object as requested.

http://biocol.org/json/fetch?callback=mycallback&lsid=asfsdfsf

Is this OK?

Thanks,

Roger

On Sep 14, 2:11 am, Mike Giddens <mikegidd...@silverbiology.com>
wrote:
Reply all
Reply to author
Forward
0 new messages