Way to save/load a set of facts?

Issue #69 new
Former user created an issue

Hi! I need to load an ontology that is originally defined in an RDF/XML file, and then programmatically add axioms to it before asking Fact++ to do inference. Problem is that the app that programmatically add facts is in C, and cannot use Java.

So I can use OWLAPI and Fact++.Java to read this RDF/XML file and create a Fact++ kernel and all, but then I would need a way to "serialize" either: - the facts in lisp syntax - the FACT++ kernel - or any other internal representation

and then read that back in my C application before starting to add new axioms.

Is there a way to do that?

Comments (9)

  1. Yves

    After investigating a bit, it seems that the functions

        void Save ( void );
            /// load internal state of the Kernel using S/L Manager
        void Load ( void );
    

    from Kernel.h are not callable from Java or FaCT++.C.

  2. Yves

    Okay, it should be dumped when calling FaCTPlusPlus::classify, but it seems this method is never called by Fact++ in Java

  3. Yves

    So I'm forcing the call to classify from Java, and the generated file is empty. That's weird because I get sensible results otherwise (like getting some subclasses through the reasoner).

  4. Yves

    I identified the culprit:

        if ( !useIncrementalReasoning )
            return;
    

    no dumping happens when incremental reasoning is disable.

  5. cbobed

    Hi Yves,

    from the OWLAPI that the method precomputeInferences(...) should also trigger the status save process.

    By the way, do you know how to put the incrementalReasoning value to true when Fact++ is used from OWLAPI? I've tried putting useIncrementalReasoning=true both in .fpp-options and fpp-options.txt files in the directory where the .dll is, but it seems that it does not have any effect.

    Cheers

  6. Dmitry Tsarkov repo owner

    Hi Yves,

    Sorry for not looking into the issue before. The Save() and Load() method wouldn't help you as they only dump/restore the internal state of a reasoner with the whole ontology. It is very hard to edit those files.

    I think you've chosen the best approach: dump an ontology into LISP format, then (once or as required) enrich it with additional axioms and then load it to the reasoner. Note that you shouldn't call classify() or any query function to an ontology before adding new axioms. All queries enforce some preprocessing and/or reasoning. After preprocessing is performed, newly added axioms has no effect (unless you are in the incremental mode)

  7. Dmitry Tsarkov repo owner

    Hi Carlos,

    The incremental reasoning is meant to be used in non-buffered mode, similarly to the Pellet's one. It is however not implemented yet, as incremental mode is still more-or-less experimental. I'll see whether it would be easy to implement the above.

  8. Yves

    Hi Dmitry,

    Yeah I managed to make it work by dumping an ontology into lisp format.

    Now I have a related issue: the ABox that my program is generating seems to be wrong, as Fact++ complains that:

    terminate called after throwing an instance of 'EFPPInconsistentKB'
      what():  FaCT++ Kernel: Inconsistent KB
    Aborted (core dumped)
    

    So I'm dumping the facts that I gave to Fact++, so I can check them. Now, I want to do the reverse of what I did before: I want to transform the lisp representation into, say, OWL/XML. This way I could load that owl file into Protégé and that would help me diagnose what is wrong with my ABox.

    Is there a way to do this with OWLAPI? Ask the reasoner to load the lisp and then dump an OWL file?

  9. Log in to comment