I see no reason not to send this along to the developers. I don't know
if "key" has some special significance or if something else could be
easily substituted. The API is very new and hasn't been used much, so
it's good to surface things of this nature. (Note: I consult on the bib
data aspect of the OL, but also took a stab at expanding some of the
text in the API document because the first version was terser than terse.)

Do you have someone in mind to send it to? If not, Alexis can probably
forward it to the right people.


Cloutman, David wrote:
> Inspired by a thread on this list yesterday, I started playing with the
> Open Library API. In order to query through the API, you must pass a
> query as a JSON serialized object. That's good, and it could be great,
> given that for Java and PHP (at least) there already exists the ability
> to serialize a native data type into and out of JSON. The problem that
> I'm noticing is that at least the querying process, the naming
> conventions used by the API complicate this.
> For instance, in order to do a pattern search of the "key" field, one
> must pass the identifier of that field with a tilde (~) appended to that
> field, so that a query would read like this:
> {
>     "key~": "\/about\/*"
> }
> The problem is that for the two programming languages I use, Java and
> PHP the variable name key~ and $key~ is illegal, and I believe that is
> the case for most programming languages. Thus, in this PHP class (an its
> Java analog) would fail at compile / parse time:
> class OpenLibraryQuery {
>         public $key~;
>         __construct ($keyValue) {
>                 $this->key~ = $keyValue;
>         }
> }
> This is a problem, because ideally, I would like to be able to do
> essentially this:
> $query = json_encode(new OpenLibraryQuery('\/about\/*');
> which, if the above class did parse, would automatically assign $query a
> valid JSON string, similar to what is above. Instead, I either have to
> rename my variable, or use string manipulation to make the string work.
> Note that
> $query = json_encode(array('key~'=>'\/about\/*'));
> will not be parsed through the API, and results in an error message.
> This leaves me with three questions:
> 1. Is there an easy way around this, other than string manipulation,
> that I am missing? Does the solution work for most or all programming
> languages?
> 2. Does this strike readers as a significant enough issue to raise with
> the API developers?
> 3. Given that Open Library runs on Infogami and has other dependencies,
> does this strike readers as something that can be remedied?
> - David
> ---
> David Cloutman <[log in to unmask]>
> Electronic Services Librarian
> Marin County Free Library
> Email Disclaimer:

Karen Coyle / Digital Library Consultant
[log in to unmask]
ph.: 510-540-7596   skype: kcoylenet
fx.: 510-848-3913
mo.: 510-435-8234