Hi Sergio,

We have written the attached program to try and test the issue you report:

import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.rdf.model.*;
import java.util.Iterator;
import java.io.*;

import virtuoso.jena.driver.*;

public class V_TEST_UNI {

/**
 * Executes a SPARQL query against a virtuoso url and prints results.
 */
public static void main(String[] args) {


String conn_str = "jdbc:virtuoso://hostname:portno";

try {

  VirtGraph set = new VirtGraph ("virt:UNI", conn_str, "dba", "dba");
  set.clear();

  Model md = VirtModel.createDatabaseModel("virt:UNI", conn_str, "dba", "dba");

         md.read(new FileInputStream("t_uni8.rdf"), "http://www.example.org/");


  System.out.println("==Inserted==");

  Model md1 = VirtModel.createDatabaseModel("virt:UNI", conn_str, "dba", "dba");
         md1.write(new FileOutputStream("my_out.rdf"), "RDF/XML-ABBREV");
  System.out.println("==Save copy==");

} catch (Exception e) {
  System.out.println("Exception=="+e);
}

}
}

The attached file (t-uni8.rdf) contains some sample Spanish and French words, which we have been able to read in and retrieve the correct data multiple times:

SQL> sparql select * from <virt:UNI> where {?s ?p ?o};
s                                                                                 p                                                                                 o
VARCHAR                                                                           VARCHAR                                                                           VARCHAR
_______________________________________________________________________________

http://www.example.org/#Resource                                                  http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.w3.org/2000/01/rdf-schema#Class
http://www.example.org/#Resource                                                  http://www.w3.org/2000/01/rdf-schema#label                                        Resource
http://www.example.org/#Resource                                                  http://www.w3.org/2000/01/rdf-schema#label                                        Ressource
http://www.example.org/#Literal                                                   http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.w3.org/2000/01/rdf-schema#Class
http://www.example.org/#Literal                                                   http://www.w3.org/2000/01/rdf-schema#label                                        Literal
http://www.example.org/#Literal                                                   http://www.w3.org/2000/01/rdf-schema#label                                        Littéral
http://www.example.org/#Organisation                                              http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.w3.org/2000/01/rdf-schema#Class
http://www.example.org/#Organisation                                              http://www.w3.org/2000/01/rdf-schema#label                                        Organisation
http://www.example.org/#Organisation                                              http://www.w3.org/2000/01/rdf-schema#label                                        Organización

9 Rows. -- 8 msec.
SQL> 

Or checking the created  "my_out.rdf" file the program reads the data store to.

Can you try this yourself ...

Best Regards
Hugh Williams
Professional Services
OpenLink Software

Attachment: t_uni8.rdf
Description: Binary data


On 4 Sep 2009, at 09:09, Sergio Fernández wrote:

Dear Hugh,

we were making some more tests, and we found a curious behavior: after
startup the server, encoding issue disappears the first time that we
insert data using VirtModel, but it reappears in the followings.

So it looks a problem with any open socket in the JDBC driver or
something like that. We tried to explicit call VirtModel.close(), but
that doesn't solve the problem.

Any idea?

Best,

--
Sergio Fernández - sergio.fernan...@fundacionctic.org
R&D Deparment
CTIC Foundation - www.fundacionctic.org
Phone: +34 984 29 12 12
Fax:  +34 984 39 06 12
Edificio Centros Tecnológicos
Parque Científico Tecnológico
33203 Cabueñes - Gijón - Asturias - Spain


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to