m-ld / m-ld-js

m-ld Javascript engine
https://js.m-ld.org
MIT License
37 stars 2 forks source link

Should be able to `@construct` with a property variable in a nested subject #145

Open Peeja opened 1 year ago

Peeja commented 1 year ago
test('constructs with a property variable in a nested subject', async () => {
  await api.write<Subject>({ '@id': 'fred', stats: { height: 5, age: 40 } } );
  await expect(api.read<Construct>({
    '@construct': { 'stats': { '?': 5 } }
  })).resolves.toEqual([{
    "@id": "fred",
    "stats": {
      '@id': expect.stringMatching(genIdRegex),
      height: 5
    }
  }]);
});

Throws:

Error: Unhandled error. (Error: No index compatible with pattern {"subject":{"termType":"NamedNode","value":"http://test.m-ld.org/.well-known/genid/clg5fa9310002n2y11syg04xb"},"object":{"termType":"Literal","value":"5","language":"","datatype":{"termType":"NamedNode","value":"http://www.w3.org/2001/XMLSchema#integer"}},"graph":{"termType":"DefaultGraph","value":""}} and options {}