{"action":"created","comment":{"url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/comments/79816178","id":79816178,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\n+\n+namespace Wikibase\\DataModel\\Services\\EntityId;\n+\n+use Wikimedia\\Assert\\Assert;\n+use Wikibase\\DataModel\\Entity\\EntityId;\n+use Wikibase\\DataModel\\Entity\\EntityIdParser;\n+\n+/**\n+ * EntityIdParser that adds a fixed prefix and parses resulting string as an EntityId.\n+ * This can be used to prefix IDs of entities coming from a foreign repository\n+ * with the repository name to avoid clashes with IDs of local entities.\n+ *\n+ * @since 3.7\n+ *\n+ * @license GPL-2.0+\n+ */\n+class PrefixingEntityIdParser implements EntityIdParser {\n+\n+\t/**\n+\t * @var string\n+\t */\n+\tprivate $prefix;\n+\n+\t/**\n+\t * @var EntityIdParser\n+\t */\n+\tprivate $idParser;\n+\n+\t/**\n+\t * @param string $prefix Prefix to be added\n+\t * @param EntityIdParser $idParser\n+\t */\n+\tpublic function __construct( $prefix, EntityIdParser $idParser ) {\n+\t\tAssert::parameterType( 'string', $prefix, '$prefix' );\n+\t\t$this->prefix = $prefix;\n+\t\t$this->idParser = $idParser;\n+\t}\n+\n+\t/**\n+\t * Adds the prefix to the given string and parses the resulting string as an EntityId.\n+\t * If the string is already prefixed, the prefix is not duplicated (this check is case sensitive).\n+\t *\n+\t * @param string $idSerialization\n+\t * @return EntityId\n+\t */\n+\tpublic function parse( $idSerialization ) {\n+\t\t// Do not add prefix if $idSerialization already starts with it\n+\t\tif ( strncmp( $idSerialization, $this->prefix, strlen( $this->prefix ) ) !== 0 ) {","path":"src/EntityId/PrefixingEntityIdParser.php","position":49,"original_position":49,"commit_id":"7d1142aa5b5ffef8a988ad8fedd1f973052a9552","original_commit_id":"7d1142aa5b5ffef8a988ad8fedd1f973052a9552","user":{"login":"brightbyte","id":664717,"avatar_url":"https://avatars.githubusercontent.com/u/664717?v=3","gravatar_id":"","url":"https://api.github.com/users/brightbyte","html_url":"https://github.com/brightbyte","followers_url":"https://api.github.com/users/brightbyte/followers","following_url":"https://api.github.com/users/brightbyte/following{/other_user}","gists_url":"https://api.github.com/users/brightbyte/gists{/gist_id}","starred_url":"https://api.github.com/users/brightbyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightbyte/subscriptions","organizations_url":"https://api.github.com/users/brightbyte/orgs","repos_url":"https://api.github.com/users/brightbyte/repos","events_url":"https://api.github.com/users/brightbyte/events{/privacy}","received_events_url":"https://api.github.com/users/brightbyte/received_events","type":"User","site_admin":false},"body":"Oh, I completely missed this, and I think this is the cause for Thiemo's criticism: this is wrong. The prefix must ALWAYS by applied. If the repo we call \"foo\" sends us an Id with the prefix \"foo\" we can *not* assume that that's the same foo. We must add the prefix anyway, resulting in \"foo:foo:Q123\", meaning \"Q123 in the repo that the repo we call foo calls foo\". Confusing, but consistent :)  ","created_at":"2016-09-21T11:58:00Z","updated_at":"2016-09-21T11:58:09Z","html_url":"https://github.com/wmde/WikibaseDataModelServices/pull/146#discussion_r79816178","pull_request_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146","_links":{"self":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/comments/79816178"},"html":{"href":"https://github.com/wmde/WikibaseDataModelServices/pull/146#discussion_r79816178"},"pull_request":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146","id":85990037,"html_url":"https://github.com/wmde/WikibaseDataModelServices/pull/146","diff_url":"https://github.com/wmde/WikibaseDataModelServices/pull/146.diff","patch_url":"https://github.com/wmde/WikibaseDataModelServices/pull/146.patch","issue_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/146","number":146,"state":"open","locked":false,"title":"Add PrefixingEntityIdParser","user":{"login":"manicki","id":3524114,"avatar_url":"https://avatars.githubusercontent.com/u/3524114?v=3","gravatar_id":"","url":"https://api.github.com/users/manicki","html_url":"https://github.com/manicki","followers_url":"https://api.github.com/users/manicki/followers","following_url":"https://api.github.com/users/manicki/following{/other_user}","gists_url":"https://api.github.com/users/manicki/gists{/gist_id}","starred_url":"https://api.github.com/users/manicki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manicki/subscriptions","organizations_url":"https://api.github.com/users/manicki/orgs","repos_url":"https://api.github.com/users/manicki/repos","events_url":"https://api.github.com/users/manicki/events{/privacy}","received_events_url":"https://api.github.com/users/manicki/received_events","type":"User","site_admin":false},"body":"The parser can be used to prefix IDs of foreign entities with\r\na repository name.\r\n\r\nThis depends on https://github.com/wmde/WikibaseDataModel/pull/679 and tests will be failing until that PR is merged.\r\n\r\nAlso I just realized that his repository might not be a right location for the new parser. As it relies on a feature to be added in DataModel 6.2 (or so), having the parser here would break DataModelServices compatibility with any earlier DataModel versions. I guess we want to keep this broad compatibility. Should I rather put this parser in the DataModel repo?","created_at":"2016-09-20T14:44:13Z","updated_at":"2016-09-21T11:58:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b7cd06ea6ec05fb989195c6e2f1d4959f85f8c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146/commits","review_comments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146/comments","review_comment_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/146/comments","statuses_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/statuses/7d1142aa5b5ffef8a988ad8fedd1f973052a9552","head":{"label":"wmde:prefixing-entity-id-parser","ref":"prefixing-entity-id-parser","sha":"7d1142aa5b5ffef8a988ad8fedd1f973052a9552","user":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"repo":{"id":37833375,"name":"WikibaseDataModelServices","full_name":"wmde/WikibaseDataModelServices","owner":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wmde/WikibaseDataModelServices","description":"A collection of services around Wikibase DataModel","fork":false,"url":"https://api.github.com/repos/wmde/WikibaseDataModelServices","forks_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/forks","keys_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/teams","hooks_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/hooks","issue_events_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/events{/number}","events_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/events","assignees_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/assignees{/user}","branches_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/branches{/branch}","tags_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/tags","blobs_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/refs{/sha}","trees_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/statuses/{sha}","languages_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/languages","stargazers_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/stargazers","contributors_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/contributors","subscribers_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/subscribers","subscription_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/subscription","commits_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/commits{/sha}","git_commits_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/commits{/sha}","comments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/comments{/number}","issue_comment_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/comments{/number}","contents_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/contents/{+path}","compare_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/merges","archive_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/downloads","issues_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues{/number}","pulls_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls{/number}","milestones_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/milestones{/number}","notifications_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/labels{/name}","releases_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/releases{/id}","deployments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/deployments","created_at":"2015-06-22T01:47:49Z","updated_at":"2016-01-11T19:00:14Z","pushed_at":"2016-09-21T09:28:12Z","git_url":"git://github.com/wmde/WikibaseDataModelServices.git","ssh_url":"git@github.com:wmde/WikibaseDataModelServices.git","clone_url":"https://github.com/wmde/WikibaseDataModelServices.git","svn_url":"https://github.com/wmde/WikibaseDataModelServices","homepage":"http://wikiba.se","size":301,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"base":{"label":"wmde:master","ref":"master","sha":"f1e55eaa29bb6fb1d2684beb93ff12f29ec7228d","user":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"repo":{"id":37833375,"name":"WikibaseDataModelServices","full_name":"wmde/WikibaseDataModelServices","owner":{"login":"wmde","id":664724,"avatar_url":"https://avatars.githubusercontent.com/u/664724?v=3","gravatar_id":"","url":"https://api.github.com/users/wmde","html_url":"https://github.com/wmde","followers_url":"https://api.github.com/users/wmde/followers","following_url":"https://api.github.com/users/wmde/following{/other_user}","gists_url":"https://api.github.com/users/wmde/gists{/gist_id}","starred_url":"https://api.github.com/users/wmde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wmde/subscriptions","organizations_url":"https://api.github.com/users/wmde/orgs","repos_url":"https://api.github.com/users/wmde/repos","events_url":"https://api.github.com/users/wmde/events{/privacy}","received_events_url":"https://api.github.com/users/wmde/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wmde/WikibaseDataModelServices","description":"A collection of services around Wikibase DataModel","fork":false,"url":"https://api.github.com/repos/wmde/WikibaseDataModelServices","forks_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/forks","keys_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/teams","hooks_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/hooks","issue_events_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/events{/number}","events_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/events","assignees_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/assignees{/user}","branches_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/branches{/branch}","tags_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/tags","blobs_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/refs{/sha}","trees_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/statuses/{sha}","languages_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/languages","stargazers_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/stargazers","contributors_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/contributors","subscribers_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/subscribers","subscription_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/subscription","commits_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/commits{/sha}","git_commits_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/git/commits{/sha}","comments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/comments{/number}","issue_comment_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/comments{/number}","contents_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/contents/{+path}","compare_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/merges","archive_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/downloads","issues_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues{/number}","pulls_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls{/number}","milestones_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/milestones{/number}","notifications_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/labels{/name}","releases_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/releases{/id}","deployments_url":"https://api.github.com/repos/wmde/WikibaseDataModelServices/deployments","created_at":"2015-06-22T01:47:49Z","updated_at":"2016-01-11T19:00:14Z","pushed_at":"2016-09-21T09:28:12Z","git_url":"git://github.com/wmde/WikibaseDataModelServices.git","ssh_url":"git@github.com:wmde/WikibaseDataModelServices.git","clone_url":"https://github.com/wmde/WikibaseDataModelServices.git","svn_url":"https://github.com/wmde/WikibaseDataModelServices","homepage":"http://wikiba.se","size":301,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146"},"html":{"href":"https://github.com/wmde/WikibaseDataModelServices/pull/146"},"issue":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/146"},"comments":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/wmde/WikibaseDataModelServices/statuses/7d1142aa5b5ffef8a988ad8fedd1f973052a9552"}}}}
{"actor":{"display_login":"brightbyte"}}