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

Changed name to Species to OntologyTerm, removed DbIds not in 2.1 mod… #616

Open
wants to merge 4 commits into
base: LzLang-patch-1
Choose a base branch
from

Conversation

daveneti
Copy link

Changed name to Species to OntologyTerm, removed DbIds not in 2.1 model, matched ObservationUnitLevel etc with model.

…el, matched ObservationUnitLevel etc with model.
Copy link
Member

@LzLang LzLang left a comment

Choose a reason for hiding this comment

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

Hey @daveneti,

just reviewed your changes and there are only small changes needed.

It would certainly be helpful to adjust the validator so that it checks the associations.
For example, you could automatically check whether a referencedAttribute is present and whether the type of the reverse association is correct.
(If the validator is not already doing this)

@@ -2,7 +2,7 @@
"$defs": {
"ExternalReference": {
"properties": {
"externalReferenceDbId": {
"referenceId": {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make sense to use referenceDbId here so that it is standardized or would that lead to a model change?

Copy link
Author

Choose a reason for hiding this comment

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

It the OpenAPI specification it is 'referenceId' so we should keep it to that. Also I think it is technically not a DbId but can be any ID.

@@ -455,9 +440,6 @@
"referencedAttribute": "growthFacility"
Copy link
Member

Choose a reason for hiding this comment

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

You changed the relationship in "Study" from "one-to-many" to "many-to-one".
Reverse association should be "one-to-many" than

Copy link
Author

Choose a reason for hiding this comment

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

A study has one growth facility, but a growth facility may have several studies so

study -> growth facility is many-to-one
growth facilities->study will be one-to-many, correct :)

"items": {
"$ref": "../BrAPI-Core/Study.json#/$defs/ObservationLevels",
"$ref": "../BrAPI-Common/ObservationUnitHierarchyLevel.json#/$defs/ObservationUnitHierarchyLevel",
Copy link
Member

Choose a reason for hiding this comment

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

You have here a association to ObservationUnitHierarchyLevel but no referencedAttribute nor reverse association.
Is that correct and wanted?

Copy link
Author

Choose a reason for hiding this comment

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

I am not sure it is needed. It is not in the model. Actually many of the reverse associations are not in the model, we need to discuss with @BrapiCoordinatorSelby about what we should do about this.

@@ -84,7 +84,7 @@
"relationshipType": "one-to-many",
"referencedAttribute": "reference",
"items": {
"$ref": "../BrAPI-Common/SourceGermplasm.json#/$defs/SourceGermplasm",
"$ref": "../BrAPI-Germplasm/Germplasm.json#/$defs/Germplasm",
Copy link
Member

Choose a reason for hiding this comment

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

There is no reverse association, is that intentional?

Copy link
Author

Choose a reason for hiding this comment

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

See the above comment about reverse associations. If you need something like that in your GraphQL schema we could add an option to auto generate reverse associations. I still think reverse associations should be explicitly defined and model dependent. We should review them all.

@@ -104,7 +104,7 @@
"description": "An ontology term describing an attribute.",
"relationshipType": "one-to-one",
"referencedAttribute": "reference",
"$ref": "../BrAPI-Common/Species.json#/$defs/Species"
"$ref": "../BrAPI-Common/OntologyTerm.json#/$defs/OntologyTerm"
Copy link
Member

Choose a reason for hiding this comment

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

See comment above

Copy link
Author

Choose a reason for hiding this comment

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

see my comment above :)

"germplasm": {
"$ref": "Germplasm.json#/$defs/Germplasm",
"description": "The ID which uniquely identifies a germplasm",
"referencedAttribute": "parentPedigreeNodes",
Copy link
Member

Choose a reason for hiding this comment

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

reverse association uses "$ref": "PedigreeNode.json#/$defs/PedigreeNode",

"properties": {
"observationUnit": {
"description": "The an observation unit\n<br/>If this level has on ObservationUnit associated with it, record the observationUnitDbId here. This is intended to construct a strict hierarchy of observationUnits. \n<br/>If there is no ObservationUnit associated with this level, this field can set to NULL or omitted from the response.",
"$ref": "../BrAPI-Phenotyping/ObservationUnit.json#/$defs/ObservationUnit",
Copy link
Member

Choose a reason for hiding this comment

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

No referencedAttribute, is that intentional?

Copy link
Author

Choose a reason for hiding this comment

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

See comments about referenced attributes

}
},
"title": "ObservationUnitLevelRelationship",
Copy link
Member

Choose a reason for hiding this comment

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

No title nor type for the model?

Copy link
Author

Choose a reason for hiding this comment

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

no type is needed because it is an 'allof' schema, but it could have a title, although it is option can defaults the to name. I did not put titles in any of the 'allof' schemas.

@@ -72,12 +72,9 @@
]
},
"validValues": {
"relationshipType": "one-to-many",
"relationshipType": "one-to-one",
Copy link
Member

Choose a reason for hiding this comment

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

reverse association is still many-to-one

Copy link
Author

Choose a reason for hiding this comment

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

I think it is 1 to 1, always. The 'ValidValues' entity is always associated with a Scale. It is a Composition association. It only exists with a single Scale object and no other.

@@ -296,21 +308,14 @@
"referencedAttribute": "availableFormats"
Copy link
Member

Choose a reason for hiding this comment

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

relationshipType is still many-to-one, reverse is many-to-many

Copy link
Author

Choose a reason for hiding this comment

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

A single VarientSet can have multiple formats so one-to-many
A format can be shared between VarientSets, so many-to-many

@daveneti
Copy link
Author

Hey @daveneti,

just reviewed your changes and there are only small changes needed.

It would certainly be helpful to adjust the validator so that it checks the associations. For example, you could automatically check whether a referencedAttribute is present and whether the type of the reverse association is correct. (If the validator is not already doing this)

@LzLang it should check references. I am also adding a CI so that the validator is run on commit. wait for @BrapiCoordinatorSelby permission.

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.

2 participants