This seems like a bit of an odd usage for an RDF store. Could you explain a bit 
more why you want to put this data into Jena? Are you already using Jena for 
other data in your work?

---
A. Soroka
The University of Virginia Library

> On Jun 7, 2016, at 11:22 AM, Martin Gütlein <[email protected]> wrote:
> 
> Hi,
> 
> we would like to store some tables with double values in our triple store. At 
> the moment we are doing this by creating row and entry resources (see code 
> below).
> However, it is rather time and space consuming for medium sized tables. E.g. 
> a 500x500 table takes 20seconds and the the db size is 156MB. For our project 
> we plan to save larger/more data (and add some more semantic info).
> 
> Is there a more efficient way to do that?
> 
> Kind regards,
> Martin
> 
> Here is our example code:
> 
>        int cols = 500;
>        int rows = 500;
> 
>        double myTable[][] = new double[rows][cols];
>        for (int r = 0; r < rows; r++)
>            for (int c = 0; c < cols; c++)
>                myTable[r][c] = new Random().nextDouble();
> 
>        String directory = "myDB/tdb";
>        Dataset dataset = TDBFactory.createDataset(directory);
> 
>        Model model = dataset.getDefaultModel();
>        String NS = "http://my-namespace/test/";;
> 
>        Property hasRow = model.createProperty(NS + "hasRow");
>        Property rowIndex = model.createProperty(NS + "rowIndex");
>        Property hasEntry = model.createProperty(NS + "hasEntry");
>        Property colIndex = model.createProperty(NS + "colIndex");
>        Property value = model.createProperty(NS + "value");
> 
>        Resource table = model.createResource(NS + "table/" + 
> UUID.randomUUID());
> 
>        for (int r = 0; r < rows; r++)
>        {
>            Resource row = model.createResource(NS + "row/" + 
> UUID.randomUUID());
>            table.addProperty(hasRow, row);
>            row.addProperty(rowIndex, r + "", XSDDatatype.XSDint);
> 
>            for (int c = 0; c < cols; c++)
>            {
>                Resource entry = model.createResource(NS + "entry/" + 
> UUID.randomUUID());
>                row.addProperty(hasEntry, entry);
>                entry.addProperty(colIndex, c + "", XSDDatatype.XSDint);
>                entry.addProperty(value, myTable[r][c] + "", 
> XSDDatatype.XSDdouble);
>            }
>        }
> 
>        dataset.end();
>        dataset.close();
> 
> 
> -- 
> Dr. Martin Gütlein
> Phone:
> +49 (0)6131 39 23336 (office)
> +49 (0)177 623 9499 (mobile)
> Email:
> [email protected]
> 

Reply via email to