Thank you, once more, Andy. I think that I missed one point (I discoverd later). The Path from OntTools is an owl model, isn't? I thought that it was an RDF model. What I want to do is apparently simple: 1. Using "findShortesPath" I got a path containing a chained sequence of resources. 2. I need to get these resources by name in order to perform a query on a triple store [RDF metadata stored in SDB, and use Joseki as SPARQL endpoint]; 3. From this query I could access the physical localization of resources (it is recorded in RDF metadata document); 4. Get these resources (collection of xml file) which will be presented to the user. 5. In order to do this, I devised a web based system (MVC). In the model there are javabeans which access a conventional database which saves user preferences etc, and a SDB/Joseki module as the semantic side of the system.
I followed these steps: (1) create a simple test ontology (ok); (2) extract the shortest path (ok); (3) read information on path to query SDB (fail), this is the bottleneck of the research. How pass info from path to the to javabean in order to perform the query? So I wondered if the names of resources could be inserted in a list as strings things would be easier. Thanks, HJdM 2011/7/20 Andy Seaborne <[email protected]> > > 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/ >> >> -- Herli Menezes *Per Astra ad aspera.*
