On 06/01/2020 05:50, Ashwani Rathi wrote:
Hi All,
We have the following method where we are using Jena 2

Which version of jena 2 exactly?

, where we are trying to fetch/ create Model object from ModelRDB utility method using com.hp.hpl.jena.db.IDBConnection
     private Model getModelFromRDFStore(String modelName, IDBConnection conn)
     {
         Model model = null;
         if (!conn.containsModel(modelName)) {
             model = ModelRDB.createModel(conn, modelName);
         }
         else {
             model = ModelRDB.open(conn, modelName);
         }

         return model;
     }

com.hp.hpl.jena.db.IDBConnection basically encapsulates a JDBC connection.

Now support for com.hp.hpl.jena.db.IDBConnection and corresponding implementing 
classes has been removed from Jena 3.
This is the functionality which we are trying to replicate in Jena 3.

See prvious reply - it depends on what the application is trying to do, and what sort fo reliability of data it requires.

For just a local data base, use TDB.
Note: all storage in jena3 is based on "Datasets", not "Models". Use the default model of a dataset for a single RDF graph in a database.

For a database on a remote server shared between several instances of your application, use Fuseki with TDB and interface RDFConnection.



So can you please guide how can we achieve this functionality in Jena 3 using 
TDB or something else?

Dataset dataset = TDB2Factory.connectDataset("some directory");
dataset.getDefaultModel();

but also all access to the database needs to be in a dataset transaction See Txn and the documentation

https://jena.apache.org/documentation/txn/

    Andy


Regards,
Ashwani

On 06/01/20, 3:55 AM, "Andy Seaborne" <a...@apache.org> wrote:

On 05/01/2020 09:15, Ashwani Rathi wrote:
     > Hi,
     >
     > We are upgrading from jena 2 to jena 3 in our project.
     >
     > While jena used to have the following two classes in jena.jar:
     > com.hp.hpl.jena.db.DBConnection
     > com.hp.hpl.jena.db.IDBConnection
That is the very old RDB layer; I am no sure it was ever released as
     Apache Jena release. Which version of Jena do you have? 2.6.4 or earlier?
> there are no such classes in jena 3 There have been a lot of changes, including going from RDF 1.0 to RDF 1.1. > We are using these classes in our project.
     >
     > Can someone guide me or provide a prototype on what claaes in jena 3 can 
be used to provide functionality for these missing classes?
The current persistent storage options are TDB (TDB1, and TDB2). These
     are custom RDF storage systems.  They scale better, load faster, run
     faster and are more robust than RDB. There is a SQL-backed storage
     system as well but we don't recommend it for any new work - and it is
     not compatible in any way with RDB.
But if, as I suspect, this is a big version jump, maybe the place to
     start is describing what use of RDF is made by your project?  Is it
     using the Model API? Some early SPARQL?
Andy > Regards,
     >
     > Ashwani
     >
     >

Reply via email to