This code is all Oracle-specific so you will need to seek support from
them.

It looks identical to the sample code in their documentation so
presumably it should work if the rest of the setup is correct.
Check you have right version, options and patch level for Oracle -
Oracle's RDF support requires the Oracle spatial option and will not
work on a generic Oracle installation.

Note that if you don't need the Oracle native RDF support then you can
store RDF data in Oracle using SDB [1].

Dave

[1] http://openjena.org/SDB/


On Tue, 2011-10-18 at 00:04 +0100, Kostas Patsis wrote: 
> Hi i am student doing a project for my school and i trying to insert data
>  i am inserting triples with jena adapter into my Oracle Database from a .nt 
> file. 4 tables are being created FAMILY_NS, FAMILY_TPL, RDFB_FAMILY and 
> RDFC_FAMILY. my data are in N-Triple format.i want to know why i can't view 
> my data through sql-developer in my database.do i store those data or not?
> here is the code i use to insert data into my database
> import java.io.*;
> import com.hp.hpl.jena.query.*;
> import com.hp.hpl.jena.graph.*;
> import com.hp.hpl.jena.rdf.model.*;
> import com.hp.hpl.jena.util.*;
> import oracle.spatial.rdf.client.jena.*;
> public class Bulk {
>     public static void main(String[] args) throws Exception
>   {
> 
>     String szJdbcURL = "jdbc:oracle:thin:@192.168.2.3:1521:orcl";
>     String szUser    = "kostas";
>     String szPasswd  = "welcome";
> 
>     String szModelName = "Family";
> Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
> GraphOracleSem graph = new GraphOracleSem(oracle, szModelName);
> 
> PrintStream psOut = System.out;
> 
> String dirname = "C:\\users\\CoCo\\Desktop\\file";
> File fileDir = new File(dirname);
> String[] szAllFiles = fileDir.list();
> 
> // loop through all the files in a directory
> for (int idx = 0; idx < szAllFiles.length; idx++) {
>   String szIndFileName = dirname + File.separator + szAllFiles[idx];
>   psOut.println("process to [ID = " + idx + " ] file " + szIndFileName);
>   psOut.flush();
> 
>   try {
>      // Model model = 
> FileManager.get().loadModel("C:\\users\\CoCo\\Desktop\\file\\example.nt");
>     InputStream is = new FileInputStream(szIndFileName);
>     graph.getBulkUpdateHandler().prepareBulk(
>         is,                    // input stream
>         "http://www.recshop.fake/cd";,  // base URI
>         "N-TRIPLE",             // data file type: can be RDF/XML, N-TRIPLE, 
> etc.
>         null,               // tablespace
>         null,                  // flags
>         null,                  // listener
>         null                   // staging table name.
>         );
>     is.close();
>   }
> 
>   catch (Throwable t) {
>     psOut.println("Hit exception " + t.getMessage());
>   }
> }
> }
> }


Reply via email to