Open timathom opened 1 year ago
I just tested editing functionality for inherited (top-level) classes in TerminusCMS. The schema below produces the following editing form in TerminusCMS:
Here, I am able to select an inheriting class as my instance type.
However, in DFRNT, I do not have this option:
See the inheritance_test
data product in DFRNT to reproduce.
[
{
"@base": "https://lux.collections.yale.edu/data/",
"@metadata": {
"DFRNT": {"defaultLabelProperty": "rdfs:label"}
},
"@schema": "terminusdb:///schema#",
"@type": "@context",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
},
{
"@abstract": [],
"@id": "EntityType",
"@type": "Class",
"rdfs:label": {
"@class": "xsd:string",
"@type": "Set"
}
},
{
"@documentation": {
"@label": "My Record",
"@properties": {
"rdfs:label": {"@label": "_label"}
}
},
"@id": "MyRecord",
"@inherits": "EntityType",
"@key": {"@type": "Random"},
"@type": "Class",
"@unfoldable": [],
"references": {
"@class": "EntityType",
"@type": "Set"
}
},
{
"@documentation": {
"@label": "Place",
"@properties": {
"rdfs:label": {"@label": "_label"}
}
},
"@id": "E53_Place",
"@inherits": "EntityType",
"@key": {"@type": "Random"},
"@type": "Class",
"@unfoldable": [],
"P1_is_identified_by": {
"@class": "E33_E41_Linguistic_Appellation",
"@type": "Set"
}
},
{
"@documentation": {
"@label": "Name",
"@properties": {
"P190_has_symbolic_content": {"@label": "content"}
}
},
"@id": "E33_E41_Linguistic_Appellation",
"@key": {"@type": "Random"},
"@subdocument": [],
"@type": "Class",
"P190_has_symbolic_content": {
"@class": "xsd:string",
"@type": "Optional"
}
},
{
"@documentation": {
"@label": "Person",
"@properties": {
"P1_is_identified_by": {"@label": "identified by"},
"rdfs:label": {"@label": "_label"}
}
},
"@id": "E21_Person",
"@inherits": "EntityType",
"@key": {"@type": "Random"},
"@type": "Class",
"@unfoldable": [],
"P1_is_identified_by": {
"@class": "E33_E41_Linguistic_Appellation",
"@type": "Set"
}
}
]
This is great input. Looks non-trivial to fix immediately, but will be updating as I find solutions to it.
Some additions based on reflections and conversation:
If you can consider more of the specifics @timathom, they would be great to add here. I consider that types from the document would be checked to both be valid, and if valid according to the schema, a custom validator instance would be created for it, so that the form follows the form of the document, given selectors for subdocument types, if more than one option is possible.
There are some implications that will need to be weighed here. At least the problem definition starts to become clear.
There is now a fix in the QA environment which now properly recognises both abstract subdocuments, and allows specific type selection when multiple selections are possible:
Please test to ensure it works as you expect! I created a branch philippe_issue_16 where I tested a bit! I even created an additional inherited one, and they behave as expected now.
Describe the bug My schema defines a subdocument class (
E33_E41_Linguistic_Appellation
) that inherits from an abstract (subdocument) class (tdb:IdentifierOrNameType
). Instance documents that conform to the schema display correctly in DFRNT.A record looks like this:
However, when I try to edit the record and add a new subdocument entry for
P1_is_identified_by
, the abstract class is inserted as the@type
:When I try to save the edited record, an error is thrown (see screenshot).
To Reproduce Steps to reproduce the behavior:
P1_is_identified_by
Expected behavior When one or more classes inherit from an abstract class, there needs to be a way to select the specific class that is desired as the object type. In my example, I should be given the option to select
E33_E41_Linguistic_Appellation
(or it could be inserted as the default, since in this case it is the only class that inherits fromtdb:IdentifierOrNameType
).Screenshots
Info (please complete the following information):
Additional context Schema