gtfierro/reasonable

set rules

Opened this issue · 5 comments

Hello, could I ask you if it is possible to set some rules and according to these rules the reasonable reasoner can decide stuff? Like the hermit reasoner??

Hi @DionysiaV ! I'm not super familiar with the Hermit reasoner, but in reasonable all of the rules are hardcoded into the binary (see this terribly long method)

Hi @gtfierro... Well maybe I should explain to you what I want to do, cause I am not sure that I completely understand this terribly long method :)...

So, I want to create a test, in which I can access a sub-class. And then if this sub-class exists then I can call a function or print something..

What do you think?

I would also like to ask you one more thing... I can only load .n3 files?? And how can I generate .n3 files?
Do you think that it would be possible to extract a .n3 file from the protégé app???

Thankssss

N-triples (n3) is one of the common serialization formats for RDF graphs; you should be able to change the reasonable source code to import from a different format if you need (the parsing library should support most common ones), or you can export n-triples from protege.

If I understand your intended task, then could you not run the existing reasoner and then query the resulting graph for the subclass or instances of the subclass? Or do you want the reasoner to execute custom logic when certain conditions are met during the evaluation process?

Hello again,

  • Well for exporting the n-triples from protege is not possible, because in the protege 5.5 I do not have the n-triples option.. But I am now downloading older versions of protege to see if it is possible to export the n-triples file...

so, in no previous version of protege I have the option of exporting it in n-triples.. But, I saved the file as turtle, and since protege gives the default extension of .owl, I just changed the extension of the file to .ttl and it works... So it is ok no need to reply for this..

  • For modifying the source code for accepting .owl file (owl/xml syntax), how can I do it??

no need any more cause I will use the .ttl file

  • For my intended task, right now I run the existing reasoner and then I query instances of the subclass, however I would like to see if it is possible for the reasoner to execute custom logic when certain conditions are met during the evaluation process and maybe print a response or an outcome to this.....

What do you think??

If you use the Python bindings then you can use RDFlib to load a graph from whatever import format you want and then provide it to the reasoner. If you are running reasonable as a Rust library then you may want to look at this method

I think it would be somewhat complex to execute custom logic during the evaluation process. If you can avoid doing so, I would recommend it. During the evaluation process there may be certain conditions that will become true later that will invalidate your logic. For example, an instance may be inferred to be members of two disjoint classes --- at an intermediate stage of evaluation, you may believe it is only an instance of one of those classes. As long as your conditions are monotonic, then you should be ok. However, there is no "easy" way to add these custom hooks other than editing the large method I linked above.