gtfierro / reasonable

OWL 2 Reasoner built on DataFrog
BSD 3-Clause "New" or "Revised" License
67 stars 4 forks source link

set rules #11

Open DionysiaV opened 2 years ago

DionysiaV commented 2 years ago

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??

gtfierro commented 2 years ago

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)

DionysiaV commented 2 years ago

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

gtfierro commented 2 years ago

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?

DionysiaV commented 2 years ago

Hello again,

What do you think??

gtfierro commented 2 years ago

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.