Hi Cong,

I compiled your test app and it runs successfully against my Linux develop7 
build:


VIRTMAIN@vpn184:~/binsrc/jena2/virtuoso_driver$ javac -classpath 
".:../lib/junit-4.5.jar:../lib/jena-arq-2.10.1.jar:../lib/jena-iri-0.9.6.jar:../lib/jena-core-2.10.1.jar:../lib/jena-core-2.10.1-tests.jar:../../../libsrc/JDBCDriverType4/virtjdbc4.jar:../virt_jena2.jar:../lib/jcl-over-slf4j-1.6.4.jar:../lib/log4j-1.2.16.jar:../lib/slf4j-api-1.6.4.jar:../lib/slf4j-log4j12-1.6.4.jar:../lib/xercesImpl-2.11.0.jar:../lib/xml-apis-1.4.01.jar"
 Main1.java
VIRTMAIN@vpn184:~/binsrc/jena2/virtuoso_driver$ java -classpath 
".:../lib/junit-4.5.jar:../lib/jena-arq-2.10.1.jar:../lib/jena-iri-0.9.6.jar:../lib/jena-core-2.10.1.jar:../lib/jena-core-2.10.1-tests.jar:../../../libsrc/JDBCDriverType4/virtjdbc4.jar:../virt_jena2.jar:../lib/jcl-over-slf4j-1.6.4.jar:../lib/log4j-1.2.16.jar:../lib/slf4j-api-1.6.4.jar:../lib/slf4j-log4j12-1.6.4.jar:../lib/xercesImpl-2.11.0.jar:../lib/xml-apis-1.4.01.jar"
 Main1
log4j:WARN No appenders could be found for logger 
(com.hp.hpl.jena.util.FileManager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more 
info.
VIRTMAIN@vpn184:~/binsrc/jena2/virtuoso_driver$

SQL> status('');
REPORT
VARCHAR
_______________________________________________________________________________

OpenLink Virtuoso  Server
Version 07.10.3211-pthreads for Linux as of Jan 24 2015 
Started on: 2015-01-26 18:33 GMT+1


Can you provide a copy of your virtuoso.ini for comparison ?

Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.      //              http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers

> On 30 Jan 2015, at 09:42, Cong Kinh Nguyen <congkinh.ngu...@inria.fr> wrote:
> 
> import java.util.ArrayList;
> import java.util.List;
> import java.util.Random;
> 
> import virtuoso.jena.driver.VirtGraph;
> import virtuoso.jena.driver.VirtuosoUpdateFactory;
> import virtuoso.jena.driver.VirtuosoUpdateRequest;
> 
> public class Main {
> 
>    private static final String PROFILE_URI = 
> "http://data.linkedevents.org/person/";;
> 
>    private static final String SCHEMA_URI = "http://schema.org/";;
>    private static final String PROFILE_PREFIX = "prefix profile: 
> <http://test.com/ontology/profile/> ";
>    private static final String PREFIXES = "prefix rdf: 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
>            +"prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
>            +"prefix foaf:  <http://xmlns.com/foaf/0.1/> "
>            +"prefix schema:    <" + SCHEMA_URI + "> "
>            +"prefix xsd: <http://www.w3.org/2001/XMLSchema#> "
>            + PROFILE_PREFIX
>            +"prefix frap:  <http://purl.org/frap#> "
>            +"prefix dc:    <http://purl.org/dc/elements/1.1/> "
>            + "prefix fn: <http://www.w3.org/2005/xpath-functions#>";
> 
>    public static void main(String[] args) {
> 
>        createUsers();
>    }
> 
>    private static void createUsers() {
>        final int numberOfThreads = 15;
>        final int loopCounts = 1;
>        Runnable runnable = new Runnable() {
> 
>            @Override
>            public void run() {
>                for (int i = 0; i < loopCounts; i++) {
>                    createUser1();
>                }
>            }
>        };
> 
>        for (int i = 0; i < numberOfThreads; i++) {
>            new Thread(runnable).start();
>        }
>    }
> 
> 
>    private static void createUser1() {
>        String uid = String.valueOf(System.nanoTime()); // random uid
>        String profileImage = "https://www.google.fr/images/srpr/logo11w.png";;
>        String givenName = "GN" + uid;
>        String familyName = uid + "FN";
> 
>        Random random = new Random();
>        int val = random.nextInt(2);
>        String gender = null;
>        if (val == 0) {
>            gender = "Female";
>        } else {
>            gender = "Male";
>        }
> 
>        saveUserProfile(uid, givenName, familyName, profileImage, gender);
>    }
> 
> 
>    private static void saveUserProfile(String uid, String firstName, String 
> lastName, String profileImage, String gender) {
>        VirtGraph graph = new VirtGraph ("jdbc:virtuoso://localhost:1111/",
>                "dba", "dba");
>        List <String> queries = new ArrayList <String>();
>        queries.add(setUser(uid));
>        queries.add(setGender(uid, gender));
>        queries.add(setName(uid, firstName, lastName));
> 
>        VirtuosoUpdateRequest vurToInsertData = null;
> 
>        for (String query: queries) {
>            if (vurToInsertData == null) vurToInsertData = 
> VirtuosoUpdateFactory.create(query, graph);
>            else vurToInsertData.addUpdate(query);
>        }
> 
>        if (vurToInsertData != null) vurToInsertData.exec();
> 
>        graph.close();
>    }
> 
>    private static String makeUser(String uid) {
>        String query= " <"+ PROFILE_URI+uid+"> profile:userID \""+uid+"\" . ";
>        return query;
>    }
> 
>    private static String setUser(String uid){
>        String query = PREFIXES
>                + " INSERT DATA { GRAPH <"+ getGraphName(uid) +"> "
>                + " { ";
>        query+= makeUser(uid);
>        query+= "}}";
>        return query;
>    }
> 
>    private static String setGender(String uid, String gender ){
>        String query=PREFIXES
>                + "INSERT DATA { GRAPH <"+ getGraphName(uid) +"> "
>                + "{ ";
>        if (gender==null || gender.isEmpty())
>            gender="unknown";
>        query+= "<"+PROFILE_URI+uid+"> schema:gender \""+gender+"\" ."
>                + "}}";
>        return query;
>    }
> 
>    private static String makeNameQuery(String uid,
>            String firstName, String lastName) {
>        String query = "  <"+PROFILE_URI+uid+"> schema:givenName \""+ 
> firstName +"\".";
>        query+= "  <"+PROFILE_URI+uid+"> schema:familyName \""+lastName+"\".";
>        return query;
>    }
> 
> 
>    private static String setName(String uid, String firstName, String 
> lastName ){
>        String query=PREFIXES
>                + "   INSERT DATA { GRAPH <"+ getGraphName(uid) +">"
>                + "  { ";
>        query+= makeNameQuery(uid, firstName, lastName);
>        query+= "}}";
>        return query;
>    }
> 
>    private static String getGraphName(String uid) {
>        return "http://test.com/private/";;
>    }
> }


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to