Hi,

Nothing leaps out as wrong with the piece of the code that you have shown so the next step would be for you to start debugging. Check whether any derivations are being found, if so check whether they can be serialized to the console.

If no derviations are being found then maybe your haven't switched on derivation logging or maybe your rules are not being fired.

If you really get stuck then create a complete minimum test case you can post. In your case that would mean creating a minimum data sample and rule set as well as the code to run it. You might well find that in the process of creating that minimal test case you find the problem :)

Dave

On 17/07/12 15:30, Alejandro Rodríguez González wrote:
Hi,

I continue with the problem that I've posted on jena-dev @ yahoo. I change
the code to close the stream out of the loop. This is the new code:

http://pastebin.com/GhQXe2tg

The problem is that the generated files continue empty :-/

Thanks,

Alejandro

--- In [email protected], "jalo_rg" <alejandro.rod.gnz@...> wrote:

Silly mistake!

Thanks Dave! And sorry for posting here, I saw the deprecation just after
send the email.

Thanks!

--- In [email protected], Dave Reynolds <dave.e.reynolds@> wrote:

This list is deprecated, jena support has moved to Apache, see:
http://jena.apache.org/help_and_support/index.html

Your problem is that you are closing the output stream within the loop:

    while (sti.hasNext()) {
       Statement st = (Statement) sti.next();
       for (Iterator<?> id = this.inferenceModel.getDerivation(st); id
                                          .hasNext();) {
          Derivation deriv = (Derivation) id.next();
          deriv.printTrace(out, true);
        }
        ...
        out.flush();
        out.close();
    }

So after the first iteration out is closed. If the first statement in
the iterator happens to be a fact with no derivation then the first
iteration doesn't generate any output and you end up with an empty file.

Don't know why you aren't seeing IOExceptions.

Dave

On 16/07/12 16:56, Alejandro Rodríguez González wrote:
Hello to all,


I'm trying to see the derivation of some rules that I developing but
the
derivation files that the code creates always are empty.

I don't know if it is a problem with my code or maybe some bug.

Here is the code:

http://pastebin.com/P8EqXcXP

The files are created correctly (explc1.txt - explc4.txt) but they
have
no content. If I change the PrintWriter to print in screen
(System.out)
and it seems to crash. The normal output (writing to file), returns
the
following:

http://pastebin.com/0u8TSATb

If I change the PrintWriter to System.out it "cuts" (finish) and only
shows this (but without errors or exceptions):

http://pastebin.com/PA5KFmmk

I also have some doubts with my rules since they are not working as I
expected, but maybe I can fix it if I can access to the derivation (to
see what is going wrong).

Thanks!



Reply via email to