comunica / comunica-feature-reasoning

📬 Comunica packages for reasoning during query execution
MIT License
5 stars 5 forks source link

Feature: Improve validation of Hylar Rules #31

Open jeswr opened 2 years ago

jeswr commented 2 years ago

At the same time we should probably implement this as a stream parser (perhaps based on the ttl parser in the N3 package). In particular the tests that we should get passing are

it('Should error on invalid rules', async () => {
      await expect(actor.run(createMediaTypedAction('->', false))).resolves.toThrowError();
      await expect(actor.run(createMediaTypedAction('invalid1'))).resolves.toThrowError();
      await expect(actor.run(createMediaTypedAction('invalid2'))).resolves.toThrowError();
      await expect(actor.run(createMediaTypedAction('invalid3'))).resolves.toThrowError();
    });

and possibly the following commented out tests in the following test suite

 it('should test', async() => {
      expect(await actor.test(createMediaTypedAction('rdfs'))).toEqual({ handle: true });
      // Expect(await actor.test(createMediaTypedAction('invalid1'))).toEqual({ handle: false });
      // expect(await actor.test(createMediaTypedAction('invalid2'))).toEqual({ handle: false });
      // expect(await actor.test(createMediaTypedAction('invalid3'))).toEqual({ handle: false });
    });
jeswr commented 2 years ago

In addition the Hylar parser will produce incorrect outputs if '->', '^', '(' or ')' occurs in a string or url