Wikidata talk:WikiProject Chemistry/Archive/2023

From Wikidata
Jump to navigation Jump to search

Metaclasses for chemical entities and using instance of (P31)/subclass of (P279)

This discussion is not meant to resolve the classification problems of chemical entities (like how anions or tautomers should be classified regarding chemical classes or how to define 'chemical compound'), only to determine the basics in terms of using instance of (P31) and subclass of (P279) in items about chemical entities.

I. Proper metaclasses for all chemical entities

From the beginning of mass imports of chemical data to Wikidata, the basis for chemical entities was instance of (P31)chemical compound (Q11173). This statement was added to every item describing chemical entity, regardless of the nature of chemical entity described, and served as a metaclass for all chemical entities. However, it is also a regular class in chemical classification (was present in some items describing classes of compounds as subclass of (P279)chemical compound (Q11173)) and is not true for some chemical entities. The need for a metaclass for chemical entities is quite obvious:

  1. it helps to retrieve data about all chemical entities in Wikidata, check their completeness, create reports and statistics, make it easier to create appropriate constraints in properties;
  2. it also helps users to understand the concept that is described in a specific item, facilitating the selection of appropriate items and preventing some of the incorrect edits resulting from misunderstanding the content of an item.

The current chemical compound (Q11173) pseudo-metaclass fails to do so for the following reasons:

  1. it is not applicable for many chemical entities, like simple substances, some radicals, ions;
  2. it is a part of chemical classification, in some situations it appears to be redundant while it is present alongside its subclasses — this also creates confusion to users who do not understand why a superclass should be present in an item;
  3. there are many borderline cases regarding chemical compound (Q11173) where we are not sure whether or not some chemical entity can be properly classified as chemical compound or not.

None of the items like chemical entity (Q43460564), molecular entity (Q2393187), chemical species (Q899336) or chemical substance (Q79529) seems to be adequate metaclass for chemical entities as all are a part of chemical classification at some point.

Proposition I

Introducing two groups of metaclasses for chemical entities:

  1. type of chemical entity (Q113145171) — for all stereochemically or isotopically defined chemical entities; it would replace all instance of (P31)chemical compound (Q11173) statements in items about chemical entities and would be added to all entities that now lacks such statement (like some ions or items in which users deleted such statement due to the confusion described above).
  2. class of chemical entities metaclass — for all items that describes groups or classes of chemical entities; some metaclasses are already present under an ill-named group or class of chemical entities (Q72070508) that covers metaclasses for both open classes and closed classes.

In other words: an item describing chemical entity(ies) should be modelled either as a type of chemical entity or as a class of chemical entities

Open vs closed class

This distinction results from a ChEBI ontology (described in their documentation), while it is in some way present in other databases. It helps in determining what kind of class is described in an item and how numerous this class can be. In short:

  • open class — class of chemical entities that have an infinite number of possible members
  • closed class — class of chemical entities that have restricted number of members, usually limited to a few members.

Example:

II. Using subclass of (P279) in items about chemical entities

Statements related to chemical, medical, biological, industrial etc. classification of chemical entities are now spitted between a number of properties. Sometimes the same class is added to items using different properties what is causing problems with querying and curating the data.

Proposition IIa

In items about chemical entities limit the use of subclass of (P279) to chemical classes only. For other classes use has use (P366), subject has role (P2868) or other more specific property.

In other words:

Proposition IIb

In items about chemical entities the use of subclass of (P279) should be abandoned. Other, more specific properties should be used instead.

Chemical classification should be added using new property, like chemical classification or higher class in chemical classification etc. (chemical classificationsubproperty of (P1647)subclass of (P279)). Other classes should be added using properties mentioned in proposition IIa:

This proposal does not exclude the need to create additional properties for specific uses, e.g. based on MeSH or ChEBI relations (biological role for example).

Rationale, possible problems

– This is already true for many statements related to pharmacology as usually subject has role (P2868) is used for such situations. The main reason for this change is to separate different groups of statements which are now added in a variety of ways, none of which are entirely wrong.
– There may be some borderline cases in which both subject has role (P2868) and has use (P366) could be used. It would require an arbitrary decision in this case which one should be used.
– Moving medication (Q12140) from instance of (P31) to other properties may require creating a separate metaclass for pharmacological entities.

III. Using has part(s) (P527) for atomic composition

Property has part(s) (P527) is used now for a variety of things, from elemental composition, functional group, type of bonds, rings etc., but in case of chemical composition it is redundant and IMO factually wrong.

– There are already classes like carbon compound (Q2901852) which cannot be removed from the classification tree and are superclasses of many items.
– Elemental composition can be also easily retrieved from the chemical formula (P274).
– It's not true that chemical entityhas part(s) (P527)chemical element – it 'has part' atom(s) of chemical element, sometimes it 'has part' ion(s) etc.

Proposition III

Accept the recommendation to eliminate over time all statements like chemical entityhas part(s) (P527)chemical element in favour of proper superclasses like compound of X (chemical element) added either directly do the item or somewhere higher in the classification, and using chemical formula (P274) (regex) for this purpose.

Discussion

As English is not my first language, there may be some ambiguities for which I am sorry. Establishing clear rules, especially with regard to point I, seems to me very important as we don't have a way to retrieve all the needed data, as some items have instance of (P31) = 'chemical compound', in some this statement was modified (rightly or not) or deleted; in many situations this statement is wrong (e.g. for simple substances). As for the point II, I would prefer option IIa, it seems more consistent, it is already present in some items and it would not require the creation of another property. I hope we can resolve the above problems and work out the best solution through discussion here. Wostr (talk) 15:40, 8 July 2022 (UTC)

 Support for I, IIa and III. I'm intrigued by your open vs closed class issue - this is a useful distinction I hadn't had a way to think clearly about before, and I suspect we ought to think about it more widely in Wikidata. I still don't think this quite settles the issue of "molecule" vs "substance" or the implied context of a particular chemical entity - where would something like nitrate ion (Q182168) fit here? ArthurPSmith (talk) 17:58, 8 July 2022 (UTC)
@ArthurPSmith: the distinction between open and closed class is not mine and it is not unambiguous in all cases (there may be some borderline cases in which both metaclasses seem to be correct), however, I think it does more good than harm, as we have classes like chlorobenzene (Q1075329) and chlorobenzene (Q72697380). Right now I don't use 'open' and 'closed' terms in labels, I chose 'class' vs 'group' (as in e.g. 'structural class of chemical compounds' vs 'group of isomers') – it seems quite intuitive in my language, however, I don't know if it is also intuitive in English. These propositions do not intend to settle any issue about the chemical classification of items – this is more complex issue and right now I'd like to focus on more basic issue that would allow us to cleanup the items a little bit, help us in organisation and curation of data. The non-existent yet metaclass 'type of chemical entity' is based on the ChEBI definition of 'chemical entity' (that is not equal to the definition of 'molecular entity') and covers both molecular entities, functional groups and chemical substances. So, distinction between molecular entity and chemical substance is not so important in this proposition; nitrate ion (Q182168) would have P31 = 'type of chemical entity' and all classes that are now added via P31 moved to P279 – these classes would define whether the item describes a molecular entity or chemical substance. Wostr (talk) 19:26, 9 July 2022 (UTC)
Ok with IIa. For Proposition I, I don't like the proposition of classifying by creating abstract classes unknown by any casual contributors. I only support classification based on definition. Please provide the definition of chemical compound first before saying that we can't use this term as classification criterion. What is the definition of chemical entity (Q43460564), molecular entity (Q2393187), chemical species (Q899336) or chemical substance (Q79529) ? People are using those terms without any understanding of the concept because we propose no good, clear definition. So instead of providing better definition, we add new concepts which are creating more complexity and will fail to solve the classification problem.
If we accept the following definition chemical substance (Q79529) = "Matter of constant composition best characterized by the entities (molecules, formula units, atoms) it is composed of. Physical properties such as density, refractive index, electric conductivity, melting point etc. characterize the chemical substance." (IUPAC) and that chemical compound (Q11173) is a subclass of chemical substance (Q79529), with the difference that chemical compound (Q11173) has an additional property which is the fact that chemical compound (Q11173) has to be composed of several different elements. Derived from the definition of chemical substance (Q79529), chemical compound (Q11173) has to have physical properties so ions and radicals can't be defiend as instance or subclass of chemical compound (Q11173) because they can't be isolated in order to measure some physical properties.
We have concepts like chemical substance (Q79529), pure substance (Q578779), chemical compound (Q11173), simple substance (Q2512777), why can't we create an classification using them and based on their definition ?
And any good classification should not be chosen based on one single example but by creating a coherent network between entities: how can we link water (Q283), heavy water (Q155890), tritiated water (Q424236), methanol (Q14982), diiodine (Q2064483), butan-1-ol (Q16391), (+)-2-butanol (Q27104553), (R)-2-Butanol (Q70731894), (E)-cinnamic acid (Q164785), cis-cinnamic acid (Q4062664),... Snipre (talk) 19:58, 18 July 2022 (UTC)
@Snipre: As I wrote in the propositions: definitions of 'chemical compound' etc. are not needed here, because these concepts are to be used (or not) in chemical classification, not as metaclasses, and this is not a discussion at all about what their definitions should be, it is irrelevant. The problem is that right now 'chemical compound' is used both as a metaclass (P31) and as a regular chemical class (P279), it is used inconsistently and in fact it does not allow any meaningful operation to be performed on the data set. So the problem is not how to define these concepts, just to introduce a new metaclass to cover all the concepts that interest us. We already have chemical entity (Q43460564) which is a superclass of most concepts, the proposition is to introduce a new metaclass type of chemical entity (Q113145171) to be added as P31 instead of a mismatched and questionable 'chemical compound', as you can't have it both in P31 and P279. The chemical classification in P279, as in proposition II, can then include all sorts of concepts, including or not 'chemical compound', 'chemical substance', 'molecular entity' – but that is not a discussion about the chemical classification and the definitions of such concepts. Wostr (talk) 08:18, 19 July 2022 (UTC) PS As to I don't like the proposition of classifying by creating abstract classes unknown by any casual contributors – we already have a lot metclasses like this (astronomical object type (Q17444909), disease of a particular individual (Q112193769) vs class of disease (Q112193867)). In ChEBI we also have such metaclasses, but are not a visible part of this database and given the scope of ChEBI, type of chemical entity (Q113145171) is not needed there, as all entries have chemical entity (Q43460564) as a superclass. Wostr (talk) 08:23, 19 July 2022 (UTC)
 Comment 1. I understand the issue, but I am not scholared enough to help. Indeed, more structure is helpful. -DePiep (talk) 10:24, 19 July 2022 (UTC)
Moved my sideissue from here into dedicated section #Simple substances and allotropes. -DePiep (talk) 06:44, 23 July 2022 (UTC)
 Support Thanks for working this out. A always like the use of "role" in ChEBI and adopting this in Wikidata makes sense. Chemistry in Wikidata has been one of my side projects, and some of the guiding principles I have tried to convert to shape expressions. We should aim at doing that for all rules. That way, we can continue to introduce structure and have these rules and shapes help us curate all the data (e.g. I quite lost the overview of all types of classes we have). One question however (and no show stopper), what should we do when Wikipedia does not align well with these aspects? Because all these questions tend to come and apply to Wikipedia too. How should we handle the sitelinks? --Egon Willighagen (talk) 05:42, 25 July 2022 (UTC)
@Egon Willighagen: the question about sitelinks is much more related to the problem described here rather than to this discussion. Changing the main metaclass for chemical entities (like in Proposition I) does not affect Wikipedia sitelinks, nor the rest of the propositions. It may however allow a better display of chemical classification in Commons infoboxes, maybe some day it may allow to present chemical classification in Wikipedia articles or help with categorisation, because right now – with lack of any guidelines in this matter – we have quite a mess. And as to the problem described on the page linked by me befohttps://www.ebi.ac.uk/ols/ontologies/chebi/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FCHEBI_24431&lang=en&viewMode=All&siblings=falsere: I don't think it can be solved easily and never really solved. I always try to move the sitelinks to the item which is the closest equivalent of the Wikipedia articles, but even in the simplest example (two items describing each enantiomer, item describing the structure with undefined stereocenter i.e. 'group of stereoisomers' and an item describing a racemate; Wikipedias describing it all in one article) you always have to make a compromise. Some solution to this would be creating redirects in Wikipedias, but as I wrote, this would be a solution, but only a partial one. Wostr (talk) 08:35, 25 July 2022 (UTC)
Exactly what I was thinking about: "this would be a solution, but only a partial one.". I do think it is related to the page you link to. As said, I am happy with this step, though could have made that more clear (sorry). I would also support the idea to accept that some Wikipedia pages for chemicals do not have a one-to-one page in Wikidata. I'm looking forward to seeing where this goes. --Egon Willighagen (talk) 06:29, 28 July 2022 (UTC)


  •  Comment @Wostr: Thank you for organizing this.

I mostly  Support IIb, it is a clear organization. We may use subclass of (P279) for relations that are still missing dedicated properties (e.g. every real-world molecule of the class levomethadone (Q6535776) is also of the class (RS)-methadone (Q179996)). But for all other cases, I agree with Wostr.

But I have to  Oppose Proposal I; the names "type" and "class" are often used interchangeably in ontology management. All chemical entities on Wikidata are groups or classes or types, as they describe several real-world, three-dimensional molecules. You can see "ethanol" is a very closed class, with only one member.

There are differences in the way we see concepts like alcohols (Q156) and ethanol (Q153), but they are both classes; and more importantly, they both have a series of properties in common.

I'd propose IV:

Why? ChEBI structures its ontology in that way; they share properties on Wikidata which currently have multiple domains (e.g. see https://www.wikidata.org/wiki/Property:P233#P2302);by having a shared P31 for all chemical entities we can easily pull out the chemical domain of Wikidata. To simplify the mapping.

  • IVb - Additional P31 values for atoms osmium (Q751), highlighting their nature as a chemical entity and the other as the distinction as an atom. Other equally distinctive typing values like functional group (Q170409) could also receive additional values

Why? Because we still want to query directly for the most specific types; because we don't want to break old systems.

  • IVc - Additional P31 values for differing between what we see as "chemical compounds" and "chemical classes" to split (e.g. alcohols (Q156) and ethanol (Q153)) one top IVa. \

Why? Because we still want to differentiate and searchwhat we see as "chemical compound" from what we see as "chemical class", as chemical compounds have e.g. a defined molecular weight, as outlined in the original proposal

Why? To keep using Wikidata standard infrastructure and simplify modelling.The community is not always receptive for new "subclass of"-like properties (https://www.wikidata.org/wiki/Wikidata:Property_proposal/part_of_molecular_family)

Generally, I believe that having single P31 values works very well for human (Q5), but might not be fit for all knowledge domains. Maybe we can unify chemical entities with some flexibility for additional types and having few, predefined, relevant P31 values. TiagoLubiana (talk) 15:31, 3 September 2022 (UTC)

  • @TiagoLubiana: thank you for taking part in this discussion. While I think in many points our views are similar, I want to point out some things I would like you to consider.
    1. Merging your first paragraph and proposition IVd gives more or less proposition IIa, not IIb. In short: proposition IIa is to use subclass of (P279) for chemical classification and use other more-specific properties for any other classes if possible.
    2. Ad IVa: I cannot agree with this and my argument is... ChEBI ontology. In ChEBI we have not one type of entries, but four types. Distinction between them is not directly indicated, but is quite clear from the ChEBI documentation. There are (1) molecular entities, (2) part-molecular entities, (3) open classes, (4) closed classes. There is no one common class for every entry in ChEBI like you propose with type of chemical entity (Q113681859). And in fact, there is no need for such class, especially as you proposing several more specific classes in IVb and IVc (which eventually would have to be subclasses of type of chemical entity (Q113681859), so type of chemical entity (Q113681859) would be redundant in all items in which sub-metaclasses are present). We already have widespread metaclasses like structural class of chemical entities (Q47154513) which covers most of ChEBI 'open classes', so the goal here with proposition I is to complete this metaclassification with a metaclass which would cover all ChEBI 'molecular entites'-like entries (which most now have instance of (P31)chemical compound (Q11173), some have 'ions' or 'radicals' etc.).
      What's more, this would not hamper quering: depening on the intended results, with one general metaclass like type of chemical entity (Q113681859) one have to limit the query excluding some metaclasses; with distinct metaclasses like type of chemical entity (Q113145171) or type of chemical entity (Q113681859), one have to combine the results. Both actions require a similar effort, however, given our usual needs, we query either for type of chemical entity (Q113145171) or for classes of entities like type of chemical entity (Q113681859).
      Also, I don't know any place in which entries like alcohols (Q156) and ethanol (Q153) would be classified under the same metaclass. The first is a class of entities, the second is a class of classes of entities. I can't see how mixing these two under one metaclass would be beneficial and I can't find similar approach in other fields in Wikidata.
      In other words, you propose one general metaclass type of chemical entity (Q113681859) and many sub-metaclasses (like in proposition IVb and IVc). I'd say to skip the general metaclass, and use only metaclasses you mentioned in proposition IVb and IVc. What you're proposing in IVc for 'chemical compounds' is in fact mostly proposition I with type of chemical entity (Q113145171).
    3. Ad IVb: the problem with this is something outside of the topic itself. In regards to chemical elements we have (or at least should have) three types of entries: (1) about chemical element, (2) about atom of this element, (3) about pure substance/molecular entity composed of atom(s) of this element. Due to disagreement over many years, many of these items have been merged. I agree with you that items about these entities should be included in the classification, but not items like bromine (Q879), but items like dibromine (Q2685750), i.e. items about molecular entities.
  • Beside that, I have a strong feeling that our views in this matter are very similar, but maybe my not very good knowledge of English leads to some misunderstandings. Wostr (talk) 19:15, 5 September 2022 (UTC)
    @Wostr I just thought about something... once the decision regarding mappings will be fixed, we should strongly consider https://github.com/rwst/yaccl from @SCIdude to batch edit the chemical classification AdrianoRutz (talk) 11:48, 9 September 2022 (UTC)
    @AdrianoRutz We? I don't see other ways than me doing the actual work. I would be willing to do it if I hadn't the impression you're offhandedly imposing this on me right now. --SCIdude (talk) 07:42, 10 September 2022 (UTC)

@SCIdude There is a clear misunderstanding then, my apologies. The goal of me mentioning your tool was not forcing you at all. First, I think it is the best we have right now so it is just pragmatic to want to use the best instead of investing hours doing yet another one. Second, I did not want you to be in charge of the edits, I really thought the people interested here would give it a look, and come with their own proposals for the batch edition. I am really sorry if I did not express myself correctly or gave you this impression, it was not intended at all. Hope we are aligned… AdrianoRutz (talk) 08:07, 10 September 2022 (UTC)

As I think most of the participants are inclined to options I and IIa (also TiagoLubiana's propositions seems to me very close, with only slight differences, to these two options) I plan to prepare appropriate project subpages explaining these changes and then carefully and gradually implement it. After that we will be able to check to what extent the applied solutions still require specific corrections and discuss it further. Wostr (talk) 19:02, 29 September 2022 (UTC)

Agree. Small well-planned steps are essential for this to be done right. SCIdude (talk) 07:06, 30 September 2022 (UTC)
@Wostr Hi, it seems like you took the initiative to launch some mass editing.
Thank you for that. Any info somewhere? AdrianoRutz (talk) 13:04, 1 May 2023 (UTC)
@AdrianoRutz: about the mass editing: yes and no. The first mass editing was done much earlier this year, about 1,2M edits (adding a new metaclass to every item), I've also updated this and this page. Right now I'm doing small batches (whenever I have time for this) with changes to P31, P279, P366, P2868 and other statements (some changes are done manually, most using QS). I'm trying to achieve some consistency (there are sometimes the same values in P31/P279 and in P336 and/or P2868, so I'm trying to clean this up) – the main goal right now is to have only type of chemical entity (Q113145171) and chemical compound (Q11173) in P31, other statements moved to P279/P336/P2868/... After this, I'd like to check whether we are ready to delete chemical compound (Q11173) from P31 – in some cases chemical compound (Q11173) would be moved to P279 (if there is no other class in P279 in item), in other deleted. Wostr (talk) 18:28, 3 May 2023 (UTC)
@Wostr Thank you for the pointers, highly appreciated. I'll also try to move some statements accordingly. AdrianoRutz (talk) 19:19, 3 May 2023 (UTC)
I have cleaned up P31 statements in every item with a instance of (P31)type of chemical entity (Q113145171); in many of these items only chemical compound (Q11173) remained, which I plan to clean up in August/September (move it to P279 or delete, if there are subclasses of chemical compound (Q11173) present in an item).
After moving many classes from P31 to P279/P2868/P366 or other more relevant properties, there are still some classes that are present in different properties in items. I have prepared lists of problematic classes in each of these properties and I intend to take care of this by the end of September as well.
Items related to functional groups and other fragments of molecules also remained to be sorted out. This is a relatively small number of items that I will tidy up during other works.
I have also noticed a number of issues that will need to be addressed in the longer term:
  • Items about 'groups of stereoisomers' often mix up statements or external-ids with those about racemic mixtures. This usually applies to drugs. I changed the constraints of some medicine-related properties accordingly to show violations in some cases, in which most likely the item should be split into two separate items (one for 'stereoisomer group', the other for 'racemic mixture'). I plan to describe this problem and how to solve it on the appropriate subpage of the project.
  • Items about polymers very often combine information about macromolecules, mixtures of macromolecules (polymers) and plastics. Then there are items related to prepolymers, resins, etc. After some initial changes, I got feedback that (1) my idea of classifying polymer items as generally 'mixtures of chemical entities' ('type of polymer' which is a subclass of 'mixture of chemical entities') is not always correct, (2) there are significant discrepancies between the terminology in different languages, and thus there may be problems with ordering this field, (3) there are some borderline cases with which there may be classification problems. This issue will need to be addressed in the future.
  • User Zcp3000 (not inactive) made a significant number of edits, most of the appear to be correct. However, in dozens of item I have found that from this account have been added an InChIKey to the wrong item (items about genes, scientific articles etc.) probably based on label. Then, automatic tools imported data from external databases to such items (example). conflicts-with constraint (Q21502838) with DOI (P356) are present in InChI (P234) and InChIKey (P235) – at least some of these situations could be caught thanks to this (as well as some other issues that I'll clean up in the near future), but if time permits i will be reviewing all editions from this account.
At the same time updated information on 'Guidelines' subpages. Some of the information is still being updated and expanded. In the course of all this work, I also created the 'Issues' subpage, which I will write about in separate threads. Wostr (talk) 14:25, 11 August 2023 (UTC)

Here is a discussion that proposed to overturn a previous discussion (i.e. to restore all IUPAC GOLDBOOK entities), Wikidata_talk:WikiProject_Chemistry/Archive/2022#RFD:_delete_IUPAC_GOLDBOOK_entities_"scholarly_article". Please comment there.

@Vladimir Alexiev, ArthurPSmith, Wostr, 99of9, Snipre, SCIdude:. GZWDer (talk) 16:28, 5 December 2022 (UTC)

I think the existing scholarly articles already junk up the search. They should be a different entity to exclude in searches. Until that is implemented, IUPAC Gold Book ID (P4732) is the much better solution in this realm. This way, the ID can also be re-used in the existing templates on wikipedia:de:Vorlage:Gold Book for example. Matthias M. (talk) 13:27, 24 July 2023 (UTC)
PS: They were not properly deleted Q103857383 etc. still exist. Matthias M. (talk) 19:47, 24 July 2023 (UTC)

Use of P5008 and/or P6104

Saehrimnir
Leyo
Snipre
Dcirovic
Walkerma
Egon Willighagen
Denise Slenter
Daniel Mietchen
Kopiersperre
Emily Temple-Wood
Pablo Busatto (Almondega)
Antony Williams (EPA)
TomT0m
Wostr
Devon Fyson
User:DePiep
User:DavRosen
Benjaminabel
99of9
Kubaello
Fractaler
Sebotic
Netha
Hugo
Samuel Clark
Tris T7
Leiem
Christianhauck
SCIdude
Binter
Photocyte
Robert Giessmann
Cord Wiljes
Adriano Rutz
Jonathan Bisson
GrndStt
Ameisenigel
Charles Tapley Hoyt
ChemHobby
Peter Murray-Rust
Erfurth
TiagoLubiana

Notified participants of WikiProject Chemistry Should Wikidata:WikiProject Chemistry be using on focus list of Wikimedia project (P5008) and/or maintained by WikiProject (P6104)? I was not aware of these properties and I am tempted to think anything that is a type of chemical entity (Q113145171) is our focus list, not? What do you think? --Egon Willighagen (talk) 15:25, 9 July 2023 (UTC)

I noticed these properties some time ago, I'm not so sure about the difference between them. I've added this property to a few items (like type of chemical entity (Q113145171)) to indicate (or rather in hope) that every major change should be discussied in wikiproject, but I don't know what we would gain by adding this property to some million+ items. It would be possible to query all items that are related to chemistry, but does anyone need to query such thing? Wostr (talk) 15:39, 9 July 2023 (UTC)
Ah, now I still forget to add it, but this discussion triggered my question: https://www.wikidata.org/wiki/Wikidata_talk:WikiProjects#Consistency_in_tagging_WikiProjects_via_P5008_and/_or_P6104 --Egon Willighagen (talk) 15:41, 9 July 2023 (UTC)
@Wostr: for chemicals I agree, but perhaps it would be useful for name reactions, famous/award-winning chemists, historical sites, etc? Egon Willighagen (talk) 05:53, 5 August 2023 (UTC)
When this is added to the chemical entities, I fear that the whole may become unqueriable. Even now (about 1.2M items for chemical entities) many queries give a timeout error. So the question is, in my opinion, what might we want or need to query other than chemical entities. I suspect that we can use this property for all chemistry-related items that are sort of scattered around without a uniform metaclass. Wostr (talk) 13:14, 11 August 2023 (UTC)
A recent Scholia (Q45340488) extension shows info on WikiProjects and uses it. The Chemistry one lives at: https://scholia.toolforge.org/wikiproject/Q8487234 --Egon Willighagen (talk) 15:39, 9 July 2023 (UTC)

Translation of WikiProject Chemistry pages

Given that WikiProject pages are primarily a working space, and English remains the sole working language here anyway, I propose to abandon any attempt to translate these pages into other languages. Personally, English is not my native language and sometimes I have problems communicating at an appropriately understandable level, but the translation of subpages of the project does not make it easier.

Many subpages change over the course of weeks or months, which would require translation of certain changes on an ongoing basis; there are few of us here, taking into account specific languages, sometimes there is only one user per language. Attempts to make this WikiProject multilingual are, in my opinion, a waste of time that could be spent on more necessary tasks. Even after so many years this WikiProject homepage, it is only partially translated into many languages, and those into which it is fully translated are only due to the lack of changes on the homepage for many years. Wostr (talk) 14:37, 11 August 2023 (UTC)

When cleaning up items regarding the work on metaclasses, I also described several issues on separate subpages of this WikiProject. Details in the sections below. These are suggestions on how to solve a given problem, so a discussion is highly recommended and any comments and remarks are most welcome. I know that there are still many other issues (like the issue with tautomers) that need to be addressed. Wostr (talk) 14:25, 11 August 2023 (UTC)

Right now I described only the problem with InChI (P234) and the 1500-character limit, which I moved and expanded from the property discussion page. For many months now I always deal with this by adding:

InChI
Deprecated rank some value
reason for deprecated rank exact value exceeds the maximum number of characters
0 references
add reference
Value of this statement is set to some value, rank is set to deprecated with a specific reason for deprecation.
add value

and I propose to make this a (temporary) 'good practice' for this issue. The best option would be to increase the max limit of characters, but it's probably not possible to the extent this property would need (about at least 3–4 times the current limit). The other solution would be to split long InChIs and add in fragments. However, this raises some problems: how to do it (separate statements with series ordinal (P1545), in the form of qualifiers?) and whether it will be re-usable for users at all. Wostr (talk) 14:25, 11 August 2023 (UTC)

Problem similar to above. There is currently a limit of 250 characters for labels and aliases. In many cases, the chemical entities described in WD have only systematic names that are well over 250 characters long. In these cases, most often the items: (1) have no name, (2) have the name in the form of InChIKey, (3) have the name in the form of a different identifier (e.g. CID, UNII), (4) have the wrong name.

There seem to be two solutions here:

  1. don't set any name at all and leave labels and aliases blank
  2. use InChIKey as a temporary name.

Of the two options, I would suggest using the latter. InChIKey is a short, non-proprietary identifier that uniquely identifies a chemical structure. In addition, it would then be possible to automatically check the number of such cases by comparing label and InChIKey (P235).

The problem here is also automatic and semi-automatic changing of labels. In some cases, there are short names in the databases, which, however, turn out to be incorrect and misleading (e.g. it is a correct name, but for a structure with a different spatial configuration). Therefore, along with the proposal to use InChIKey in such situations, I suggest that changing labels from InChIKey to other names should be done only manually. Wostr (talk) 14:25, 11 August 2023 (UTC)

In ChemSpider there are entries for both 'undefined' and 'unknown' stereocenters generated using non-standard InChI. In WD we do not distinguish between such entries, as we mainly describe chemical entities based on standard InChI. From our point of view, both identifiers in ChemSpider are valid and refer to the same item.

I propose to solve this by adding a proper qualifier and mark one ID as preferred:

As 'preferred' would be marked an ID that uses '?' symbol for stereocenter (just as in standard InChI), which usually (always?) has a lower ID. With 'normal' rank would be marked an ID that uses 'u' symbol for stereocenter (which is present in ChemSpider to deduplicate structures). Wostr (talk) 14:25, 11 August 2023 (UTC)

In some databases (PubChem, ChemSpider) chemical entities that exhibit predominantly ionic character may have more than one entry. This is due to the fact that it is difficult to show the ionic character of a bond in the form of a structural formula, thus the SMILES or InChI generation methods in principle allow to show either the ionic character or the covalent character of the bond. This leads to a situation where one chemical entity is described in databases in two ways. This therefore results in duplication of (1) identifiers, (2) structure-related properties (SMILES, InChI).

I consider it a mistake to describe such representations of chemical structures in separate items, and I believe that only one item should exist in WD in such situations, but with two sets of identifiers.

In the case of duplicated identifiers, I suggest adding appropriate qualifiers and marking one of the identifiers as 'preferred'.

Why the 'normal' and 'preferred' rank instead of 'deprecated' rank of one of the identifiers? The entries in the database are not incorrect per se, one describes the chemical structure more accurately than the other.

In the case of duplicated structure-related properties (SMILES, InChI, InChIKey), I suggest to 'deprecate' one of the statements:

canonical SMILES
Normal rank [O-]S(=O)(=O)[O-].[Co+2]
0 references
add reference
Deprecated rank O=S1(=O)O[Co]O1
reason for deprecated rank covalent structure for a chemical entity with a predominantly ionic character
0 references
add reference
First value shows a correct representation of a ionic compound, no need to set rank as preferred. The second value shows a covalent representation of a predominantly ionic compound, thus it is set to deprecated with a proper reason stated.
add value

In this case, one of the representations of the chemical structure is generally much less correct than the other, hence the 'deprecated' rank with the appropriate qualifier. Wostr (talk) 14:25, 11 August 2023 (UTC) Wostr (talk) 14:25, 11 August 2023 (UTC)

In some cases, which structure (ionic vs. covalent) is more correct isn't totally clear, because the structure differs between states of the substance. E.g.: in the CoSO4 example, the anhydrous compound might actually be a coordination polymer with sulfate ligands. NaCl is ionic in condensed phases, but molecular as a gas. Also, sometimes there are multiple solid-state polymorphs, e.g. sulfur trioxide. In principle, we could create a separate item for each structure, but that would quickly become unwieldy, and most sources don't specify precisely which polymorph they're talking about. I'm not sure of a great solution in general.
Separately, there are also some other kinds of chemical relationship that result in multiple entries. For example, in Talk:Q1792796#Bad data from Pubchem there seem to be two different entries with the correct atoms and linkages; if I'm reading them correctly, they're two legitimate resonance contributors to the same structure. 73.223.72.200 22:56, 11 August 2023 (UTC)
While I can't agree that e.g. NaCl forms a covalent molecules in gas phase, I agree that the presented approach would be at best true for normal conditions. Maybe the better approach would be to set all such statements as 'normal' and add proper qualifiers (like entry in a database describing the character of a chemical entity as covalent (Q121136454)) to both external-IDs and to structure-related properties. I'm too not sure about creating multiple items for each structure. We are doing this for e.g. carbohydrates and some tautomeric forms, but apart from carbohydrates, other tautomeric forms cause a lot of problems in WD. It would be similar if we wanted to duplicate items for each form of representing a chemical structure, especially since, unlike tautomers, it is not even possible to isolate this type of structures here, their existence is only the result of problems with generating a structure by certain tools or software. copper(II) acetylacetonate (Q1792796) is an example that in PubChem the same chemical compound has three different entries (I think all three IDs are correct here and the differences are due to the imperfections of the tools responsible for generating chemical structures). Wostr (talk) 13:45, 12 August 2023 (UTC)
If we want to go further with the above problems, we have to treat in the same discussion zwitterion and tautomers like ketone/enol, imine/enamine, lactam/lactim... Most duplicated entries in WD are due to these two majors origins. The correct way would be to chose the more stable form at ambient conditions (covalent bond for NaCl in gas phase is not the common state of the molecule, so this can't be used to represents this salt), but there is not sufficient reference to confirm which is the more stable state. I would prefer therefore fix one form in the case of zwitterion and tautomers as the reference form for InChI/InChIKey/SMILES representations.
Then whatever is the chosen solution, we have to fix the constraint violations: there is no sense to keep that kind of tools if there is no consistency between constraints rules and practice. If we decide that InChIKey is a single value property (see InChIKey (P235)), then we have to respect that choice and delete multiple values even with deprecated status.
As general trend, I prefer to avoid multiple values with qualifiers like proposed by Wostr above. This is just a mess especially when retrieving data from an external system like WP. Reality can't be modeled in all details and I prefer to simplify the data structure and work more on adding valuable information than maintaining a complex structure of possible representations. Snipre (talk) 12:09, 14 August 2023 (UTC)
Starting from the end: leaving some statements in the items with 'deprecated' rank does not pose any problem with retrieving the data. That why the ranks are in WD: the statement is 'deprecated', so (1) there is no risk that somewhere in WD new item will be added based on such statement, (2) such deprecated statement allows the item to be found by any user, but (3) any re-user know (or should know, based on general WD model) that only 'preferred'/'normal' rank statements should be used.
I agree that the problem is broader, but the best solution in one area may not be the best in another. Even if we agree that some structural representations should not be placed in items in WD (InChI, SMILES), we cannot do the same with identifiers. At this stage, it seems to me inevitable that in some items we will have more than one external identifier due to the fact that not every database treats data in the same way, and on the other hand, in accordance with the general rules of WD, for each identifier, e.g. in PubChem, ChemSpider or ChEBI you can create an item and this item will be notable. So it seems impossible to have a 'single value' constraint in these situations, the only solution would be to go in the direction of 'one is preferred' (and establish which one we should mark as 'preferred'). In other databases the relation between entries is also not 1:1, 1:1 relationship between WD item and other databases is a nice idea, but not feasible.
What's more, data consistency does not require to use 'single value' for identifiers. There are many options of simple constraints, we can always add some complex constraints and maintain the data consistency that way. Wostr (talk) 12:59, 14 August 2023 (UTC)
Even if we agree that some structural representations should not be placed in items in WD (InChI, SMILES), we cannot do the same with identifiers
Why ? We have no obligation towards external databases to include all their entries. Instead of trying to merge all entries of external databases, we can, if we want, define what we as community of WD defines as possible items/values. If we define that zwitterions are not valid for creation of an item/statement, then we can excludes all external identifiers representing zwitterions. WD is not the phone book of external databases trying to connect everything. Having an external identifier is for me not sufficient if we have a clear policy. Accepting everything is the perfect example of no internal policy.
I just read one article regarding the tautomerism and there are 86 possible cases of tautomers. As described by the article, most databases are not consistent regarding the treatment of tautomers (see here. So accepting the existence of external identifiers as the only rule for item/statement creation will just import the mess of all databases in WD.
Then I still waiting on the effect of your data maintaining based on simple indicators: the number of constraint violations of the following page. See
Wikidata:Database reports/Constraint violations/P662
Wikidata:Database reports/Constraint violations/P235
Wikidata:Database reports/Constraint violations/P231
The quality of WD is not the capacité of integrating all identifiers of most databases, the quality of WD is to have a set of data well organized and following a understandable policy by most of external people. That's my opinion. But this is the value of a database in general. Snipre (talk) 14:47, 14 August 2023 (UTC)
The exception from the general notability rules (p. 2) would probably require a full-project discussion. Without it, anyone can add an item about a zwitterion or about a tautomer and frankly, we can't do anything about it, as such items are notable enough to be included in WD.
InChI V2, which you've mentioned, is likely to have better recognition of tautomeric structures, however, still in non-standard InChIs.
Leaving a certain part of external chemical databases outside WD will only result in one thing: constantly importing more items about these records from external databases. I have not seen any attempts to control this procedure so far, having already over 1.2M items, manual control over it is impossible. The only solution I see is a proper policy in which cases we should have 'one-to-many' linking to external-databases and how to qualify these external-ids so that it is understandable also in an automatic way.
I've seen many times where 'deprecated' or duplicated IDs have been removed from items. This does not lead to anything good, because these external-IDs will reappear at some point, it will only be months or years before someone discovers them among over a million other items. That's why I say, and I will always say, removing something like this is short-sighted and will only lead to more work. I have never seen in any other database that they remove, even duplicated, links to other databases. It works like redirects in WP – it's better to have more, even 'deprecated' ones, because it allows you to find these items and prevents them from being imported in the future. Wostr (talk) 16:41, 14 August 2023 (UTC)
Speaking as someone who has grappled with these problems for many years before my retirement (from Syngenta), some issues can be "solved" by using StdInChI and StdInChIKey rather than InChI and InChIKey. The former pair render all possible tautomers of a compound into an identical string and in my opinion this is correct when discussing chemical substances: tautomerism is a property of samples that also depends on temperature/solvent etc. I can't see any situation where there would be multiple articles in Wikipedia to cover multiple possible tautomers — they would always be merged into one article. Likewise with Zwitterions: we don't have an article for glycine as H2NCH2COOH and H3N+CH2COO- despite the latter certainly being the reality for all glycine samples in aqueous solution. Going a step further, polymorphism is also a property of a sample, not a substance, although in rare cases (e.g. ice, sulfur, phosphorus) Wikipedia has multiple articles to cover these. That isn't the general case: I authored ROY, = Q27281324, with >= 13 polymorphs and I don't think it would be helpful to have a Wikidata item for each. Michael D. Turnbull (talk) 15:09, 14 August 2023 (UTC)
But our items are not about substances only. Many, or even most of the statements refer to the molecular entities. And therefore, fortunately or unfortunately, our items are a combination of both definitions, substance and molecular entity. InChI/InChIKey has its limitations as even this identifier sometimes fails to properly describe a structure (there are situations in which the same substance has different InChIs as a result of incorrect recognition of tautomeric structures in the InChI software).
The reference to Wikipedia, on the other hand, I think is fundamentally incorrect. By definition, Wikidata is intended to describe the world in much more detail than encyclopedic articles. Chemistry is no exception here. Since Wikipedia only lists isotopes, should we do the same in Wikidata and remove all items about them? Because Wikipedia describes racemic mixtures, and there are no separate articles on individual stereoisomers, should we remove items about stereoisomers? Wikipedia is not an indicator of how Wikidata is supposed to work, much less Wikidata is not an information base for Wikipedia. Wostr (talk) 16:41, 14 August 2023 (UTC)

Can someone reimport chemical formula (P274)?

Saehrimnir
Leyo
Snipre
Dcirovic
Walkerma
Egon Willighagen
Denise Slenter
Daniel Mietchen
Kopiersperre
Emily Temple-Wood
Pablo Busatto (Almondega)
Antony Williams (EPA)
TomT0m
Wostr
Devon Fyson
User:DePiep
User:DavRosen
Benjaminabel
99of9
Kubaello
Fractaler
Sebotic
Netha
Hugo
Samuel Clark
Tris T7
Leiem
Christianhauck
SCIdude
Binter
Photocyte
Robert Giessmann
Cord Wiljes
Adriano Rutz
Jonathan Bisson
GrndStt
Ameisenigel
Charles Tapley Hoyt
ChemHobby
Peter Murray-Rust
Erfurth
TiagoLubiana

Notified participants of WikiProject Chemistry see Wikidata:Project_chat. Midleading (talk) 09:26, 19 October 2023 (UTC)

I think I found the chat you referred to. Reimporting PubChem is for me not on the table right now. It sounds very complicated, and requires evaluating the history of an item, and see if edits have been made since the import. What I can help with, is create curation lists. -- Egon Willighagen (talk) 09:48, 19 October 2023 (UTC)
I really don't see a problem here. Formulae imported from PubChem are correct, but the notation may not be the one you are looking for. There are many ways to write a chemical formula, Hill notation is the best to use in databases, but may not be preferred in other uses. So the problem here is the lack of other formulae you are looking for. Wostr (talk) 00:00, 20 October 2023 (UTC)
PubChem is just an aggregator (like WD). If you notice valuable annotation in PubChem, it often comes from data sources we already have or want to import directly, instead of from PubChem. That said, data sources we cannot import directly are patents, scrapings from the literature, and SID submissions from the industry (if they have no other source). Concentrating on these cases would be valuable. --SCIdude (talk) 07:31, 21 October 2023 (UTC)
Hi,
I just started the deletion of 22,959 chemical formulas that were violating the constraints. (See https://quickstatements.toolforge.org/#/batch/215303, https://quickstatements.toolforge.org/#/batch/215304, https://quickstatements.toolforge.org/#/batch/215305, https://quickstatements.toolforge.org/#/batch/215306, and https://quickstatements.toolforge.org/#/batch/215307)
I am also trying to complete the different masses/formulas from compounds where they are not present and can be easily calculated at the same time.
The next step is to see if the formula is matching the SMILES but this will take more time. AdrianoRutz (talk) 14:33, 26 October 2023 (UTC)
Many of these formulae seemed valid, but where imported with minor errors (like not using the subscript). I'd be good to check in which cases some formula can be reimported and which items will be left without a formula. Wostr (talk) 18:19, 26 October 2023 (UTC)
I will do it when all the correctly formatted ones will be finished re-importing.
Or I could post the list here so it can be fixed before re-import. Else I will simply re-import the violating ones, but representing probably only a few percent in comparison to the original amount before this operation. AdrianoRutz (talk) 10:05, 27 October 2023 (UTC)
@AdrianoRutz: this doesn't seem like a right way to approach constraint violations. Also I don't see based on what you gathered these 22,959 formulas/items really. You removed many formulas that seem perfectly valid, including very simple ones like B(OH)₃ in sassolite (Q424769). E.g. in lanthanite-(La) (Q3826951) I restored the formula and as far as I can see there is no constraint violation. In some items a simple fix was needed, e.g. in walpurgite (Q1531254) it was probably only needed to replace * with ·. 2001:7D0:81DB:1480:45C:F54A:B289:F778 09:52, 27 October 2023 (UTC)
Hi, I took the regexp of the property (https://www.wikidata.org/wiki/Property:P274#P2302). I am also re-importing multiple thousands of them formatted correctly in parallel.
Some might still remain without formula because of the unability to generate it but this should remain minor. I have downloaded all formulas locally as safety. Happy to re-import all the ones that will be still missing after curation in case. AdrianoRutz (talk) 10:03, 27 October 2023 (UTC)
It does not look like you used (only) this particular regex. See above an example that doesn't yield a constraint violation using the very same regex, many others in your batches probably also don't. In case of a reimport why it was needed to remove the statements in first place anyway? Also reimport from where? PubChem? Examples that I checked (minerals) are without PubChem links and are not expected to have ones. 2001:7D0:81DB:1480:45C:F54A:B289:F778 10:25, 27 October 2023 (UTC)
Re-import the exact same formula I deleted, nothing else relying on external sources. I have them locally so do not worry, no item having a formula previously will be left behind.
I agree some edits could have been avoided but the end result will be cleaner.
For the rest, I am really happy to see that you care about those cases so much that you seem to forget the rest. AdrianoRutz (talk) 10:43, 27 October 2023 (UTC)
Well, these are not only a few cases. So far e.g. 4038 mineral species[1] in particular lack a chemical formula due to your recent edits. 2001:7D0:81DB:1480:45C:F54A:B289:F778 11:04, 27 October 2023 (UTC)
Well, this is over 4038 over 6049. Indicates an issue with the chemical formula of mineral species not conforming to the actual constraints to me.
In order to make clear that I never had intention of deleting formulas without re-importing them properly, I prioritized their re-import: https://quickstatements.toolforge.org/#/batch/215387
For the rest, I will still wait my other imports to finish before re-importing them.
I am happy my edits at least drew the attention to things that were left for years untouched. AdrianoRutz (talk) 11:42, 27 October 2023 (UTC)
Alright, thanks for restoring. Just in case I mention that so far you didn't restore references, e.g. here. 2001:7D0:81DB:1480:F4F9:6B85:4F2E:EFED 08:25, 28 October 2023 (UTC)

@AdrianoRutz: I assume your (re)imports are done now but lost refernces are still a significant issue. I made some more queries and caught 1354 mineral species items where reference(s) got lost in your batches. In case you don't have the list, items are the following:

Additionally I found 13 mineral species item where P274 statements hasn't been restored yet: Q3129310 Q973557 Q115520207 Q123167546 Q123169008 Q123155195 Q123163486 Q123168695 Q3782486 Q284146 Q123152967 Q123170689 Q401047. Please further process these 1354+13 items too.

Note that I checked only mineral species. It is very likely that similar problems concern other items in your batches too. So it might be still better if you undid everthing and then redo it in a less messy way. 2001:7D0:81DB:1480:194B:C6D3:7F6:3878 08:26, 29 October 2023 (UTC)

Thank you for your permanent concerns and feedback. Seeing someone this motivated to improve the content of Wikidata is cool.
1. I did not only check the mineral species, but also other instances, such as mineral varieties, for example, that I already fixed. In case I missed some, happy to hear your feedback.
2. No, the editing was not over, your engagement of having these things now fixed is faster than my capacities to edit. Still, I again prioritized your concerns: https://quickstatements.toolforge.org/#/batch/215583
3. These were 1360 and not 1354, additionally, in the meantime, the number of formulas got up by more than 100,000 and incorrectly formatted ones down by 20,000.
4. For our next interaction I would appreciate less judgemental sentences and eventually a bit more positiveness.
Best, AdrianoRutz (talk) 12:53, 29 October 2023 (UTC)
P.S.:
I checked the 13 additional items you mentioned manually and thank you for pointing them out. These have gone under my radar as they contained 2 different chemical formulas, which was unexpected. I reverted the edits and hope someone more knowledgeable than me in the field will curate them. AdrianoRutz (talk) 12:59, 29 October 2023 (UTC)

How to handle incorrect PubChem entry

Q123257271 "6-bromo-2-mercaptotryptamine" matches the PubChem record titled as this chemical-name. But this structure is mercaptomethyl not mercapto and SciFinder has no such structure. Instead, SciFinder has the actual mercapto structure at this name (CASNo 808113-54-4) and there is no PubChem entry matching that CASNo. And the cited refs at en:BrMT also are actually the mercapto structure. How should Wikidata handle this? Should this WikiData item be a clone of the presumably-incorrect PubChem record, and a new WikiData item be created for the correct structure? Confusing to have two different items with a same chemical name. Or should this WikiData item be updated itself (and the PubChem link omitted)? DMacks (talk) 05:56, 7 November 2023 (UTC)

Hi. Basically, both Wikidata and PubChem are based on the idea that each record has a unique InChI/-Key. When there is a mismatch between name and InChIKey, I normally resolve it like this: if there is a Wikipedia sitelink, follow what that says (because moving sitelinks is harder, and because Wikidata started out as database linking Wikipedias); if there is not, I tend to follow the InChI/-Key (and the matching SMILES) and update/fix the name. The matching of the PubChem CID follows the InChI/-Key. When I pass the name through OPSIN (Q26481302), the it confirms indeed that the name and structure do not match. I suggest to update the name. @Marbletan: maybe you can shed further light into this Wikidata item? --Egon Willighagen (talk) 06:14, 7 November 2023 (UTC)
I created this Item based on the content in the English Wikipedia article. I did not catch that the article conflated two different chemical compounds. I'm sorry for bringing the confusion from there to here. I think there should be two different Items to describe the two different chemical compounds, but I don't have a personal preference for which way it goes. Pubchem's incorrect chemical name shouldn't be used. We can also use the "different from" property (P1889) to mitigate the potential for future confusion. Marbletan (talk) 13:32, 7 November 2023 (UTC)
I updated the name to match the structure. Is there a tool/bot for creating new Wikidata entries for newly created chemical pages? DMacks (talk) 01:04, 8 November 2023 (UTC)
I created Q123370393 manually. I'm not aware of a tool to automate it. Marbletan (talk) 13:24, 8 November 2023 (UTC)
Thanks. DMacks (talk) 14:09, 8 November 2023 (UTC)

Is model for and Modeled by

Please consider supporting Wikidata:Property_proposal/model_for. Thanks. Fgnievinski (talk) 02:57, 12 November 2023 (UTC)