github-wikidata-bot icon indicating copy to clipboard operation
github-wikidata-bot copied to clipboard

Accept repositories which are both preferred and normal ranked

Open davidhicks opened this issue 6 years ago • 4 comments
trafficstars

To cover the case where a software project has an official repository that is not GitHub, and this repository has a preferred rank, as well as an official GitHub mirror, which has a normal rank, I suggest a change to the query in free_software_items.rq to include GitHub repositories of either rank:

https://query.wikidata.org/#PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0A%0ASELECT%20%3Fproject%20%3FprojectLabel%20%3Frepo%20WHERE%20%7B%0A%20%20%23%20Items%20with%20a%20repo%20on%20github%0A%20%20%3Fproject%20p%3AP1324%20%5Bps%3AP1324%20%3Frepo%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wikibase%3Arank%20%3Frank%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D.%0A%0A%20%20%23%20Include%20both%20preferred%20and%20normal%20ranked%20repos%2C%20to%20capture%20mirrors%20of%20official%20repos%0A%20%20FILTER%28%3Frank%20IN%20%28wikibase%3APreferredRank%2C%20wikibase%3ANormalRank%29%29.%0A%0A%20%20%23%20Exclude%20projects%20not%20hosted%20on%20github%0A%20%20FILTER%28contains%28STR%28%3Frepo%29%2C%20%22%3A%2F%2Fgithub.com%2F%22%29%29.%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%7D%0A%7D%0AORDER%20BY%20LCASE%28%3FprojectLabel%29

davidhicks avatar Oct 10 '19 09:10 davidhicks

PREFIX schema: <http://schema.org/>

SELECT ?project ?projectLabel ?repo WHERE {
  # Items with a repo on github
  ?project p:P1324 [ps:P1324 ?repo;
                    wikibase:rank ?rank;
                   ].

  # Include both preferred and normal ranked repos, to capture mirrors of official repos
  FILTER(?rank IN (wikibase:PreferredRank, wikibase:NormalRank)).

  # Exclude projects not hosted on github
  FILTER(contains(STR(?repo), "://github.com/")).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY LCASE(?projectLabel)

davidhicks avatar Oct 10 '19 09:10 davidhicks

That's an interesting case! Do you have any projects specifically to which that would apply? Do those projects use github releases or would we only get tags?

konstin avatar Oct 20 '19 20:10 konstin

@konstin One example is Chromium, see https://www.chromium.org/developers/github-collaboration where an official mirror exists at https://github.com/chromium/chromium

Both releases and tags show up in GitHub for this project, but I suspect the releases are just placeholders created automatically from tags--it's the same information in each.

davidhicks avatar Feb 24 '20 22:02 davidhicks

Performing the change would enable the github-wikidata-bot on around 800 items:

SELECT ?project ?projectLabel ?repo ?bestRepo WHERE {
  ?project p:P1324 [ps:P1324 ?repo;
                    wikibase:rank ?rank;
                   ].

  FILTER(?rank IN (wikibase:PreferredRank, wikibase:NormalRank)).

  # Only include projects with a repo on GitHub
  FILTER(contains(STR(?repo), "://github.com/")).
  
  # Exclude projects with main repo on GitHub
  ?project wdt:P1324 ?bestRepo.
  FILTER(!contains(STR(?bestRepo), "://github.com/")).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}

Ordoviz avatar Sep 25 '23 13:09 Ordoviz