-
Notifications
You must be signed in to change notification settings - Fork 115
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
Conversation
There was a problem hiding this 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?
There was a problem hiding this 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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here?
There was a problem hiding this comment.
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!] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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!] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 values
field should derive from PropetyValue
, not the other way around.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…ore than one entity
Every entity defined in |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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! |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Id comments.
dc06056
to
8810bb5
Compare
8810bb5
to
71c1fa9
Compare
This PR introduces the content directory graphql input schema for the query node. All the types are defined in the schema expect #1348