I am trying to load data (from myfile, the format of myfile is explained below) into monetdb using itsSQL interface. mytable format:

1 2 3

5 7 8

8 2 3
.....

The commands which I am using for performing the same are given below:

sql> create table mytable(subject integer, property integer, object integer);

sql> copy 10000000 records into mytable from myfile delimiter ' ','\n';

For each property value (i.e. middle column) I create a separate table:

create table prop1(subject integer, object integer); 
create table prop2(subject integer, object integer); 
create table prop3(subject integer, object integer); 
... 

and then fill these tables using the following commands:

INSERT into prop1 SELECT subject, object FROM triples_table where 
property=prop1 ORDER BY subject, object;

Is there some way to automate this process. i.e. right now I am manually creating a separate table for all the distinct properties (using create table prop1(subject integer, object integer); ) and then filling this table using insert command (INSERT into prop1 SELECT subject, object FROM triples_table where property=prop1 ORDER BY subject, object; ). Is there some way by which I may automate this procedure.

One of the methods which I know of is to create a C++/python program and then call all functions like "create table" by using shell script. But is there a faster method to achieve the same.

Also can you please guide as to how can I create and integrate dictionary (RDF: id to string mapping) to sql queries?