Property talk:P2671

From Wikidata
Jump to navigation Jump to search

Documentation

Google Knowledge Graph ID
identifier for Google Knowledge Graph API, starting with "/g/". For IDs starting with "/m/", use Freebase ID (P646)
Data typeExternal identifier
Domainentity (Q35120), person (Q215627) or human (Q5)
Allowed values/g/1(?:[1258dhjnpqrstvwxyz][0-9b-df-hj-np-tv-z_]{6,8}|3b[013-9b-df-hj-np-tv-z_]{4}|3z[2356gmpqwz_]{6})
Usage notesTo find the Google Knowledge Graph ID, open the page source and search for "/g/XXXX" where XXXXX is the ID
ExampleAlphabet Inc. (Q20800404)/g/11bwcf511s (RDF)
Werner Krauss (Q88832)/g/121s45zf (RDF)
Thethaotocdo (Q115667786)/g/11sdhs5sgn (RDF)
Sourcehttps://developers.google.com/knowledge-graph/
https://angryloki.github.io/mreid-resolver/
https://greasyfork.org/en/scripts/457413-google-knowledge-graph-id
Formatter URLhttps://www.google.com/search?kgmid=$1
https://g.co/kg$1
http://web.archive.org/*/www.freebase.com$1
https://www.google.com/search?kgmid=$1&hl=en
https://trends.google.com/trends/explore?q=$1
https://www.google.com/search?kponly&kgmid=$1&hl=en
https://freebase.toolforge.org/google$1 (Works reliably only for the English locale)
See alsoFreebase ID (P646), Google Fonts ID (P10687), Google Arts & Culture entity ID (P10297), Google Arts & Culture asset ID (P4701), Google Arts & Culture partner ID (P4702), Google Scholar author ID (P1960), Google Books ID (P675), Google Play Movies & TV ID (deprecated) (P6562), Google News topics ID (P5337), Google Maps Customer ID (P3749), Google Scholar paper ID (P4028), Google Scholar case ID (P8008), Google Play Store app ID (P3418), Google+ ID (P2847)
Lists
Proposal discussionProposal discussion
Current uses
Total7,552,387
Main statement7,547,909>99.9% of uses
Qualifier5<0.1% of uses
Reference4,473<0.1% of uses
Search for values
[create Create a translatable help page (preferably in English) for this property to be included here]
Distinct values: this property likely contains a value that is different from all other items. (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2671#Unique value, SPARQL (every item), SPARQL (by value)
Scope is as main value (Q54828448), as reference (Q54828450): the property must be used by specified way only (Help)
List of violations of this constraint: Database reports/Constraint violations/P2671#Scope, hourly updated report, SPARQL
Allowed entity types are Wikibase item (Q29934200): the property may only be used on a certain entity type (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2671#Entity types
Type “entity (Q35120), person (Q215627), human (Q5): item must contain property “instance of (P31), subclass of (P279)” with classes “entity (Q35120), person (Q215627), human (Q5)” or their subclasses (defined using subclass of (P279)). (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2671#Type Q35120, Q215627, Q5, SPARQL
Format “/g/1(?:[1258dhjnp-tv-z_][0-9b-df-hj-np-tv-z_]{6,8}|3b[013-9b-df-hj-np-tv-z_]{4}|3z[12356fglmpqwxz_]{6})|: value must be formatted using this pattern (PCRE syntax). (Help)
Exceptions are possible as rare values may exist. Exceptions can be specified using exception to constraint (P2303).
List of violations of this constraint: Database reports/Constraint violations/P2671#Format, SPARQL
Pattern ^(https://www\.google\.com/search\?kgmid=)?/?(m/0[0-9a-zA-Z_]{2,7})(&hl)?$ will be automatically replaced to /\2 and moved to Freebase ID (P646) property.
Testing: TODO list
Pattern ^(g/[0-9a-zA-Z_]{8,10})(&hl)?$ will be automatically replaced to /\1.
Testing: TODO list
Pattern ^(/g/[0-9a-zA-Z_]{8,10})&hl$ will be automatically replaced to \1.
Testing: TODO list

Please notify projects that use this property before big changes (renaming, deletion, merge with another property, etc.)

Identifiers with m[edit]

shall they be deleted? Queryzo (talk) 21:06, 15 October 2016 (UTC)[reply]

they should be moved to Freebase ID (P646) --Pasleim (talk) 21:08, 15 October 2016 (UTC)[reply]
so I can delete it here: Waldorf Astoria Berlin (Q220141)? Queryzo (talk) 22:22, 15 October 2016 (UTC)[reply]

Allowed values regexp seems incorrect[edit]

The specified allowed values (\/g\/[0-9a-zA-Z]+) would not produce a valid KG URL given the Formatter URL of (https://g.co/kg$1). To produce a valid KG URL allowed values should be (s\/[0-9a-zA-Z]+). Looking at the first example I found with the P2671 property, i.e. Q34627, it does indeed have the value to produce a correct URL s\/GDiHEp, however according to P2671 this is not an allowed value.  – The preceding unsigned comment was added by Neilireson (talk • contribs) at 12:21, 30 June 2017 (UTC).[reply]

The links starting with s just seem to short URLs generated dynamically when you click the 'share' button on a card in Google Search, which incidentally use the same https://g.co/kg$1 format but are not really the permanent IDs used in the Knowledge Graph (the short URLs change every time you refresh the page). The proper IDs start with either /m in which case it seems Freebase ID (P646) should be used or /g in which case this property should be used, the only distinction being that the former IDs were also used in the (now deprecated) Freebase API.
I think the current regular expression therefore is correct, and that the constraint violations should be solved either by copying the value to Freebase ID (P646) if it starts with /m or by obtaining the permanent ID (appears in the expanded URL as kgmid) and inserting it into the correct property. Victor LP (talk) 12:37, 8 July 2017 (UTC)[reply]

Conflict constraint with Freebase ID (P646)?[edit]

Considering my comment above, a conflict constraint between Google Knowledge Graph ID (P2671) and Freebase ID (P646) might be useful to add. I could only find a few items that currently have both, so it seems not a common occurrence, and for most cases there seems to be one incorrect/deprecated ID, or the IDs refer to a slightly different version of the item (think multiple editions of a book).

I think the conflict constraint is actually equivalent to the unique value constraint that already exists on both properties, since the only distinction between them seems to be a historical one by now (whether the ID was present in the Freebase database). Of course exceptions to the constraint would be allowed, but adding it formalizes the uniqueness of the ID and makes it easier to track errors across both properties. Victor LP (talk) 07:33, 17 July 2017 (UTC)[reply]

As mentioned on my talk page: " Interesting idea indeed. Maybe something to discuss on the property talk page. It seems odd that some have both. Maybe eventually most will end up having a /g/ and Freebase will remain mostly as historic. To some extent it captures the same as the format constraint (and the description displayed when users add it). Not sure if people who don't get that will get this and not remove the few exceptions." (please excused that I quote myself).
I noticed that Freebase ID (P646)'s description includes the format, but this lacks it. Maybe this would be sufficient.
Other than the items that should have both, are there any cases where we actually have both and it can't be solved by merely moving /m to the other property? If not, I think we should actually encourage people to add both.
--- Jura 12:27, 18 July 2017 (UTC)[reply]
I just added a Google Knowledge Graph ID (P2671) to Lidl (Q151954) in addition to Freebase ID (P646) since it looks like that Google nowadays moved away from Freebase and mainly uses it's own system. I still believe there is value in having the Freebase IDs but I believe the conflict constraint should be lifted. User:VorticonCmdr 19:33, 29 January 2021 (UTC)[reply]
@VorticonCmdr: I've added reason for deprecated rank (P2241) redirect (Q45403344) to freebase statement. You can check that Freebase entity does not exist anymore by visiting https://angryloki.github.io/mreid-resolver/#/m/01qlgk and https://angryloki.github.io/mreid-resolver/#/g/11c3wz1812 . There is a hidden logic behind this: all Lidl-related page must be associated with a single id by Googlebot; otherwise search index and news items will be splitted where they should not be. --Lockal (talk) 19:46, 29 January 2021 (UTC)[reply]

@Victor LP, VorticonCmdr, Jura1, Lockal: There is no conflict between Google id an Freebase id. Lockal is confusing a resolver (which may be partial, obsolete, broken) and the IDs themselves. Here are some examples, using the current formatterURLs (whcih are both at google):

All of these lead to similar but not identical pages about the items (both on google). Which one is better, and whether there was a global preference, is a matter of discussion. But Wikidata cannot express something like "value g of identifier G is preferred to value m of identifier M": if the /m identifiers are valid, then we should keep them. Some stats in Wikidata:

  • 7.4M have /g
  • 4.4M have /m
  • 20k have both, of which only 12 are added as exceptions: so that Constraint page is cluttered by these violations, and one cannot see the other (real) violations

Unless you object, I'll remove the "Conflicts with" constraint. --Vladimir Alexiev (talk) 14:02, 12 January 2024 (UTC)[reply]

I have no stake at this but I want to point out the looking at the german google search result page for the Lidl IDs one knowledge panel simply states "Lidl" (/g/11c3wz1812) while the other is "Lidl Stiftung & Co. KG (Lidl)" (/m/01qlgk) for me. When adding language and country parameters &hl=de&gl=DE it gets even more confusing because one panel disappears while the other changes to "Lidl" (a different one). Just something I cannot explain. VorticonCmdr (talk) 15:36, 12 January 2024 (UTC)[reply]

Link not working[edit]

Hi, the link provided with this property is no longer working. The problem is the string "knowledge+graph+search+api" passed as argument of the query: the name of the node has to be used. In addition to that, the value passed for the parameter kgmid is became irrelevant: any idea how to fix it? Pietro (talk) 11:36, 14 January 2019 (UTC)[reply]

Links not working?[edit]

It appears that the auto-generated links are all broken. They all show "Your search - knowledge graph search api - did not match any documents." without the knowledge graph card.  – The preceding unsigned comment was added by SixTwoEight (talk • contribs).

A few days ago it was reported that google search results can be spoofed by using an alternative google knowledge graph, see google knowledge graph spoof as google search. maybe they deactivated direct acces to google knowledge graph as answer to this.  – The preceding unsigned comment was added by Queryzo (talk • contribs).
Thank you for these explanations! It breaks also the links on the Google Knowledge Graph Search API. @Denny, DanBri: Do you know more about this problem? If there any plan to make https://g.co/kg/ links work again ? Tpt (talk) 10:28, 20 January 2019 (UTC)[reply]
As reported, it could be used in a cynical way where the search query did not match the knowledge graph result. e.g. a query for "who was the first man on the moon" and a knowledge graph result for Elvis Presley. Due to this, I very much doubt Google will change it back to original behaviour. 1) Searching without a search term redirects to the home page: https://www.google.com/search?kgmid=%2Fm%2F04wv_ 2) Providing a spurious search term shows the knowledge graph for that term: https://www.google.com/search?q=cheese&kgmid=%2Fm%2F04wv_ 3) If you can provide a search term that would normally return that knowledge graph result, you get the original behaviour: https://www.google.com/search?q=the+moon&kgmid=%2Fm%2F04wv_ ... the links used here would work if the knowledge graph label was also provided with the knowledge graph MID, subject to how Google decides if a term should be shown for that MID. "&kgonly" also appears to be deprecated.  – The preceding unsigned comment was added by Galalean (talk • contribs).
I've just removed the formatter URL "https://g.co/kg$1". --Epìdosis 14:23, 3 February 2019 (UTC)[reply]
I have added it back as "deprecated" to keep it has "historical". I have added as "normal" formatter URL a link to the Freebase wayback machine because some /g/ ids where also in Freebase. I'm currently loading a part of Freebase last dump to Wikimedia ToolsForge database to get a basic UI on Freebase content. Here is a WIP example (beware, not all data is loaded yet). Tpt (talk) 11:24, 4 February 2019 (UTC)[reply]
Is there a way to modify the existing structure so that instead of just the Freeebase ID or the Google Knowledge Graph ID (kgmid), the URL includes the Wikidata Item Label as well (after the search query parameter 'q=')? (e.g. https://www.google.com/search?q=Cate+Blanchette&kponly&kgmid=/m/0154qm --Omert33 (talk) 17:22, 5 February 2019 (UTC)[reply]
It's definitely possible using a gadget but it does not solve fully our problem: the kgmid parameter is going to be ignored and the displayed panel choosen based on the label, leading to possible discrepencies in case, e.g., there are two entities with the same label. Tpt (talk) 14:46, 6 February 2019 (UTC)[reply]
The kgmid is not ignored, kgonly is. If kgmid satisfies Google as being related to the label used, it will return that kgmid knowledge graph  – The preceding unsigned comment was added by Galalean (talk • contribs).
Indeed. Thank you for the tip. For example https://www.google.com/search?q=Iron+Man&kgmid=/m/0hnws links to the super hero panel even if https://www.google.com/search?q=Iron+Man links to the movie. We could add something to the Authority control gadget to fix these links. Tpt (talk) 09:58, 18 February 2019 (UTC)[reply]
I have setup a proxy that retrives the English label from Wikidata and then redirects to Google Search. Example https://tools.wmflabs.org/freebase/google/m/0hnws. I have updated the "url formatter" to use it. Tpt (talk) 14:21, 18 February 2019 (UTC)[reply]
There's a data dump at https://developers.google.com/freebase/, so in theory a mirror service could be created. Ghouston (talk) 22:01, 8 February 2019 (UTC)[reply]

Links working again[edit]

Looks like Google has allowed the Knowledge Graph to be shown independent of the search. The then deprecated formatting URL of https://g.co/kg$1 now works again. — Jeluang Terluang (talk) 03:33, 14 June 2020 (UTC)[reply]

Both https://g.co/kg$1 and https://freebase.toolforge.org/google$1 do now work when browser locale is set to Russian for David Cameron (Q3017607) - it redirects to search by "Дэвид Камерон", which seems to override kgmid parameter, and shows knowledge box about British Prime Minister instead. But adding &hl=en solves the issue. g.co also adds q=knowledge+graph+search+api, which might be some kind of magic string, but with "&hl=en" "&q=" seems to be ignored. With Russian browser locale:
https://www.google.com/search?q=knowledge+graph+search+api&kponly&kgmid=/g/12148r5j&hl=en - jurist (card only)
https://www.google.com/search?q=vladimir+putin&kponly&kgmid=/g/12148r5j&hl=en - jurist (card only)
https://www.google.com/search?kgmid=/g/12148r5j&hl=en - jurist
https://www.google.com/search?q=knowledge+graph+search+api&kponly&kgmid=/g/12148r5j - bad, "Дэвид Камерон", Prime minister (behaviour of g.co/kg$1 redirector)
https://www.google.com/search?kgmid=/g/12148r5j&q=David+Cameron - bad, "Дэвид Камерон", Prime minister (behaviour of https://freebase.toolforge.org/google$1 redirector)
https://www.google.com/search?kgmid=/g/12148r5j - bad, "Дэвид Камерон", Prime minister
So I'll set default url to https://www.google.com/search?kponly&kgmid=$1&hl=en and I hope it should work for all cases. If it does not work, the only remaining solution would be https://developers.google.com/knowledge-graph/reference/rest/v1, unfortunately, which requires API key. --Lockal (talk) 15:03, 21 November 2020 (UTC)[reply]
Update: "kponly" breaks output for mobile browsers (unless Desktop mode is enabled), so I'll remove it. --Lockal (talk) 07:03, 25 November 2020 (UTC)[reply]

Use of hl=en in Google urls[edit]

Is there a reason to forcibly link the english version (hl=en) instead of letting the user get automatically the language version? --Onwa (talk) 22:56, 10 February 2021 (UTC)[reply]

Apparently there are some issues with non-English locales. See Property talk:P646#Default_formatter_is_set_to_google.com.--C960657 (talk) 21:38, 16 February 2021 (UTC)[reply]

lack of other statements on items[edit]

Just came across a series of items that didn't have any other statements than P2671. I was wondering if the presence of P2671 occults the fact these items lack other statements.

I tried to count how many there are, but the following query times out:

SELECT (COUNT(*) as ?count)
{
  ?item wikibase:statements 1 . 
  ?item wdt:P2671 [] .
}
Try it!

Maybe a good approximation is the following:

This currently gives 867,010.

In addition:

has 237,228.

It would be good to populated these somehow, maybe similarly to how User:NoclaimsBot does for those without any statements. --- Jura 13:37, 13 December 2021 (UTC)[reply]

MREID Resolver does not seem to work anymore[edit]

The website does not load and it throws a JS error. What should we do with the reference to this app in the property? --Onwa (talk) 15:17, 23 September 2022 (UTC)[reply]

Which browser do you use? I've recently rewrote MREID Resolver from Svelte+Bootstrap to Sveltekit+Tailwind, but it still works in recent versions of Edge/Firefox/Chrome. Lockal (talk) 10:34, 15 October 2022 (UTC)[reply]
I tested it in Firefox 89 and still does not work. Onwa (talk) 21:47, 1 November 2022 (UTC)[reply]

Regex[edit]

If I click at Q-item Samsung Series 7 Slate (Q104845972) on the Google Knowledge Graph ID, I see a Google page about that topic. So the Google Knowledge Graph ID /g/18v12mt is valid. According to the Google Knowledge Graph ID (P2671) property regex rules that string is not valid. How can that be fixed? Robotje (talk) 09:54, 12 February 2023 (UTC)[reply]

For Samyang 24mm f/1.4 ED AS UMC (Q24912704) the Google Knowledge Graph ID /g/1_f9_d5c also seems to be not matching the regex rules but if I click on it it works OK. - Robotje (talk) 06:47, 21 February 2023 (UTC)[reply]
Same for StepManiaX (Q106860786) where /g/13zp6flx1 is working OK. - Robotje (talk) 12:27, 25 February 2023 (UTC)[reply]