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

Introduce content directory graphql schema for query node #1458

Closed
wants to merge 17 commits into from

Conversation

metmirr
Copy link
Contributor

@metmirr metmirr commented Sep 24, 2020

This PR introduces the content directory graphql input schema for the query node. All the types are defined in the schema expect #1348

Copy link
Member

@bedeho bedeho left a comment

Choose a reason for hiding this comment

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

Why are the changes in 8a13fa7 here?

Copy link
Member

@bedeho bedeho left a comment

Choose a reason for hiding this comment

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

  • I think @iorveth should be more deeply involved in making and reviewing this, he could have cought some of these issus.
  • Please introduce explicit Id field in all entities, and explain where value comes from. This is unclear here.

rootAccount: Bytes!

"When a member is worker"
worker: Worker @derivedFrom(field: "member")
Copy link
Member

Choose a reason for hiding this comment

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

A member can occupy 0 or many worker roles, both at the same time, and over time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 162095e all roles extends Worker interface will have a reference to the Member type.

worker: Worker @derivedFrom(field: "member")

"Virtual field required for 1:1 relationship"
entityController: EntityController @derivedFrom(field: "controllerWhenMember")
Copy link
Member

Choose a reason for hiding this comment

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

Why is this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 74b9b3d. It is my mistake, a member can control more than one entity.

# Commenting out this line because the properties are accessible from the schemas
# query { classes { schemas {properties { ... } } } }
# "All properties that have been used on this class across different class schemas"
# properties: [Property!]
Copy link
Member

Choose a reason for hiding this comment

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

Why is this commented out? I don't think the comment provides a good rationale, may have been me who wrote it long ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in f1bfa3b. No, it's my comment actually, after fixing Property entity (each property has a reference to a class) I uncomment it and it is a reverse lookup now.

}

"`Property` representation, related to a given `Class`"
type Property @entity {
Copy link
Member

Choose a reason for hiding this comment

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

The Property and PropertyType types need to be coordinated better. we have fields such as ".... when the property is a vector, this is a symptom of not using algebraic types, which we should and can do. Look at runtime for guidance. @iorveth will have valuable input on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored it to the model you suggested here #644 waiting @iorveth input on this.

Copy link
Member

Choose a reason for hiding this comment

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

#644 is not a solution, that draft was made before we even had algebraic types as a features.

}

