Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support prefixed study ids #44

Closed
jar398 opened this issue Jan 11, 2014 · 4 comments
Closed

Support prefixed study ids #44

jar398 opened this issue Jan 11, 2014 · 4 comments
Assignees

Comments

@jar398
Copy link
Member

jar398 commented Jan 11, 2014

We need to have multiple study id namespaces, so use a CURIE i.e. short prefix, colon, suffix. Study id would be for example 'o:123' or 'ot:123' in contexts that expect a study id, but converted to 'o_123' or 'ot_123' in contexts such as file system calls that expect a file name.

Continue to accept unprefixed ids for now for phylografter-originated studies. Feature to consider: allow prefixed 'pg:456' as a synonym for '456' ? Not sure, we need to think about this.

@leto
Copy link
Contributor

leto commented Jan 13, 2014

Some questions:

Do you foresee more namespaces than pg/ot ?

Would it be valid to have a pg10 (or just 10) as well as an ot10 ? There is code that looks at the current list of studies to decide what to call a new study at creation time, so I am wondering how this change will interact with that.

Just to clarify, this means you want current API URL's like this:

http://localhost:8000/api/v1/study/10.json

converted to:

http://localhost:8000/api/v1/study/ot:10.json

Is that correct?

web2py considers URL's with colons (other than to designate a port) as invalid by default, but @jimallman mentioned that he had dealt with that issue before.

@jimallman
Copy link
Member

Other options:

  1. Substitute '_' for ':', as suggested by @jar398 above
  2. Encode ':' as '%3a' (but this is hideous and obscures the CURIE)
  3. Add a '/' instead, so the URL represents a sort of "collection" plus a resource ID
http://opentreeoflife.org/api/v1/study/ot/10.json

From what I've seen, option (3) above is in the spirit of CURIEs as URI-shorteners, as show here:
http://en.wikipedia.org/wiki/CURIE#Example

Instead of embedding the CURIE directly in a URL, we're "expanding" it to its full URL. The CURIE [ot:10] expands to http://opentreeoflife.org/api/v1/study/ot/10.json

Here's a modified version of the example linked above, using more legible URL paths:

<html xmlns:ot="http://opentreeoflife.org/api/v1/study/ot/"
         xmlns:pg="http://opentreeoflife.org/api/v1/study/pg/">
    <head>...</head>
    <body>
        <p>
            Find out more about <a href="[ot:10]">Jansen, 2007</a>.
        </p>
    </body>
</html>

@jar398
Copy link
Member Author

jar398 commented Jan 13, 2014

On Mon, Jan 13, 2014 at 2:42 AM, Duke Leto notifications@github.com wrote:

Some questions:

Do you foresee more namespaces than pg/ot ?

Yes, if the project is successful

Would it be valid to have a pg10 (or just 10) as well as an ot10 ? There
is code that looks at the current list of studies to decide what to call a
new study at creation time, so I am wondering how this change will interact
with that.

No, pg10 and ot10 would not be valid. I'm not sure whether we want 10 to be
valid; I'm just thinking changing 10 to pg10 everywhere would be a big
incompatible change that we might not be up for, so avoiding a flag day
would mean either keeping 10 as an alias or not using the pg prefix at all.
I'm still indecisive on that.

Just to clarify, this means you want current API URL's like this:

http://localhost:8000/api/v1/study/10.json

converted to:

http://localhost:8000/api/v1/study/ot:10.json

Is that correct?

I would consider a URL context to be a file context, since URLs get
converted to and from file names so much, so would expect an underscore
here.

In any case it would not be correct, because the current study set comes
from phylografter, not the opentree webapp. So if we make a change it would
be from 10.json to pg_10.json or maybe even pg/10.json.

web2py considers URL's with colons (other than to designate a port) as
invalid by default, but @jimallman https://github.com/jimallmanmentioned that he had dealt with that issue before.

I would expect : to be replaced by _ in file and URL contexts.
Jonathan


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-32149920
.

@mtholder
Copy link
Member

done but see OpenTreeOfLife/peyotl#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants