Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A more complete Qualifiers implementation #330

Merged
merged 12 commits into from
Jul 1, 2022
Merged

Conversation

edeutsch
Copy link
Collaborator

No description provided.

type: array
description: >-
A list of contraints applied to a query edge.
A list of attribute contraints applied to a query edge.
If there are multiple items, they must all be true (equivalent
to AND)
items:
$ref: '#/components/schemas/QueryConstraint'
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have the ability to constrain queries based on values of Attributes and Qualifiers, consider renaming the QueryConstraint object 'AttributeConstraint' or 'AttributeQueryConstraint'? And then name the object that defines a constraint based on a Qualifier value a 'QualifierConstraint' or 'QualifierQueryConstraint'. (This object is currently named 'QualifierSet' in this PR). This would make naming more clear and consistent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use AttributeConstraint and QualifierConstraint to distinguish the two kinds of constrains.

predicate it is qualifying via the
QualiferSet.qualified_predicate property.
items:
$ref: '#/components/schemas/QualifierSet'
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted above, consider renaming 'QualifierSet' --> 'QualifierConstraint' or 'QualifierQueryConstraint', to be more clear and consistent with the name of the object that holds a constraint definition based on Attribute values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially skeptical, but now agree that 'QualifierSet' --> 'QualifierConstraint' may perhaps be a little better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After pondering further, I'm convinced that QualifierConstraint is better. I have updated the PR.

description: >-
The value associated with the type of the qualifier, drawn from
a set of controlled values by the type as specified in
the Biolink model (e.g. 'decreased' or 'increased' for the type
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making the example here consistent with the example of a qualifier_type_id above (where you used 'subject_aspect'). So here, say "(e.g. 'expression' or 'abundance' for the qualifier type 'subject_aspect', etc)." And then change the example below from 'decreased' to 'expression'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, fixed.

example: decreased
nullable: false
required:
- type
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the required 'type' property here read 'qualifier_type_id'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, definitely, fixed, thanks.

QualifierSet:
additionalProperties: false
description: >-
A set of Qualifiers that act together to add nuance to an assertion.
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The definition here seems too general - is this because the notion of a QualifierSet is menat to be used elsewhere, for purposes other than constraining a query?
If not, consider the proposed renaming/reframing of this object, and updating definition to something like:
"Defines a query constraint based on the type and value of a Qualifier attached to an edge. e.g. can constrain a "ChemicalX - affects - ?Gene" query to return only edges where ChemicalX specifically affects the 'expression' of the Gene, by constraining on the qualifier_type "object_aspect" with a value of "expression".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qualifier is used both for QEdges and Edges. So it used both for querying and for conveying assertions. That is why the definition is slanted more toward the assertion side. In the context of queries, it specifies the constraints on the desired assertions. So okay as is?

Copy link
Collaborator

@mbrush mbrush Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that 'Qualifier' object is used in asserting knowledge and querying for it. But the definition here is for a 'QualifierSet' object, which we agreed above to rename 'QualifierConstraint' (because its express purpose is to allow constraining queries based on the values of Qualifiers on an edge).
So given that we are now defining a 'QualifierConstraint' object, it makes sense to me to update the definition so that it clearly conveys this purpose of this object in constraining queries.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand now. Yes, agreed. Updated with minor edits. See if the committed version seems agreeable.

items:
$ref: '#/components/schemas/Qualifier'
nullable: false
qualified_predicate:
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'qualified_predicate' is the name of an edge property defined in Biolink. It may be confusing to have a TRAPI property with the same name. Consider the name 'constrained_predicate'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am neutral, but fine to change if it seems less conflicting with Biolink.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand better now and after pondering further, I'm convinced that constrained_predicate is better. I have updated the PR.

description: >-
A set of Qualifiers that act together to add nuance to an assertion.
properties:
qualifiers:
Copy link
Collaborator

@mbrush mbrush Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we rename QualifierSet --> QualifierConstraint, I would consider renaming this field from 'qualifiers' --> 'qualifier_set'. 'qualifiers' is fine, but I feel like 'qualifier_set' indicates more clearly that the qualifiers in this array are to be considered together in constraining the query.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially skeptical, but now agree that 'qualifier_set' may perhaps be a little better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After pondering further, I'm convinced that qualifier_set is better. I have updated the PR.

description: >-
The predicate that is to be qualified in cases where there
are multiple predicates in a query and there thus might be
ambiguity.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this initial draft of an object to support Qualifier-based query constraints, I would also include a boolean 'not' property, as exists for the QueryConstraint object used for Attribute-based constraints . Key for the basic functionality of excluding specific qualifiers from a result.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think this needs more discussion. I view "not" and "exclude" as two very different things. In my view, "not" should be used as:

  • Which drugs do not treat disease X? (e.g. clinical trials were run and the the result was that the drug does not treat X)

while "exclude" has a different functionality:

  • Which drugs are related to disease X, excluding those that are contraindicated for disease X

This exclude flag was proposed to be a direct QEdge property. although no consensus was reached and it remains ARAX-only functionality

The "not" property was also deferred until such a time as we would carefully think through and document how this would be implemented (regarding inheritance and inference, etc.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think we should avoid this unless we have more discussion.

Copy link
Collaborator

@mbrush mbrush Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion was motivated by an example query Valdo provided that asks "What compounds increase the activity or phosphorylation of PPARA but not its abundance". But as you point out, negation/exclusion are tricky and perhaps it is best to leave this out for now, until we look into it more closely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, let's leave it out for now

edeutsch added 2 commits June 15, 2022 11:23
- update value to qualifier_value
- Correct the names of the required fields
- update the qualifier_value example and description to be consistent with the qualifier_type_id
@edeutsch
Copy link
Collaborator Author

So this is where I see the current PR:
image

and this is what @mbrush is suggesting:
image

I am fine with these changes except for the "not". That might need some more discussion.

@mbrush
Copy link
Collaborator

mbrush commented Jun 21, 2022

I drafted some example qualifier-based Associations in the document here - and included a few queries illustrating the qualifier constraint proposal above (with modifications I suggested). These queries are at the end of the document - and I think align well with the bottom part of Eric's diagram.
@edeutsch maybe take a look at my examples document to confirm (you can ignore the 'not' element in the final query example)?

@edeutsch edeutsch requested review from mbrush and vdancik June 22, 2022 00:31
@edeutsch
Copy link
Collaborator Author

okay, everyone, after updating the PR based on @mbrush excellent comments, we now have this structure in the PR:
image

Please everyone examine carefully and review. This is our release candidate for qualifier support in TRAPI.

@mbrush
Copy link
Collaborator

mbrush commented Jun 22, 2022

The proposal looks pretty good to me. I might consider minor tweaks to two property names and definitions (but not a big deal if we keep things as they are):

  1. In the Edge object:

    • change the name of the property qualifier_set back to qualifiers (to be consistent with the name of the attributes property here)
    • change definition of this property to "a set of Qualifiers that act together to add nuance or detail to the statement expressed in an Edge" (the term 'statement' rather than 'assertion' is more consistent with the language we use in our documentation of the qualifier-based approach)
  2. In the QualifierConstraint object:

    • Keep the name qualifier_set , but update the definition so that it describes the role qualifiers play in a Constraint (the present definition describes the role Qualifiers play in an Edge). The new def may be something like "a set of Qualifiers that serves to add nuance to a query, by constraining allowed values held by Qualifiers on queried Edges."

I understand that the current proposal is motivated to use the same property name (qualifier_set) and definition ("a set of qualifiers that together provide additional detailed nuance to the assertion beyond what the subject-predicate-object can provide") in both the Edge and QualifierConstraint objects - because these properties both hold a set of Qualifier objects. However these qualifiers serve different roles in these contexts, and to me this warrants different definitions that describe these distinct roles. That said, if folks still prefer to keep the same name and defs for these properties, I wont object.

@edeutsch
Copy link
Collaborator Author

Thanks for the review. I think your definition adjustments all seem sensible and I will make those unless there are objections. But I would like to discuss the property name a bit further:

change the name of the Edge property qualifier_set back to qualifiers (to be consistent with the name of the attributes property here)

It is true that you requested in the previous round to change QualifierConstraint.qualifiers to QualifierConstraint.qualifier_set, and then I went ahead and also changed Edge.qualifiers to Edge.qualifier_set even though you didn't suggest it. I did that for what I perceived as consistency. So I am surprised that you would have us change it back for consistency.

It seems to make more sense to me to keep both QualifierConstraint.qualifier_set and Edge.qualifier_set consistent since they are essentially the same thing. rather than aim for consistency between Edge.attributes and Edge.qualifier[_set|s].

I thought calling it qualifier_set rather made a lot of sense because the Qualifiers within a set really do work together closely. Whereas the attributes are mostly a pile of independent things (some are provenance, some are inherent properties, some are assigned attributes, etc.)

So I rather like qualifier_set. But I'm happy to be outvoted.

How about all readers that made it this far put in their votes?

  • Rocket for Edge.qualifier_set
  • Heart for Edge.qualifiers

@mbrush
Copy link
Collaborator

mbrush commented Jun 22, 2022

I am fine with either name for the Edge property. I don't feel like we need to use the same property name in the Edge and QualifierConstraint objects, since the referenced/nested Qualifier objects are serving different purposes in these different objects/contexts. I have a slight preference for Edge.qualifiers (to be consistent with the name of the Edge.attributes property in the same object). But am fine with Edge.qualifier_set too . . . esp if we update the QualifierConstraint.qualifier_set definition as proposed so it is clear what role Qualifiers are playing here. @edeutsch were you ok with the proposed changes to this definition?

@edeutsch
Copy link
Collaborator Author

edeutsch were you ok with the proposed changes to this definition?

@mbrush Yes, I think they're great. I was leaving a little time for others to chime in, but hearing none, the latest commit to the PR now uses your definitions. Seem good?

@vgardner-renci vgardner-renci requested a review from vemonet June 23, 2022 12:24
@mbrush
Copy link
Collaborator

mbrush commented Jun 29, 2022

@edeutsch looks good to me! Still slight preference for the name Edge.qualifiers over Edge.qualifier_set . . . but if Hearts vs Rockets vote above remains 1-1 we can keep it as is. Thanks for your work on this!

edeutsch added 2 commits June 30, 2022 11:19
Removed constrained_predicate for now. It may come back in TRAPI 1.4 with more thought:
```
        constrained_predicate:
          $ref: '#/components/schemas/BiolinkPredicate'
          description: >-
            The predicate that is to be qualified in cases where there
            are multiple predicates in a query and there thus might be
            ambiguity.
          nullable: true
```
@edeutsch
Copy link
Collaborator Author

edeutsch commented Jun 30, 2022

okay, based on today's TRAPI call and follow-up with @mbrush, I have made the following changes to the PR:

Removed constrained_predicate
ef1a94f

Rename Edge.qualifier_set to Edge.qualifiers
4d52728

Did I do this correctly?
any further concerns?
If correct, we are aiming to merge later today. Please respond.

$ref: '#/components/schemas/Qualifier'
nullable: false
required:
- qualifiers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edeutsch , shouldn't required field in QualifierConstraint contain qualifier_set instead of qualifiers ?

Copy link
Collaborator Author

@edeutsch edeutsch Jul 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, absolutely, good catch! Fixed in PR with f4bcfc5
thanks!

@edeutsch edeutsch merged commit b470a3b into 1.3 Jul 1, 2022
@edeutsch edeutsch deleted the edeutsch-qualifiers-3 branch July 6, 2022 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants