Hi Jackson,
thank you for creating this clever tool for RDF abstraction! I wanted to try it since I saw your presentation at the Solid Symposium.
Issue
I think I found a small bug when using ShEx value sets for enum-like constraints: The TS type/interface says { '@id': "enumname" } for the property but the belonging object property is a set.
- @ldo/ldo: 1.0.0-alpha.32
- @ldo/cli: 1.0.0-alpha.32
Example
myclass.shex
ex:MyClassShape {
ex:state [ex:loading ex:success ex:error]
}
myclass.typings.ts
interface MyClass {
state:
| {
"@id": "loading";
}
| {
"@id": "success";
}
| {
"@id": "error";
};
myclass.schema.ts
expressions: [
{
type: "TripleConstraint",
predicate: "http://ex.org/ontology#state",
valueExpr: {
type: "NodeConstraint",
values: [
"http://ex.org/ontology#loading",
"http://ex.org/ontology#success",
"http://ex.org/ontology#error",
],
},
},
myclass.context.ts
state: {
"@id": "http://ex.org/ontology#state",
"@isCollection": true,
},
console.log(ldoObject.state) -> ObjectSetProxy
console.log(ldoObject.state?.['@id']) -> undefined
The IDE suggests ldoObject.state?.['@id'] (which is undefined) but the value is hidden here (ldoObject.state as any).toArray()[0]['@id'].
It is probably caused by the cardinality constraint of 1 or 0-1 (?). If I specify a cardinality of 0 or more (*), the typing as set LdSet is correct.
ex:MyClassShape {
ex:state [ex:loading ex:success ex:error] *
}
Merry Christmas and a happy New Year!
Hi Jackson,
thank you for creating this clever tool for RDF abstraction! I wanted to try it since I saw your presentation at the Solid Symposium.
Issue
I think I found a small bug when using ShEx value sets for enum-like constraints: The TS type/interface says { '@id': "enumname" } for the property but the belonging object property is a set.
Example
myclass.shex
myclass.typings.ts
myclass.schema.ts
myclass.context.ts
console.log(ldoObject.state) -> ObjectSetProxy
console.log(ldoObject.state?.['@id']) -> undefined
The IDE suggests
ldoObject.state?.['@id'](which is undefined) but the value is hidden here(ldoObject.state as any).toArray()[0]['@id'].It is probably caused by the cardinality constraint of 1 or 0-1 (
?). If I specify a cardinality of 0 or more (*), the typing as setLdSetis correct.Merry Christmas and a happy New Year!