{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/comments/80697814","pull_request_review_id":1736456,"id":80697814,"diff_hunk":"@@ -1,17 +1,41 @@\n+import furl\n+import json\n+\n from django.db import models\n from django.db import IntegrityError\n from django.contrib.postgres.fields import JSONField\n \n from share.models.base import ShareObject\n from share.models.fields import ShareForeignKey, ShareURLField, ShareManyToManyField\n-from share.apps import ShareConfig as share_config\n \n \n-__all__ = ('Venue', 'Award', 'Tag', 'Link', 'Subject')\n+__all__ = ('Venue', 'Award', 'Tag', 'Subject', 'Identifier', 'Relation')\n \n # TODO Rename this file\n \n \n+class Identifier(ShareObject):\n+    # https://twitter.com/berniethoughts/\n+    url = ShareURLField(unique=True)\n+\n+    # https://twitter.com/\n+    def get_base_url(self):\n+        return furl(self.url).origin\n+\n+\n+class Relation(ShareObject):\n+    with open('./share/models/relation-types.json') as fobj:\n+        # TODO add label to file\n+        RELATION_TYPES = [(t['key'], t['uri']) for t in json.load(fobj)]","path":"share/models/meta.py","position":31,"original_position":31,"commit_id":"aee324d9b5088f039634d90eba28484b89558413","original_commit_id":"aee324d9b5088f039634d90eba28484b89558413","user":{"login":"aaxelb","id":6776190,"avatar_url":"https://avatars.githubusercontent.com/u/6776190?v=3","gravatar_id":"","url":"https://api.github.com/users/aaxelb","html_url":"https://github.com/aaxelb","followers_url":"https://api.github.com/users/aaxelb/followers","following_url":"https://api.github.com/users/aaxelb/following{/other_user}","gists_url":"https://api.github.com/users/aaxelb/gists{/gist_id}","starred_url":"https://api.github.com/users/aaxelb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaxelb/subscriptions","organizations_url":"https://api.github.com/users/aaxelb/orgs","repos_url":"https://api.github.com/users/aaxelb/repos","events_url":"https://api.github.com/users/aaxelb/events{/privacy}","received_events_url":"https://api.github.com/users/aaxelb/received_events","type":"User","site_admin":false},"body":"When ontologies overlap, I think it makes more sense to have a key pointing to a list of possible uris, rather than having multiple keys that are semantically equivalent.\r\n\r\nRight now the key is stored as a value in the relation table, because it seems sufficient for the queries we'll make and avoids the overhead of joining yet another table when fetching works. The list of allowed relation types is stored in a [https://github.com/aaxelb/SHARE/blob/aee324d9b5088f039634d90eba28484b89558413/share/models/relation-types.json](json file) which is (1) used for validation and (2) exposed at `/api/relationtypes` for eventual use in the curation interface. I can change the file to have a list of uris for each key, and if/when we want to support additional ontologies we could use it in the normalizer to map a uri to a key.","created_at":"2016-09-27T13:56:41Z","updated_at":"2016-09-27T13:56:41Z","html_url":"https://github.com/CenterForOpenScience/SHARE/pull/429#discussion_r80697814","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/comments/80697814"},"html":{"href":"https://github.com/CenterForOpenScience/SHARE/pull/429#discussion_r80697814"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429","id":86370635,"html_url":"https://github.com/CenterForOpenScience/SHARE/pull/429","diff_url":"https://github.com/CenterForOpenScience/SHARE/pull/429.diff","patch_url":"https://github.com/CenterForOpenScience/SHARE/pull/429.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/429","number":429,"state":"open","locked":false,"title":"[WIP] Work relations and identifiers","user":{"login":"aaxelb","id":6776190,"avatar_url":"https://avatars.githubusercontent.com/u/6776190?v=3","gravatar_id":"","url":"https://api.github.com/users/aaxelb","html_url":"https://github.com/aaxelb","followers_url":"https://api.github.com/users/aaxelb/followers","following_url":"https://api.github.com/users/aaxelb/following{/other_user}","gists_url":"https://api.github.com/users/aaxelb/gists{/gist_id}","starred_url":"https://api.github.com/users/aaxelb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaxelb/subscriptions","organizations_url":"https://api.github.com/users/aaxelb/orgs","repos_url":"https://api.github.com/users/aaxelb/repos","events_url":"https://api.github.com/users/aaxelb/events{/privacy}","received_events_url":"https://api.github.com/users/aaxelb/received_events","type":"User","site_admin":false},"body":"* Add circular many-to-many relation between creative works\r\n * Allowed relation types in `share/models/relation-types.json`\r\n* Add many-to-many relationship between works and Identifiers\r\n* Remove `Link` model. The links harvested with a work should be identifiers either for that work or for a related work.\r\n* Use identifiers for disambiguating people and works\r\n * Allow changing a work's type by submitting a changeset for a work with matching identifier and different `@type` (unless the new type is `creativework`)\r\n* Update normalizers to use identifiers/relations instead of links\r\n * io.osf, org.crossref done\r\n * TODO: all the others\r\n\r\nThis will probably require renormalizing the dataset. ","created_at":"2016-09-22T16:24:51Z","updated_at":"2016-09-27T13:56:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0bcabbca322ff7b04223a112139f196bcb6a187a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/429/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/statuses/aee324d9b5088f039634d90eba28484b89558413","head":{"label":"aaxelb:feature/work-relationships","ref":"feature/work-relationships","sha":"aee324d9b5088f039634d90eba28484b89558413","user":{"login":"aaxelb","id":6776190,"avatar_url":"https://avatars.githubusercontent.com/u/6776190?v=3","gravatar_id":"","url":"https://api.github.com/users/aaxelb","html_url":"https://github.com/aaxelb","followers_url":"https://api.github.com/users/aaxelb/followers","following_url":"https://api.github.com/users/aaxelb/following{/other_user}","gists_url":"https://api.github.com/users/aaxelb/gists{/gist_id}","starred_url":"https://api.github.com/users/aaxelb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaxelb/subscriptions","organizations_url":"https://api.github.com/users/aaxelb/orgs","repos_url":"https://api.github.com/users/aaxelb/repos","events_url":"https://api.github.com/users/aaxelb/events{/privacy}","received_events_url":"https://api.github.com/users/aaxelb/received_events","type":"User","site_admin":false},"repo":{"id":62960024,"name":"SHARE","full_name":"aaxelb/SHARE","owner":{"login":"aaxelb","id":6776190,"avatar_url":"https://avatars.githubusercontent.com/u/6776190?v=3","gravatar_id":"","url":"https://api.github.com/users/aaxelb","html_url":"https://github.com/aaxelb","followers_url":"https://api.github.com/users/aaxelb/followers","following_url":"https://api.github.com/users/aaxelb/following{/other_user}","gists_url":"https://api.github.com/users/aaxelb/gists{/gist_id}","starred_url":"https://api.github.com/users/aaxelb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaxelb/subscriptions","organizations_url":"https://api.github.com/users/aaxelb/orgs","repos_url":"https://api.github.com/users/aaxelb/repos","events_url":"https://api.github.com/users/aaxelb/events{/privacy}","received_events_url":"https://api.github.com/users/aaxelb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aaxelb/SHARE","description":"A \"table of contents\" to the various projects that make up SHARE Notification Service development at COS.","fork":true,"url":"https://api.github.com/repos/aaxelb/SHARE","forks_url":"https://api.github.com/repos/aaxelb/SHARE/forks","keys_url":"https://api.github.com/repos/aaxelb/SHARE/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aaxelb/SHARE/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aaxelb/SHARE/teams","hooks_url":"https://api.github.com/repos/aaxelb/SHARE/hooks","issue_events_url":"https://api.github.com/repos/aaxelb/SHARE/issues/events{/number}","events_url":"https://api.github.com/repos/aaxelb/SHARE/events","assignees_url":"https://api.github.com/repos/aaxelb/SHARE/assignees{/user}","branches_url":"https://api.github.com/repos/aaxelb/SHARE/branches{/branch}","tags_url":"https://api.github.com/repos/aaxelb/SHARE/tags","blobs_url":"https://api.github.com/repos/aaxelb/SHARE/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aaxelb/SHARE/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aaxelb/SHARE/git/refs{/sha}","trees_url":"https://api.github.com/repos/aaxelb/SHARE/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aaxelb/SHARE/statuses/{sha}","languages_url":"https://api.github.com/repos/aaxelb/SHARE/languages","stargazers_url":"https://api.github.com/repos/aaxelb/SHARE/stargazers","contributors_url":"https://api.github.com/repos/aaxelb/SHARE/contributors","subscribers_url":"https://api.github.com/repos/aaxelb/SHARE/subscribers","subscription_url":"https://api.github.com/repos/aaxelb/SHARE/subscription","commits_url":"https://api.github.com/repos/aaxelb/SHARE/commits{/sha}","git_commits_url":"https://api.github.com/repos/aaxelb/SHARE/git/commits{/sha}","comments_url":"https://api.github.com/repos/aaxelb/SHARE/comments{/number}","issue_comment_url":"https://api.github.com/repos/aaxelb/SHARE/issues/comments{/number}","contents_url":"https://api.github.com/repos/aaxelb/SHARE/contents/{+path}","compare_url":"https://api.github.com/repos/aaxelb/SHARE/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aaxelb/SHARE/merges","archive_url":"https://api.github.com/repos/aaxelb/SHARE/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aaxelb/SHARE/downloads","issues_url":"https://api.github.com/repos/aaxelb/SHARE/issues{/number}","pulls_url":"https://api.github.com/repos/aaxelb/SHARE/pulls{/number}","milestones_url":"https://api.github.com/repos/aaxelb/SHARE/milestones{/number}","notifications_url":"https://api.github.com/repos/aaxelb/SHARE/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aaxelb/SHARE/labels{/name}","releases_url":"https://api.github.com/repos/aaxelb/SHARE/releases{/id}","deployments_url":"https://api.github.com/repos/aaxelb/SHARE/deployments","created_at":"2016-07-09T17:06:26Z","updated_at":"2016-07-28T15:06:46Z","pushed_at":"2016-09-22T17:03:25Z","git_url":"git://github.com/aaxelb/SHARE.git","ssh_url":"git@github.com:aaxelb/SHARE.git","clone_url":"https://github.com/aaxelb/SHARE.git","svn_url":"https://github.com/aaxelb/SHARE","homepage":"","size":37886,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"09db5467b2cef93bbeb765bedea2093aa8019411","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":21280081,"name":"SHARE","full_name":"CenterForOpenScience/SHARE","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/SHARE","description":"SHARE is building a free, open, data set about research and scholarly activities across their life cycle.","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/SHARE","forks_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/releases{/id}","deployments_url":"https://api.github.com/repos/CenterForOpenScience/SHARE/deployments","created_at":"2014-06-27T15:19:21Z","updated_at":"2016-08-18T15:54:44Z","pushed_at":"2016-09-26T23:11:31Z","git_url":"git://github.com/CenterForOpenScience/SHARE.git","ssh_url":"git@github.com:CenterForOpenScience/SHARE.git","clone_url":"https://github.com/CenterForOpenScience/SHARE.git","svn_url":"https://github.com/CenterForOpenScience/SHARE","homepage":"http://share-research.readthedocs.io/en/latest/index.html","size":38388,"stargazers_count":39,"watchers_count":39,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":40,"forks":30,"open_issues":40,"watchers":39,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429"},"html":{"href":"https://github.com/CenterForOpenScience/SHARE/pull/429"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/429"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/issues/429/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/pulls/429/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/SHARE/statuses/aee324d9b5088f039634d90eba28484b89558413"}}}}
{"actor":{"display_login":"aaxelb"}}