2 Replies Latest reply on Apr 30, 2007 3:13 PM by rjilani

    Is There Any API available for retireving Oracle RDF Store(triples)

    570980
      hi
      is there any java API available for storing and retrieving to/from oracle RDF store(triple format) directly to/from a web application.
      in other words any java API is available for developing a web application for storing and retrieving RDF triples from Oracle10g rdf Store.

      regards,
      prathap.
        • 1. Re: Is There Any API available for retireving Oracle RDF Store(triples)
          Mannamal-Oracle
          Hi Prathap,

          No, there is no Java API specific for RDF functionality available. However, Java client applications can use JDBC to access the RDF store. A partially relevant post is at How do you query Oracle RDF database using Java program? . The JDBC documentation will have detailed documentation on using JDBC.

          Code snippets for one way of accessing SDO_RDF_MATCH through Java is below:

          <..........>

          sbStmt.append("select * from TABLE( ")
          .append(" SDO_RDF_MATCH('(?S ?P ?O)',")
          .append(" SDO_RDF_Models('")
          .append( <model_name> )
          .append("'),")
          .append("null,null,null))")
          .append(" where rownum <= ")
          .append(iNumRows)
          ;

          ResultSet rs = stmt.executeQuery(sbStmt.toString());
          while (rs.next()) {
          System.out.print("\n");
          System.out.print(rs.getString("S"));
          System.out.print(" (");
          System.out.print(rs.getString("S$RDFVTYP"));
          System.out.print(") ");
          System.out.print(", ");
          System.out.print(rs.getString("P"));
          System.out.print(" (");
          System.out.print(rs.getString("P$RDFVTYP"));
          System.out.print(") ");
          System.out.print(", ");
          System.out.print(rs.getString("O"));
          System.out.print(" (");
          System.out.print(rs.getString("O$RDFVTYP"));
          System.out.print(") ");

          <............>

          <...... handling CLOB values that are returned ....>

          // read CLOB if applicable
          Reader reader = null;
          try {
          CLOB clob = ((OracleResultSet) rs).getCLOB("O$RDFCLOB");
          if (clob == null) {
          System.out.print("not a long literal ");
          }
          else {
          reader = clob.getCharacterStream();

          char[] buffer = new char[1024];

          // reading 1K at a time (just a demo)
          int iLength = reader.read(buffer);
          for (int i = 0; i < iLength; i++) {
          System.out.print(buffer);
          }
          System.out.print(" ...");
          }
          }
          finally {
          if (reader != null) reader.close();
          }

          <..........>
          • 2. Re: Is There Any API available for retireving Oracle RDF Store(triples)
            rjilani
            Hi: Prathap I am too new to Oracle RDF data model and can't say any thing unless I install and start playing with it. But looks like you are looking for some API to manipulate RDF data models. Have you ever tried Jena, please have a look.

            http://jena.sourceforge.net/index.html

            Regards,
            Rashid.