Problem with installing jena TDB

11 views
Skip to first unread message

Venkatesh U

unread,
Jun 22, 2009, 3:27:47 AM6/22/09
to inqle...@googlegroups.com
Hi Dave,

I am facing problem in installing the Jena TDB. I downloaded the file tdb-0.8.1.zip, unzipped it and
from the root directory I am trying to run the script tdbverify

I am getting this error
Can you please help

vumaasha@vumaasha--idc /cygdrive/d/Venkatesh/
softwares/INQLE-0.3.0/JenaTDB/tdb-0.8.1/TDB-0.8.1
$ bin/tdbverify
Exception in thread "main" java.lang.NoClassDefFoundError: tdb/tdbverify
Caused by: java.lang.ClassNotFoundException: tdb.tdbverify
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: tdb.tdbverify.  Program will exit.

--
Thanks and Best Regards,
Venki

David Donohue

unread,
Jun 22, 2009, 6:40:13 AM6/22/09
to inqle...@googlegroups.com
Venki,
Hmm. That's odd. I have not run tdbverify. I have used none of the
TDB command line tools in fact. I have only used the TDB Java API.
The best place to get answers on anything related to Jena is the Jena
Yahoo group. You will be in communication with the designer of TDB,
Andy Seaborne. You will probably have an answer within a few hours.
http://tech.groups.yahoo.com/group/jena-dev/

Ah, but I see you already found this group. Nice
Dave

Venkatesh U

unread,
Jun 22, 2009, 6:48:07 AM6/22/09
to inqle...@googlegroups.com
Hi Dave,
 I ve emailed the jena-dev group. Can you tell me more on how to jena TDB java API?

some sample code listings would help

also have one more question. The version of TDB I downloaded is
TDB-0.8.1, from the wiki pages I understand that this includes the jena
framework also.

At the same time jena framework of version Jena-2.6.0 is also available.Is this
version latest of jena framework than what is shiped with TDB, I am currently
using Jena-2.6.0 to work with RDF and sparql inmemory models. And it is working
fine.

Will I be able to use the TDB-0.8.1 with Jena-2.6.0?

In jena API

I use the below code to create a model

Model model = ModelFactory.createDefaultModel();

But while using TDB, the documentation page says model should be created through
this code

String directory = "MyDatabases/DB1" ;
Model model = TDBFactory.createModel(directory) ;

What happens when the above code snippet gets executed? Does it create a model
and save it in the disk? Then I can add statements to this model? When the added
statements will get saved to the disc?
Venkatesh Umaashankar
Applications Engineer,
ORACLE,
Mailto    : venka...@gmail.com
Landline : 918040298793
Mobile   :  919902330421
Website: http://www.oracle.com

Arise, awake and stop not till the goal is reached - Swami Vivekanandha

David Donohue

unread,
Jun 22, 2009, 8:08:42 AM6/22/09
to inqle...@googlegroups.com
Venki,
See class TDBConnector on how we are creating TDB databases
http://code.google.com/p/inqle/source/browse/trunk/org.inqle.data.rdf.jenabean/src/main/org/inqle/data/rdf/jena/tdb/TDBConnector.java

TDB 0.8.1 works witht he latest Jena. I believe it ships with Jena
2.6.0. Could not find the announcement verifying this, but I am
pretty sure.

This
> Model model = ModelFactory.createDefaultModel();
creates an in-memory Jena model.

SDB introduced RDF models stored in relational databases like Oracle,
MySQL, a half dozen others. SDB however has slower performance
however than TDB.

> String directory = "MyDatabases/DB1" ;
> Model model = TDBFactory.createModel(directory) ;
>
> What happens when the above code snippet gets executed? Does it create a
> model
> and save it in the disk? Then I can add statements to this model? When the
> added
> statements will get saved to the disc?

Yes it should. In inqle we use 3 means to connect to TDB:
(1) Using the Jena API. This allows us to do things like
Model.listStatements(),
ResourceFactory.createStatement()

(2) using the Jenabean API.
http://code.google.com/p/jenabean/
Jenabean is an add-on to Jena, that permits storing and retrieving
Java objects from your Jena model (stored in this case in TDB). Very
slick capability of storing Java objects as RDF, which can be
retrieved or queried using SPARQL.
Inqle's class Persister handles the Jenabean operations:
Persister persister = Persister.getInstance();
//save an object to a model:
persister.persist(myObject, model);
//load an object from a model
SimpleSubjectSparqlSampler mySampler =
persister.reconstitute(SimpleSubjectSparqlSampler.class, mySamplerId,
modelContainingSamplers);

Please see class Persister for more on using the Jenabean API.
http://code.google.com/p/inqle/source/browse/trunk/org.inqle.data.rdf.jenabean/src/main/org/inqle/data/rdf/jenabean/Persister.java

The Persister class contains our methods for creating new TDB databases as well.
(3) using SPARQL queries. Here we use our Queryer class
private static final String SPARQL_SELECT_CLASSES_TABLE = "PREFIX
rdfs: <" + RDF.RDFS + "> \n" +
"SELECT DISTINCT " +
"?" + CLASS_URI_VAR + " ?Name ?Description { GRAPH ?anyGraph { \n " +
"?subject a ?" + CLASS_URI_VAR + " ." +
"OPTIONAL { ?" + CLASS_URI_VAR + " rdfs:label ?Name} . \n" +
"OPTIONAL { ?" + CLASS_URI_VAR + " rdfs:comment ?Description} . \n" +
"} } \n";
QueryCriteria queryCriteria = new QueryCriteria();
queryCriteria.addDatamodel(datamodelId);
queryCriteria.setQuery(SPARQL_SELECT_CLASSES_TABLE);
ResultSetRewindable results = Queryer.selectResultSet(queryCriteria);

Please see Queryer for more on how we work with queries
http://code.google.com/p/inqle/source/browse/trunk/org.inqle.data.rdf.jenabean/src/main/org/inqle/data/rdf/jena/Queryer.java

I hope this helps!
Dave

Reply all
Reply to author
Forward
0 new messages