> Exception in thread "main" java.lang.Error: Unresolved compilation problem: > The method write(PrintStream) is undefined for the type OntTools.Path

The code says:

public static class Path extends ArrayList<Statement>

There isn't support for reading/writing paths as an array of statements.

You could put the statements (loosing the order) into a model and write that.

Or you can write your own code to print a path.

If you just want to see the path, use .toString (which might get a bit long - in that case you need to write tyour own output format).

        Andy



On 16/07/11 21:54, Herli Joaquim de Menezes wrote:
Hello friends,

I need to output the result of FindShortestPath(Model, start, end, filter)
to a file. I have already tried some methods. I got the result at a variable

Path pathOut  = FSP.findShortestPath(...);

as I print the output, it is ok. I get the right triples

As I try to read it into an RDF file, I got no success:

I am trying this block :

caminho = AchaCaminhoMaisCurto.findShortestPath(m_model, m_a, m_g, ANY);
         System.out.println("Shortest path: " +
(AchaCaminhoMaisCurto.findShortestPath(m_model, m_a, m_g, ANY)));
         try {
             PrintStream saida = new PrintStream ("file_path/saida9.rdf");
             caminho.write(saida);
             //saida.close();

                     } catch (FileNotFoundException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
     }

Compiler says:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
     The method write(PrintStream) is undefined for the type OntTools.Path

     at ferramentas.Principal.main(Principal.java:169)

By the way: I have already tested to write the m_model, of course I got the
whole ontology. That is not what I need, I need only the classes in the
path.
Ok, It is all right, but which writing method should I use with OntTools?

The code is at:  http://fpaste.org/U7ni/

Reply via email to