You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this document we use markdown checkmarks to indicate patterns that have been included in the schema, brackets to enclose an example of where in the schema, and if the simulation has a working agent that makes use of this/such a pattern.
Design patterns to cover
Here we have some classic design patterns that recur commonly in Graql schemas for all domains.
Transitive group membership (locates-transitive-with-location-hierarchy)
Data-sourcing/prediction/location nested relations (marriage plays locates_located)
Patterns
Following are schema/data patterns that are cases that we would like to ensure work correctly and quickly. This may skip over obvious cases which have been assumed and already added to the World Simulation schema, in effect making this more of a running TODO.
Only employment is implemented Relations (membership)
Attributes (name)
Necessary? Multiple abstract types in an inheritance
Keys
Different types using the same attribute as their key (location-name, although continent, country, city are all within the location hierarchy)
Different types owning the same attribute, one as its key, the other not keyed
Only product-barcode implemented Types using attributes as keys where the attribute types form a hierarchy (identifier-double)
Keying with each datatype:
long (marriage-id, company-number)
double (product-barcode)
string (email, location-name)
boolean
date
Multiple keys for one thing type
Multiple keys for one thing type, with different datatypes
DisallowedAn attribute owned by the parent but used as key by the child
Possible? Necessary? Keying on both of two attributes that are in a hierarchy together
Possible? Can a subtype of a key be used to key the thing keyed by its super type (at insertion time)?
Attributes
Attribute playing a (non-implicit) role in a relation
Easy to implement language on text-content of employment-contract Attribute of attribute (language)
Deemed unnecessary for nowAttribute of attribute of attribute
Attribute hierarchies (sub date-of-event)
All attribute datatypes (not as keys):
long (product-quantity)
double (annual-wage)
string forename
boolean (is-current, is-taxable)
date (start-date)
Implicit relations:
adding new roleplayers to them
Easy to implement currency on annual-wage adding attributes to them
Only implemented for initialisation data Regex for strings (currency, currency-code)
Attribute value updates (AgeUpdateAgent deletes implicit relations to age and inserts new ones)
Box shape where two things are in a hierarchy each owning an attribute, where the attributes are also in a hierarchy (employment-contract sub legal-document combined with contract-content sub text-content)
A thing owning many attributes (instances) of the same type
Relations
Ternary and N-ary relations, with interesting numbers of roleplayers per role
ImplementedOne entity playing 3+ roles (person, company, location)
One relation playing 2+ roles
One relation playing 3+ roles
One relation with 3+ roles played (transaction. relocation)
Unary relation
where a thing instance plays one role once and there are no other roleplayers
Reflexive relation (data-sourcing as an example relation, or a court ruling, which could be on another ruling). There are two senses here:
A relation that plays a role in itself
A thing instance that plays two roles in the same relation instance
The anti-transitive and anti-reflexive are defined easily by the lack of a transitive rule or a reflexive role
Relation/entity/attribute types playing two roles in a relation, where the instances only play one role each (person playing husband and wife in a marriage)
Ragged role hierarchy: a relation that inherits from a parent subtypes the parent's roles, but also introduces new roles not yet seen in the hierarchy (employment_contract role)
Necessary? Inheriting from a role declared in the current relation (not the parent)
Allowed? Inherit role from grandparent relation, skipping the parent
Graql World Simulation Coverage
In this document we use markdown checkmarks to indicate patterns that have been included in the schema, brackets to enclose an example of where in the schema, and if the simulation has a working agent that makes use of this/such a pattern.
Design patterns to cover
Here we have some classic design patterns that recur commonly in Graql schemas for all domains.
membership
,employment
)location-hierarchy-transitivity
)locates-transitive-with-location-hierarchy
)marriage plays locates_located
)Patterns
Following are schema/data patterns that are cases that we would like to ensure work correctly and quickly. This may skip over obvious cases which have been assumed and already added to the World Simulation schema, in effect making this more of a running TODO.
Abstract
location
)transaction
,b2c-transaction
,b2b-transaction
)date-of-event
)organisation
)Only employment is implemented
Relations (membership
)name
)Necessary?
Multiple abstract types in an inheritanceKeys
location-name
, althoughcontinent
,country
,city
are all within thelocation
hierarchy)Only product-barcode implemented
Types using attributes as keys where the attribute types form a hierarchy (identifier-double
)marriage-id
,company-number
)product-barcode
)email
,location-name
)Disallowed
An attribute owned by the parent but used as key by the childPossible? Necessary?
Keying on both of two attributes that are in a hierarchy togetherPossible?
Can a subtype of a key be used to key the thing keyed by its super type (at insertion time)?Attributes
Easy to implement language on text-content of employment-contract
Attribute of attribute (language
)Deemed unnecessary for now
Attribute of attribute of attributesub date-of-event
)product-quantity
)annual-wage
)forename
is-current
,is-taxable
)start-date
)Easy to implement currency on annual-wage
adding attributes to themOnly implemented for initialisation data
Regex for strings (currency
,currency-code
)AgeUpdateAgent
deletes implicit relations toage
and inserts new ones)employment-contract sub legal-document
combined withcontract-content sub text-content
)Relations
Ternary and N-ary relations, with interesting numbers of roleplayers per role
Implemented
One entity playing 3+ roles (person
,company
,location
)transaction
.relocation
)friendship
)friendship
, idea:project-collaboration
)employment
,location-hierarchy
,marriage
,transaction
...)data-sourcing
as an example relation, or a court ruling, which could be on another ruling). There are two senses here:person
playinghusband
andwife
in a marriage)employment_contract
role)Necessary?
Inheriting from a role declared in the current relation (not the parent)Allowed?
Inherit role from grandparent relation, skipping the parentRule formulations
locates-transitive-with-location-hierarchy
,born-in-location-implies-residency
...)locates-transitive-with-location-hierarchy
applies forborn-in
relations)locates-transitive-with-location-hierarchy
,location-hierarchy-transitivity
)born-in-location-implies-residency-date
,person-relocating-ends-old-residency
,person-membership-of-organisation-means-relocation-date
)when
then
(transaction-currency-is-that-of-the-country
)then
(person-relocating-ends-old-residency
,born-in-location-implies-residency-date
)Removed
support for this is dropped in 2.0Inferred complex type (unemployed-person
)Disallowed
Inferred entityborn-in
andresidency
)when
bodies with a relation(s) where the relation(s) don't have a variable ascribed to them (person-membership-of-organisation-means-relocation
)match
queries at the end of each iteration]World elements to model
Other concerns
match $d type my-attribute; $d datatype string; get;
The text was updated successfully, but these errors were encountered: