Hi , I tested the sample. That one works, but just because there is a small error at the end. You're loading model m1 from the database and printing model m. Changing the code to m1.write(), I'm getting the same error as before.
Till. >> Hi Till, Can you please compile and run the sample program below against your installation, which runs as expected for us here and returns the FOAF NS prefix: ============================================================ import com.hp.hpl.jena.query.*; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.*; import java.util.*; import com.hp.hpl.jena.vocabulary.*; import com.hp.hpl.jena.sparql.vocabulary.*; import virtuoso.jena.driver.*; public class VirtExample2 { /** * Executes a SPARQL query against a virtuoso url and prints results. */ public static void main(String[] args) { Model m = VirtModel.createDatabaseModel("foaf:test", "jdbc:virtuoso://pcc:1112", "dba", "dba"); m.setNsPrefix("foaf", "http://xmlns.com/foaf/0.1/"); Resource me = m.createResource("foaf:" + "testPerson"); me.addProperty(RDF.type, FOAF.Person); me.addProperty(FOAF.name, "Test User"); me.addProperty(FOAF.firstName, "Test"); me.addProperty(FOAF.family_name, "User"); m.write(System.out, "RDF/XML-ABBREV"); Model m1 = VirtModel.createDatabaseModel("foaf:test", "jdbc:virtuoso://pcc:1112", "dba", "dba"); System.out.println("========================"); m.write(System.out, "RDF/XML-ABBREV"); } } ============================================================ Output log: ============================================================ $java VirtExample2 <rdf:RDF xmlns:bsbm="http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/" xmlns:sql="sql:" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:bif="bif:" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema>" xmlns:owl="http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl>" xmlns:rev="http://purl.org/stuff/rev#<http://purl.org/stuff/rev>" xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#<http://www.openlinksw.com/schemas/virtrdf>" xmlns:bsbm-inst="http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/" xmlns:mf="http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#<http://www.w3.org/2001/sw/DataAccess/tests/test-manifest>" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema#<http://www.w3.org/2000/10/XMLSchema>" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>" xmlns:rdfdf="http://www.openlinksw.com/virtrdf-data-formats#<http://www.openlinksw.com/virtrdf-data-formats>" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dawgt="http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#<http://www.w3.org/2001/sw/DataAccess/tests/test-dawg>"> <foaf:Person rdf:about="foaf:testPerson"> <foaf:name>Test User</foaf:name> <foaf:firstName>Test</foaf:firstName> <foaf:family_name>User</foaf:family_name> </foaf:Person> </rdf:RDF> ======================== <rdf:RDF xmlns:bsbm="http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/" xmlns:sql="sql:" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:bif="bif:" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema>" xmlns:owl="http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl>" xmlns:rev="http://purl.org/stuff/rev#<http://purl.org/stuff/rev>" xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#<http://www.openlinksw.com/schemas/virtrdf>" xmlns:bsbm-inst="http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/" xmlns:mf="http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#<http://www.w3.org/2001/sw/DataAccess/tests/test-manifest>" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema#<http://www.w3.org/2000/10/XMLSchema>" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>" xmlns:rdfdf="http://www.openlinksw.com/virtrdf-data-formats#<http://www.openlinksw.com/virtrdf-data-formats>" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dawgt="http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#<http://www.w3.org/2001/sw/DataAccess/tests/test-dawg>"> <foaf:Person rdf:about="foaf:testPerson"> <foaf:name>Test User</foaf:name> <foaf:firstName>Test</foaf:firstName> <foaf:family_name>User</foaf:family_name> </foaf:Person> </rdf:RDF> ============================================================ Best Regards Hugh Williams Professional Services OpenLink Software Web: http://www.openlinksw.com Support: http://support.openlinksw.com Forums: http://boards.openlinksw.com/support On 6 Nov 2008, at 08:14, t...@arcor.de<mailto:t...@arcor.de> wrote: Hi Hugh, the error occurs when i create a model with: Model m = VirtModel.createDatabaseModel("foaf:test", "jdbc:virtuoso://localhost:1111", "dba", "dba"); m.setNsPrefix("foaf", "http://xmlns.com/foaf/0.1/"); Resource me = m.createResource("foaf:" + "testPerson"); me.addProperty(RDF.type, FOAF.Person); me.addProperty(FOAF.name, "Test User"); me.addProperty(FOAF.firstName, "Test"); me.addProperty(FOAF.family_name, "User"); immediately after this, i call the Jena method m.write(System.out, "RDF/XML-ABBREV"); and the output is as expected: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dawgt="http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#<http://www.w3.org/2001/sw/DataAccess/tests/test-dawg>" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema#<http://www.w3.org/2000/10/XMLSchema>" xmlns:owl="http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl>" xmlns:bif="bif:" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sql="sql:" xmlns:mf="http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#<http://www.w3.org/2001/sw/DataAccess/tests/test-manifest>" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema>" xmlns:rdfdf="http://www.openlinksw.com/virtrdf-data-formats#<http://www.openlinksw.com/virtrdf-data-formats>" xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#<http://www.openlinksw.com/schemas/virtrdf>"> <foaf:Person rdf:about="foaf:testPerson"> <foaf:name>Test User</foaf:name> <foaf:family_name>User</foaf:family_name> <foaf:firstName>Test</foaf:firstName> </foaf:Person> </rdf:RDF> Next, i'm trying to load the model from the store, i'm doing this with the same method as before: VirtModel.createDatabaseModel("foaf:test", "jdbc:virtuoso://localhost:1111", "dba", "dba"); Is this right, i found no other way to load a model from the store? if i'm calling m.write(System.out, "RDF/XML-ABBREV")now the output is: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>" xmlns:j.0="http://xmlns.com/foaf/0.1/" xmlns:dawgt="http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#<http://www.w3.org/2001/sw/DataAccess/tests/test-dawg>" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema#<http://www.w3.org/2000/10/XMLSchema>" xmlns:owl="http://www.w3.org/2002/07/owl#<http://www.w3.org/2002/07/owl>" xmlns:bif="bif:" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sql="sql:" xmlns:mf="http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#<http://www.w3.org/2001/sw/DataAccess/tests/test-manifest>" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema>" xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#<http://www.openlinksw.com/schemas/virtrdf>" xmlns:rdfdf="http://www.openlinksw.com/virtrdf-data-formats#<http://www.openlinksw.com/virtrdf-data-formats>"> <j.0:Person rdf:about="foaf:testPerson"> <j.0:name>Test User</j.0:name> <j.0:family_name>User</j.0:family_name> <j.0:firstName>Test</j.0:firstName> </j.0:Person> </rdf:RDF> The FOAF NS Prefix is missing. Regards Till ----- Original Nachricht ---- Von: Hugh Williams <hwilli...@openlinksw.com<mailto:hwilli...@openlinksw.com>> An: t...@arcor.de<mailto:t...@arcor.de> Datum: 05.11.2008 10:27 Betreff: Re: [Virtuoso-users] Jena Model without NS Prefix HI Till, Can you provide some sample code to demonstrate this issue, as we have test in-house and method is supported ? Best Regards Hugh Williams Professional Services OpenLink Software Web: http://www.openlinksw.com Support: http://support.openlinksw.com Forums: http://boards.openlinksw.com/support On 31 Oct 2008, at 16:30, t...@arcor.de<mailto:t...@arcor.de> wrote: Hi i'm trying to add an additional NS Prefix to a Jena Model: model.setNsPrefix("foaf", FOAF.NS) but it seems it's not working. When i'm checking the Prefix Map of the model the added prefix is not in there. The Model is created via VirtModel.createDatabaseModel (_modelName, this.v_url, this.v_user, this.v_pwd). Am i missing something? Is this a bug in the Virtuoso Jena API? Cheers, Till ---------------------------------------------------------------------- --- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Virtuoso-users mailing list Virtuoso-users@lists.sourceforge.net<mailto:Virtuoso-users@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/virtuoso-users