3 Replies Latest reply: Apr 21, 2012 11:44 AM by alwu-Oracle RSS

    Creating table with Jena Adapter

    923096
      Hi,

      Does in Jena Adapter we can create new table like in jdbc for example Statement st = con.createStatement();
      String table = "CREATE TABLE Employee11(Emp_code integer, Emp_name varchar(10))";
      st.executeUpdate(table); ?

      Edited by: user8894354 on 2012-04-18 15:59
        • 1. Re: Creating table with Jena Adapter
          alwu-Oracle
          Yes. You can get a DB connection from an instance of GraphOracleSem as follows.

          conn = graphOracleSem.getOracle().getConnection();

          Hope it helps,

          Zhe Wu
          • 2. Re: Creating table with Jena Adapter
            923096
            OK, another question.

            String szJdbcURL = args[0];
            String szUser = args[1];
            String szPasswd = args[2];

            String szModelName = args[3];
                 
            Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
            Model model = ModelOracleSem.createOracleSemModel(
            oracle, szModelName);

            model.getGraph().add(Triple.create(
            Node.createURI("http://example.com/John"),
            Node.createURI("http://example.com/fatherOf"),
            Node.createURI("http://example.com/Mary")));

            Query query = QueryFactory.create(
            "select ?f ?k WHERE {?f <http://example.com/fatherOf> ?k .}");
            QueryExecution qexec = QueryExecutionFactory.create(query, model);
            ResultSet results = qexec.execSelect();
            ResultSetFormatter.out(System.out, results, query);

            model.close();
            oracle.dispose();
            This is example of using Jena Adapter. In each examples Model model is used. I want create in Java aplication in which can put subject, predicate and object. I use JTextField and get String puttin there. When I try Insert data INSERT INTO mytable VALUES (1, SDO_RDF_TRIPLE_S('family', 'http://www.example.org/a/Sammy', 'http://www.example.org/family/fatherOf', 'http://www.example.org/family/Jack')) I must write model (here family). Can I use this model to all inserting data , I mean model family will be default for every RDF data?
            • 3. Re: Creating table with Jena Adapter
              alwu-Oracle
              Hi,

              You can use this model to hold all your RDF data if that is appropriate for your application. Technically, there is nothing
              preventing you from creating multiple Oracle and GraphOracleSem objects to operate multiple semantic models.

              Thanks,

              Zhe Wu