Hi,
Thanks for pointing it out. 
Yes we are not upgrading to jena 3 now as the package structure in jena 3 is 
very different from jena 2. So we decided to first upgrade to jena version 
2.13.0
Current jena version in our project is 2.8.8

Other details provided in the previous mail are same.
We are getting the two issues mentioned in the mail below while trying to 
upgrade to jena version 2.13.0
Can you please help in finding out what is the issue here?

Regards,
Ashwani

On 15/01/20, 8:32 PM, "ajs6f" <aj...@apache.org> wrote:

    I'm a little confused. You say you are trying to use Jena 3, but that 
stacktrace features com.hp.hpl.jena.sdb package names, which are from Jena 2. 
Which one is executing this code? Are you bringing both on to the classpath 
together somehow?
    
    ajs6f
    
    > On Jan 15, 2020, at 7:09 AM, Ashwani Rathi <ashwani.ra...@oracle.com> 
wrote:
    > 
    > Hi All,
    > As discussed, I am trying to make changes in our java cod to migrate from 
jena 2 to jena 3
    > 
    >    private Model getModelFromRDFStore(String modelName, 
java.sql.Connection conn)        
    >    {
    >           org.apache.jena.sdb.StoreDesc storeDesc = new 
org.apache.jena.sdb.StoreDesc(org.apache.jena.sdb.store.LayoutType.LayoutTripleNodesIndex,
    >                           org.apache.jena.sdb.store.DatabaseType.Oracle) ;
    >           org.apache.jena.sdb.Store store = null;
    >           try {
    >                   store = 
org.apache.jena.sdb.SDBFactory.connectStore(conn, storeDesc);
    >                   if(!StoreUtils.isFormatted(store))
    >                   {
    >                           store.getTableFormatter().create();
    >                   }
    >           } catch (java.sql.SQLException e) {
    >                   e.printStackTrace();
    >           }
    >           org.apache.jena.query.Dataset dataset = 
org.apache.jena.sdb.SDBFactory.connectDataset(store);
    >           Model model = null;
    >           if (!dataset.containsNamedModel(modelName)) {
    >                   model = dataset.getDefaultModel();
    >                   dataset.addNamedModel(modelName, model);
    >           }
    >           else {
    >                   model = dataset.getNamedModel(modelName);
    >           }
    > 
    >           store.getConnection().close();
    >           store.close();
    >           System.out.println("############### RETURNING model ===== " + 
model);
    >           return model;
    >    }
    > 
    > But I am getting the following issues
    > 
    > 1) While printing the model (System.out.println("############### 
RETURNING model ===== " + model);), I am getting the following SQLException:
    > 
    > <Jan 15, 2020 3:18:45,779 AM PST> <Error> 
<oracle.bpm.barch.reports.services.repository.rdfimpl> <BEA-000000> <<[Thread - 
[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' 
]null.null> com.hp.hpl.jena.sdb.sql.SDBExceptionSQL: SQLException in executing 
SQL statement
    >   at com.hp.hpl.jena.sdb.compiler.SDB_QC.exec(SDB_QC.java:84)
    >   at com.hp.hpl.jena.sdb.compiler.OpSQL.exec(OpSQL.java:65)
    >   at 
com.hp.hpl.jena.sdb.engine.QueryEngineSDB.eval(QueryEngineSDB.java:154)
    >   at 
com.hp.hpl.jena.sparql.engine.QueryEngineBase.evaluate(QueryEngineBase.java:137)
    >   at 
com.hp.hpl.jena.sparql.engine.QueryEngineBase.createPlan(QueryEngineBase.java:107)
    >   at 
com.hp.hpl.jena.sparql.engine.QueryEngineBase.getPlan(QueryEngineBase.java:88)
    >   at 
com.hp.hpl.jena.sdb.engine.QueryEngineSDB$QueryEngineFactorySDB.create(QueryEngineSDB.java:198)
    >   at com.hp.hpl.jena.sdb.graph.GraphSDB.graphBaseFind(GraphSDB.java:169)
    >   at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:277)
    >   at com.hp.hpl.jena.graph.GraphUtil.findAll(GraphUtil.java:123)
    >   at com.hp.hpl.jena.graph.impl.GraphBase.toString(GraphBase.java:436)
    >   at com.hp.hpl.jena.graph.impl.GraphBase.toString(GraphBase.java:411)
    >   at java.lang.String.valueOf(String.java:2981)
    >   at java.lang.StringBuilder.append(StringBuilder.java:131)
    >   at com.hp.hpl.jena.rdf.model.impl.ModelCom.toString(ModelCom.java:1506)
    >   at java.lang.String.valueOf(String.java:2981)
    >   at java.lang.StringBuilder.append(StringBuilder.java:131)
    > 
    > 2) We are fetching model data from database, but I am not getting any 
details in the fetched model object. Is something missing in this logic?
    > 
    > Regards,
    > Ashwani
    > 
    > On 10/01/20, 4:14 PM, "Andy Seaborne" <a...@apache.org> wrote:
    > 
    >    Probably has not been formatted:
    > 
    > 
    > 
    >    
https://urldefense.proofpoint.com/v2/url?u=http-3A__jena.apache.org_documentation_sdb_javaapi.html-23formatting-2Dor-2Demptying-2Dthe-2Dstore&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=ld8gXdwUlVansMT0flGoGNN0AOkhQba_hAJM5PewJCA&m=xMdWwv3NfQf8eKJO6IDGzidz0u7zt4EiZ0x6jeuB5WI&s=2bL8SFjE2-I7Ooz_b_k_V2x6t7R7hn50CNfPrVbF99A&e=
 
    > 
    > 
    > 
    > 
    > 
    >    On 10/01/2020 02:20, Ashwani Rathi wrote:
    > 
    >> Hi All,
    > 
    >> As discussed, I am trying to migrate from Jena 2 to Jena 3. As part of 
that we are trying to eliminate usage of com.hp.hpl.jena.db.IDBConnection and 
rather use org.apache.jena.sdb.sql.SDBConnection
    > 
    >> Following is the method that we have written to get 
org.apache.jena.rdf.model.Model object from database
    > 
    >> 
    > 
    >>     private Model getModelFromRDFStore(String modelName, 
java.sql.Connection conn)
    > 
    >>     {
    > 
    >>          org.apache.jena.sdb.StoreDesc storeDesc = new 
org.apache.jena.sdb.StoreDesc(org.apache.jena.sdb.store.LayoutType.LayoutTripleNodesIndex,
    > 
    >>                          org.apache.jena.sdb.store.DatabaseType.Oracle) ;
    > 
    >>          org.apache.jena.sdb.Store store = null;
    > 
    >>          try {
    > 
    >>                  store = 
org.apache.jena.sdb.SDBFactory.connectStore(conn, storeDesc);
    > 
    >>          } catch (java.sql.SQLException e) {
    > 
    >>                  e.printStackTrace();
    > 
    >>          }
    > 
    >>          org.apache.jena.query.Dataset dataset = 
org.apache.jena.sdb.SDBFactory.connectDataset(store);
    > 
    >>          Model model = null;
    > 
    >>          if (!dataset.containsNamedModel(modelName)) {
    > 
    >>                  model = dataset.getDefaultModel();
    > 
    >>                  dataset.addNamedModel(modelName, model);
    > 
    >>          }
    > 
    >>          else {
    > 
    >>                  model = dataset.getNamedModel(modelName);
    > 
    >>          }
    > 
    >>          return model;
    > 
    >>     }
    > 
    >> 
    > 
    >> But while checking for model in a dataset -> 
(!dataset.containsNamedModel(modelName)), we are getting the following error:
    > 
    >> Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view 
does not exist
    > 
    >> 
    > 
    >> Attached is the detailed exception. From the log it seems that some 
tables like Nodes N_1,  Quads Q_1 , Nodes R_1, Nodes R_2 are missing.
    > 
    >> So can anyone please tell what all tables (with columns) should we 
create to fix this issue?
    > 
    >> 
    > 
    >> Regards,
    > 
    >> Ashwani
    > 
    >> 
    > 
    >> 
    > 
    >> 
    > 
    >> On 09/01/20, 8:07 PM, "Andy Seaborne" <a...@apache.org> wrote:
    > 
    >> 
    > 
    >>     Hi Ashwani,
    > 
    >> 
    > 
    >>     What are you trying to achieve overall?
    > 
    >> 
    > 
    >>     Is it to port an existing application/system from Jena 2.6 to Jena
    > 
    >>     3.current?
    > 
    >>     Or is it create a general adaptor for Jena to Oracle Spatial RDF?
    > 
    >> 
    > 
    >>     The answers to your questions are different depending on use case.
    > 
    >> 
    > 
    >>     If it is the latter, then going down the SDB route may lead to a 
whole host
    > 
    >>     of problems because SDB is not deeply integrated into Jena anymore.  
For
    > 
    >>     example: transactions (and integration with Fuseki will be hard), 
newer
    > 
    >>     APIs like RDFConnection. You want to implement DatasetGraph and
    > 
    >>     Transactional. I doubt the database framework DBOE helps much but it 
is
    > 
    >>     worth checking that to see if it will save you work.
    > 
    >> 
    > 
    >>     If it is a one-off conversion for a specific application,  things are
    > 
    >>     simpler because it's getting something to work for one, known case 
rather
    > 
    >>     arbitrary application use cases in the future and as Jena evolves.
    > 
    >>     ------------
    > 
    >>     Re: SDBConnection
    > 
    >> 
    > 
    >>     SDBConnection does not control the table naming. That's in the 
"FmtLayout"
    > 
    >>     classes.
    > 
    >> 
    > 
    >>     Re:LayoutType
    > 
    >> 
    > 
    >>     See the source code.
    > 
    >>     SDB uses one of three fixed table layouts. layout1 (really, *really* 
don't
    > 
    >>     use), layout2/index and layout2/hash.
    > 
    >> 
    > 
    >>     The SPARQL to SQL code generation is specific to the layout.
    > 
    >> 
    > 
    >> 
    > 
    >>     On Thu, 9 Jan 2020 at 12:24, Ashwani Rathi 
<ashwani.ra...@oracle.com> wrote:
    > 
    >> 
    > 
    >>> Thanks for the reply.
    > 
    >>> 
    > 
    >>> Also in jena 2, we can set TableNamePrefix on an IDBConnection with the
    > 
    >>> following statements:
    > 
    >>> 
    > 
    >>>                IDBConnection conn = null;
    > 
    >>>                IRDBDriver driver = conn.getDriver();
    > 
    >>>                driver.setTableNamePrefix("prefix");
    > 
    >>> 
    > 
    >>> So what actually does this achieve. And how can we achieve the same
    > 
    >>> functionality in jena 3 with org.apache.jena.sdb.sql.SDBConnection 
class?
    > 
    >>> 
    > 
    >>> Regards,
    > 
    >>> Ashwani
    > 
    >>> 
    > 
    >>> On 09/01/20, 2:15 PM, "Bögershausen, Merlin Michael" <
    > 
    >>> merlin.boegershau...@rwth-aachen.de> wrote:
    > 
    >>> 
    > 
    >>>    Hi,
    > 
    >>> 
    > 
    >>>    You can check whether the dataset contains a specific named model 
with
    > 
    >>> dataset.containesNamedModel() [1]
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    Best Merlin
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    [1]
    > 
    >>> 
https://urldefense.proofpoint.com/v2/url?u=https-3A__jena.apache.org_documentation_javadoc_arq_org_apache_jena_query_Dataset.html-23containsNamedModel-2Djava.lang.String-2D&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=ld8gXdwUlVansMT0flGoGNN0AOkhQba_hAJM5PewJCA&m=_5kPj72-EHVEVxkEWZfp9umEDalFfeUoHIdfCCb9Plo&s=HB2xzUCShqe8JzEhH_9HaUktJ5rnUU2XOCqrcL6wOe8&e=
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    Am 09.01.2020 06:59 schrieb Ashwani Rathi <ashwani.ra...@oracle.com>:
    > 
    >>> 
    > 
    >>>    Hi All,
    > 
    >>> 
    > 
    >>>    We are upgrading from jena 2 to jena 3.
    > 
    >>> 
    > 
    >>>    We have the following method in com.hp.hpl.jena.db.IDBConnection in
    > 
    >>> jena 2:
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
------------------------------------------------------------------------------------------------------------
    > 
    >>> 
    > 
    >>>    containsModel
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    boolean containsModel(String name)                      throws
    > 
    >>> RDFRDBException
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>        Test if a given model is contained in the database.
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>        Parameters:
    > 
    >>> 
    > 
    >>>            name - the name of a model which may be in the database
    > 
    >>> 
    > 
    >>>        Returns:
    > 
    >>> 
    > 
    >>>            Boolean true if the model is contained in the database
    > 
    >>> 
    > 
    >>>        Throws:
    > 
    >>> 
    > 
    >>>            RDFDBException
    > 
    >>> 
    > 
    >>>            RDFRDBException
    > 
    >>> 
    > 
    >>>        Since:
    > 
    >>> 
    > 
    >>>            Jena 2.0
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
------------------------------------------------------------------------------------------------------------
    > 
    >>> 
    > 
    >>>    This method is used to check whether a given model exists in the
    > 
    >>> underlying database.
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    So is there a corresponding method to check for models in database in
    > 
    >>> jena 3 in org.apache.jena.sdb.sql.SDBConnection.java class or in any 
other
    > 
    >>> jena 3 jar?
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>>    Regards,
    > 
    >>> 
    > 
    >>>    Ashwani
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >>> 
    > 
    >> 
    > 
    >> 
    > 
    > 
    > 
    > 
    
    


Reply via email to