UDT Point: Loading file


#1

Hello,

I’m beginning to look a little on the scidb. My task is use scidb to store data about the human cardiovascular system. But I’m having difficulty to create UDTs.
First of all I’m trying to use the UDT Point that came with the scidb package.
Does Anyone have an example of a load file for an array that uses the type Point?

I think create a file in the wrong format:

[
(100,2)
]

I tried in this way:


AFL% show(ponto);
[(“pontoval1:point [i=0:3,4,0]”)]
AFL% load(ponto, ‘/tmp/c.load’);
UserException in file: src/query/ops/input/InputArray.cpp function: end line: 49
Error id: scidb::SCIDB_SE_IMPORT_ERROR::SCIDB_LE_FILE_IMPORT_FAILED
Error description: Import error. Import from file ‘/tmp/c.load’ (instance 0) to array ‘ponto’ failed at line 2, column 4, offset 6, value=‘100’: Cannot convert ‘100’ to point.
Failed query id: 1100848382244

Since now, Thank you for reading!
Sorry. I’m just starting the study of the SciDB.


#2

Hello,

I’ve done a lot of work on scidb, but just like you, this is my first time working with UDTs. I got the workflow to work but this solution may not be the most optimal one. Here’s what I have:

apoliakov@scalpel:~/scidb$ iquery -aq "load_library('point')"
Query was executed successfully

#the format is a little different. Almost what you had:
apoliakov@scalpel:~/scidb$ cat /tmp/c.load 
[
("(100,2)")
];

#I cut the array size because we are only loading one cell
apoliakov@scalpel:~/scidb$ iquery -aq "create array ponto<val:point> [i=0:0,1,0]"
Query was executed successfully

#The "n" must be present. I'll say why in a little bit.
apoliakov@scalpel:~/scidb$ iquery -anq "load(ponto, '/tmp/c.load')"
Query was executed successfully

#This doesn't work because scidb knows what "point" is but the iquery client does not. Therefore iquery cannot print the point.
apoliakov@scalpel:~/scidb$ iquery -aq "scan(ponto)"
SystemException in file: stem.cpp function: _getType line: 156
Error id: scidb::SCIDB_SE_TYPESYSTEM::SCIDB_LE_TYPE_NOT_REGISTERED
Error description: Type system error. Type 'point' is not registered.

#But we can conver it to string and then iquery can display it
apoliakov@scalpel:~/scidb$ ./bin/iquery -aq "project(apply(ponto, p_str, point2str(val)),p_str)"
[("(100,2)")]

So, this is a bit kludgy but it does illustrate a round trip. So now you should be able to do whatever you want with “points”. I’ll ask some other team members if there’s anything that a user can do about the iquery problem.
Thank you.

  • Alex Poliakov

#3

Alex, thank you for your reply!

Really my fault was: I’m not using quotes on the load file. Almost, my code works great either with scan() function [see code below].
ps.: my scidb version is 12.3

AFL% set lang afl;
AFL% load_library('point');
Query was executed successfully
AFL% create array ponto <val:point> [i=0:0,1,0];
Query was executed successfully
AFL% load(ponto, '/tmp/c.load');
[("(100,2)")]
AFL% project(apply(ponto, p_str, point2str(val)),p_str);
[("(100,2)")]

Now I want to create a UDT “Point3d” with the variables: x,y,z.
One more time, thank you a lot!