"Fields encode a flattened representation of non-vector properties, only one will be non-null"
type SingleValue @variant {
Copy link
Member

Choose a reason for hiding this comment

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

This should be modelled differently, this is not how to model this algebraically, @iorveth may help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored it to the model you suggested here #644 waiting for @iorveth input on this.

Copy link
Member

Choose a reason for hiding this comment

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

#644 is not a solution, that draft was made before we even had algebraic types as a features.

Fields encode a flattened representation of vector properties, only one will be non-null
"""
type VectorValue @variant {
boolVec: [Boolean!]
Copy link
Member

Choose a reason for hiding this comment

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

This should be modelled differently, this is not how to model this algebraically, @iorveth may help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored it to the model you suggested here #644 waiting for @iorveth input on this.

Copy link
Member

Choose a reason for hiding this comment

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

#644 is not a solution, that draft was made before we even had algebraic types as a features.

}

"Working group participant: working-group/src/types.rs"
type Worker @entity {
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be an interface, as there are many kinds of workers, not just curators (even though we will only include curators in Babylon). The Curator entity can implement this interface. This would also require dropping curator field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 9540c34


union StoredValue = SingleValue | VectorValue

type PropertyValue @entity {
Copy link
Member

Choose a reason for hiding this comment

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

This is not being correctly modelled, please reevaluate. Include @iorveth here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored it to the model you suggested here #644 waiting for @iorveth input on this.

Copy link
Member

Choose a reason for hiding this comment

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

#644 is not a solution, that draft was made before we even had algebraic types as a features.

value: StoredValue!

"Virtual field for entity property values"
entities: [Entity!] @derivedFrom(field: "values")
Copy link
Member

Choose a reason for hiding this comment

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

A property value only corresponds to a single entity, and the valuesfield should derive from PropetyValue, not the other way around.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in d8b9033


type PropertyValue @entity {
"Runtime identifier of property value in entity"
propertyValueId: BigInt! @unique
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 unique property value id from the chain, the id in the chain is just an index in the given class, which will not be unique.

A property value is unique for a given combination and entity&property of the same class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in d8b9033. Since PropertyValue has a reference to Property no longer needed that field.

Copy link
Member

Choose a reason for hiding this comment

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

There needs to be a propertyValueId, because it tells you the index of the value for the given entity. However, This value is no unique across all PropertyValue instances, precisely because lots of entities will have a property with index 0,1,2,...

If this is not clear, please review content director data model again.

@metmirr
Copy link
Contributor Author

metmirr commented Sep 28, 2020

* I think @iorveth should be more deeply involved in making and reviewing this, he could have cought some of these issus.

* Please introduce explicit `Id` field in all entities, and explain where value comes from. This is unclear here.

Every entity defined in schema.graphql has an Id: ID! field by default.

Copy link
Member

@bedeho bedeho left a comment

Choose a reason for hiding this comment

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

  • The problem with algebraic type has not been resolved.
  • It needs to be explicitly stated what the Id field is for each entity, I believe a random one will be injected by Warthog or some other layer of the data model stack if we do not explicitly control it.

"""
type Class @entity {
"Runtime identifier for class"
classId: BigInt! @unique
Copy link
Member

Choose a reason for hiding this comment

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

replace with id: ID!, and the value should be "Runtime identifier for class".

classId: BigInt! @unique

"Name of class"
name: String!
Copy link
Member

Choose a reason for hiding this comment

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

Are class names non-null? are they unique? I forget.

"'Property' representation, related to a given 'Class'"
type Property @entity {
"Runtime identifier for property in class"
propertyId: Int!
Copy link
Member

Choose a reason for hiding this comment

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

Drop field, replace with new field "id:ID!`, and put value: ClassId+":"+PropertyId from runtime. Comment is then "Runtime class identifier concatenated with property runtime identifier, using colon as separator".

Correct me if I am wrong, ut runtime PropertyId is just an index relative to the class, so its not sufficient in of itself.

"Represents a standard for what information must be associated with any entity of a given class"
type Schema @entity {
"Runtime identifier of schema in class"
schemaId: Int!
Copy link
Member

Choose a reason for hiding this comment

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

Same idea here, replace with "id: ID!" where value is ClassId+":"+SchemaId, so comment says "Runtime class identifier concatinated with schema runtime identifier, using colon as separator".


"Working group participant: working-group/src/types.rs"
interface Worker @entity {
member: Member!
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs Id ?

"A voucher for 'Entity' creation"
type EntityCreationVoucher @entity {
"Class to which voucher applies"
class: Class!
Copy link
Member

Choose a reason for hiding this comment

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

What is Id ?

"Owner of an 'Entity'"
type EntityController @entity {
"Current controller, which is initially set based on who created entity"
controllerType: EntityControllerType!
Copy link
Member

Choose a reason for hiding this comment

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

What is Id?

"""
type Entity @entity {
"Runtime identifier for entity"
entityId: BigInt! @unique
Copy link
Member

Choose a reason for hiding this comment

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

See Id comments.

}

type PropertyValue @entity {
entity: Entity!
Copy link
Member

Choose a reason for hiding this comment

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

What is Id?


"Working group lead: curator lead content-working-group/src"
type Lead implements Worker @entity {
leadId: BigInt! @unique
Copy link
Member

Choose a reason for hiding this comment

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

See Id comments.

@metmirr metmirr force-pushed the content_dir_schema branch from dc06056 to 8810bb5 Compare October 5, 2020 06:13
@metmirr metmirr force-pushed the content_dir_schema branch from 8810bb5 to 71c1fa9 Compare October 5, 2020 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants