How to insert new edges into an already existing db?

38 views
Skip to first unread message

frank....@gmail.com

unread,
Feb 22, 2016, 10:43:51 AM2/22/16
to Sparksee
Hi,
I'm experiencing something strange when passing from ->create mode of the db to ->open mode of the db..

/QuestionMark$ ls -a
.  ..  CGraph.cpp  sparksee.cfg

Database *db = sparksee->Create(L"CGraph.gdb", L"CGraph");
  std::array<std::string, 3> FrankArray = {"FatherOf", "Spouse", "BrotherOf"};
  std::wstring RelationshipType( FrankArray[0].begin(), FrankArray[0].end() );

time ./CGraph
CNODE has to be created from scratch
RelationshipType= FatherOf
relTypeId= 0
FatherOf HAS TO BE INSERTED in DB

I switch to the open mode:
Database *db = sparksee->Open(L"CGraph.gdb", L"CGraph");
but with the same edge type

time ./CGraph
CNODE already present
RelationshipType= FatherOf
relTypeId= 9
FatherOf already present

Bu when still in open mode but with a new edge to insert:
  std::array<std::string, 3> FrankArray = {"FatherOf", "Spouse", "BrotherOf"};
  std::wstring RelationshipType( FrankArray[1].begin(), FrankArray[1].end() );
I have a crash:
time ./CGraph
CNODE already present
RelationshipType= Spouse
relTypeId= 0
Spouse HAS TO BE INSERTED in DB
terminate called after throwing an instance of 'sparksee::gdb::Error'
**** CRITICAL ERROR (SIGNAL NUM 6)
------- Begin of call stack ------
/home/frank/sparkseecpp-5.2.0/lib/linux64/libsparksee.so(_ZN13sparksee_core21CallStackTraceHandler13SignalHandlerEi+0x28) [0x7fd8233319a8]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7fd822944d40]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39) [0x7fd822944cc9]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7fd8229480d8]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x15d) [0x7fd822f536dd]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x67746) [0x7fd822f51746]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x67791) [0x7fd822f51791]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x679a8) [0x7fd822f519a8]
/home/frank/sparkseecpp-5.2.0/lib/linux64/libsparksee.so(_ZN8sparksee3gdb5Graph11NewEdgeTypeERKSbIwSt11char_traitsIwESaIwEEbb+0x74) [0x7fd8232e9e54]
./CGraph() [0x4019d8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fd82292fec5]
./CGraph() [0x401b59]
-------- End of call stack -------

So...
what to do in order to be able to insert new edges into an already existing DB?
Attached the file used.
Looking forward to hearing from you for this important matter.
Frank
CGraph.cpp

c3po.ac

unread,
Feb 23, 2016, 2:01:20 AM2/23/16
to Sparksee
Hi,

The problem may be the second argument used in the Open operation:

Database *db = sparksee->Open(L"CGraph.gdb", L"CGraph");

The second argument in the Open method is not the alias. It's a boolean value set to true only when you want to open the database in read only mode:
Database *db = sparksee->Open(L"CGraph.gdb", false);

Best regards


El dilluns, 22 febrer de 2016 16:43:51 UTC+1, Frank Smith va escriure:

Frank Smith

unread,
Feb 23, 2016, 5:18:37 AM2/23/16
to Sparksee
Thank you very much.
Frank
Reply all
Reply to author
Forward
0 new messages