knowsys / rulewerk

Java library based on the VLog rule engine
Apache License 2.0
32 stars 13 forks source link

Running the command-line client with 'materialize' not possible #201

Open phil-hanisch opened 3 years ago

phil-hanisch commented 3 years ago

It is not possible to run the command-line client with the argument materialize. It results in the error Unmatched argument at index 0: 'materialize'. Both Rulewerk v0.7.0 and the current master version contain this issue.

Steps to reproduce:

mzattera commented 3 years ago

Same issue here, tried to juggle parameters around but no luck.

mzattera commented 3 years ago

Version 0.6.0 recognizes the command (I have other issues with running the doid example under Windows) but version 0..0 (Latest) does not.

mkroetzsch commented 3 years ago

Yes, this mode of running Rulewerk was damaged during the re-implementation of the Rulewerk shell. In the future, a more flexible way of passing commands to the command-line client will be supported. To some extent, this is already possible as a workaround to this issue. The following works:

echo -e "@load './doid.rls' .\n @reason .\n @query humansWhoDiedOfCancer(?X) ." | java -jar /path/to/standalone-rulewerk-client-0.7.0.jar

This will execute the following three commands:

and then exit. Using the usual syntax, one can also export query results to CSV or materialize all facts to an rls file: see @help query and @help export in the rulewerk shell for details. Please note that @source directives that use paths inside the rls file must use paths that are relative to the location of the rls file.

In this way, arbitrary batch processing of tasks through rulewerk is already possible from the command line, but the interface is still a bit fragile (e.g., the newlines \n in the input are needed at the moment for the parser to work).

marco-calautti commented 1 year ago

This is still an issue in version 0.9