24 #include <ros/package.h>
41 std::string ontologyDefaultPath = std::string(
"currentOntologyVersion.owl");
42 rapp_platform_ros_communications::ontologyLoadDumpSrv::Request dmp;
43 dmp.file_url = ontologyDefaultPath;
53 bool stringContained =
false;
54 for (
int i = 0; i < vec.size(); i++) {
56 stringContained =
true;
60 return stringContained;
69 std::size_t found = a.find(b);
70 if (found == std::string::npos) {
82 std::ostringstream temp;
94 found = str.find_last_of(
"/\\");
95 return str.substr(0, found);
104 std::ifstream infile(fileName);
105 return infile.good();
114 std::vector<std::string>
split(std::string str, std::string sep) {
115 char* cstr =
const_cast<char*
> (str.c_str());
117 std::vector<std::string> arr;
118 current = strtok(cstr, sep.c_str());
119 while (current != NULL) {
120 arr.push_back(current);
121 current = strtok(NULL, sep.c_str());
133 rapp_platform_ros_communications::createOntologyAliasSrv::Response res;
135 if (req.username == std::string(
"")) {
136 throw std::string(
"Error, empty username");
143 res.ontology_alias = currentAlias;
147 }
catch (std::string error) {
149 res.trace.push_back(error);
162 std::string ontology_alias;
163 rapp_platform_ros_communications::getUserOntologyAliasSrv srv;
164 srv.request.username = username;
166 if (srv.response.success !=
true) {
167 throw std::string(std::string(
"FAIL: User not found, incorrect username?"));
169 ontology_alias = srv.response.ontology_alias;
170 if (ontology_alias == std::string(
"None")) {
174 return ontology_alias;
184 std::string ontology_alias;
185 std::vector<std::string> instance_name;
186 std::string query = std::string(
"rdf_instance_from_class(knowrob:'Person") + std::string(
"',A)");
187 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
188 char status = results.getStatus();
190 throw std::string(
"User was uninitialized (had no ontology alias), and initilization failed on ontology level");
192 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
193 it != results.end(); it++) {
194 json_prolog::PrologBindings bdg = *it;
195 instance_name.push_back(bdg[
"A"]);
198 ontology_alias = instance_name[0];
199 std::vector<std::string> splitted =
split(ontology_alias, std::string(
"#"));
200 ontology_alias = splitted[1];
201 rapp_platform_ros_communications::registerUserOntologyAliasSrv srv;
202 srv.request.username = username;
203 srv.request.ontology_alias = std::string(ontology_alias);
205 if (srv.response.success !=
true) {
206 std::string error = srv.response.trace[0];
207 query = std::string(
"rdf_retractall(knowrob:'") + ontology_alias + std::string(
"',rdf:type,knowrob:'Person") + std::string(
"')");
208 results =
pl.query(query.c_str());
209 status = results.getStatus();
211 error = error + std::string(
" DB operation failed.. removing instance from ontology also failed...");
212 }
else if (status == 3) {
213 error = error + std::string(
" DB operation failed..Remove from ontology Success");
215 throw std::string(std::string(
"FAIL") + error);
218 return ontology_alias;
227 rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Response res;
228 if (req.test == std::string(
"") || req.score < 0 || req.score > 100 || req.timestamp < 1 || req.patient_ontology_alias == std::string(
"") || req.test == std::string(
"")) {
230 res.trace.push_back(
"Error, one or more arguments not provided or out of range. Test score is >=0 and <=100 and timestamp is positive integers");
231 res.error = std::string(
"Error, one or more arguments not provided or out of range. Test score is >=0 and <=100 and timestamp is positive integers");
234 std::string timestamp =
intToString(req.timestamp);
237 std::string query = std::string(
"cognitiveTestPerformed(B,knowrob:'") + req.patient_ontology_alias + std::string(
"',knowrob:'") + req.test + std::string(
"','") + timestamp + std::string(
"','") + score + std::string(
"',knowrob:'Person',knowrob:'CognitiveTestPerformed')");
238 query = std::string(
"cognitiveTestPerformed(B,knowrob:'") + req.patient_ontology_alias + std::string(
"',knowrob:'") + req.test + std::string(
"','") + timestamp + std::string(
"','") + score + std::string(
"',knowrob:'Person',knowrob:'CognitiveTestPerformed')");
239 res.trace.push_back(query);
240 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
242 char status = results.getStatus();
245 res.trace.push_back(std::string(
"Test performance entry insertion into ontology FAILED, either invalid test or patient alias"));
246 res.error = std::string(
"Test performance entry insertion into ontology FAILED, either invalid test or patient alias");
248 }
else if (status == 3) {
251 std::vector<std::string> query_ret_tests;
252 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
253 it != results.end(); it++) {
254 json_prolog::PrologBindings bdg = *it;
255 std::string temp_query_tests = bdg[
"B"];
256 query_ret_tests.push_back(temp_query_tests);
258 for (
unsigned int i = 0; i < query_ret_tests.size(); i++) {
259 res.cognitive_test_performance_entry = (query_ret_tests[i]);
272 rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Response res;
274 if (req.test_type == std::string(
"") || req.test_difficulty < 1 || req.test_path == std::string(
"") || req.test_subtype == std::string(
"") || req.test_id <0) {
275 throw std::string(
"Error, one or more arguments not provided or out of range. Test variation and test difficulty are positive integers >0");
278 std::string path = ros::package::getPath(
"rapp_cognitive_exercise");
279 std::string temp_check_path = path + req.test_path;
280 const char * c = temp_check_path.c_str();
282 throw std::string(
"Test file does not exist in provided file path");
284 std::string difficulty =
intToString(req.test_difficulty);
286 std::string query = std::string(
"createCognitiveTest(knowrob:'") + req.test_type + std::string(
"',B,'") + difficulty + std::string(
"','") + req.test_path + std::string(
"',knowrob:'") + req.test_subtype + std::string(
"','") + test_id + std::string(
"')");
287 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
288 char status = results.getStatus();
290 throw std::string(
"Test insertion into ontology FAILED, possible error is test type/subtype invalid");
291 }
else if (status == 3) {
294 std::vector<std::string> query_ret_tests;
295 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
296 it != results.end(); it++) {
297 json_prolog::PrologBindings bdg = *it;
298 std::string temp_query_tests = bdg[
"B"];
299 query_ret_tests.push_back(temp_query_tests);
301 for (
unsigned int i = 0; i < query_ret_tests.size(); i++) {
302 res.test_name = (query_ret_tests[i]);
304 std::string tmp_test_name;
305 tmp_test_name.assign(res.test_name.c_str());
306 std::vector<std::string> test_created =
split(tmp_test_name, std::string(
"#"));
307 if (test_created.size() == 2) {
308 for (
unsigned int i = 0; i < req.supported_languages.size(); i++) {
309 query = std::string(
"rdf_assert(knowrob:'") + test_created[1] + std::string(
"',knowrob:supportedLanguages,knowrob:'") + req.supported_languages[i] + std::string(
"')");
310 results =
pl.query(query.c_str());
315 }
catch (std::string error) {
317 res.trace.push_back(error);
330 rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Response res;
332 if (req.test_type == std::string(
"")) {
333 throw std::string(
"Error, test_type empty");
335 if (req.test_language == std::string(
"")) {
336 throw std::string(
"Error, language empty");
338 std::string query = std::string(
"cognitiveTestsOfType(knowrob:'") + req.test_type + std::string(
"',B,Path,Dif,Sub,knowrob:'") + req.test_language + std::string(
"',Id)");
339 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
340 char status = results.getStatus();
342 throw std::string(
"No tests of given type exist");
345 std::vector<std::string> query_ret_tests;
346 std::vector<std::string> query_ret_scores;
347 std::vector<std::string> query_ret_difficulty;
348 std::vector<std::string> query_ret_file_paths;
349 std::vector<std::string> query_ret_subtypes;
350 std::vector<std::string> query_ret_ids;
351 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
352 it != results.end(); it++) {
353 json_prolog::PrologBindings bdg = *it;
354 std::string temp_query_tests = bdg[
"B"];
355 query_ret_tests.push_back(temp_query_tests);
356 std::string temp_query_file_paths = bdg[
"Path"];
357 query_ret_file_paths.push_back(temp_query_file_paths);
358 std::string temp_query_difficulty = bdg[
"Dif"];
359 query_ret_difficulty.push_back(temp_query_difficulty);
360 std::string temp_query_subtypes = bdg[
"Sub"];
361 query_ret_subtypes.push_back(temp_query_subtypes);
362 std::string temp_query_ids = bdg[
"Id"];
363 query_ret_ids.push_back(temp_query_ids);
365 for (
unsigned int i = 0; i < query_ret_tests.size(); i++) {
366 res.tests.push_back(query_ret_tests[i]);
367 res.difficulty.push_back(query_ret_difficulty[i]);
368 res.file_paths.push_back(query_ret_file_paths[i]);
369 res.subtype.push_back(query_ret_subtypes[i]);
370 res.test_id.push_back(query_ret_ids[i]);
373 }
catch (std::string error) {
375 res.trace.push_back(error);
388 rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Response res;
390 if (req.ontology_alias == std::string(
"")) {
391 throw std::string(
"Error, ontology alias empty");
393 if (req.test_type == std::string(
"")) {
394 throw std::string(
"Error, test type empty");
396 std::string query = std::string(
"userCognitiveTestPerformance(knowrob:'") + req.ontology_alias + std::string(
"',knowrob:'") + req.test_type + std::string(
"',B,Dif,Timestamp,SC,P,SubType)");
397 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
398 char status = results.getStatus();
400 throw std::string(
"No performance records exist for the user or invalid user or invalid test type");
403 std::vector<std::string> query_ret_tests;
404 std::vector<std::string> query_ret_scores;
405 std::vector<std::string> query_ret_difficulty;
406 std::vector<std::string> query_ret_timestamps;
407 std::vector<std::string> query_ret_subtypes;
408 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
409 it != results.end(); it++) {
410 json_prolog::PrologBindings bdg = *it;
411 std::string temp_query_tests = bdg[
"B"];
412 query_ret_tests.push_back(temp_query_tests);
413 std::string temp_query_difficulty = bdg[
"Dif"];
414 query_ret_difficulty.push_back(temp_query_difficulty);
415 std::string temp_query_timestamps = bdg[
"Timestamp"];
416 query_ret_timestamps.push_back(temp_query_timestamps);
417 std::string temp_query_scores = bdg[
"SC"];
418 query_ret_scores.push_back(temp_query_scores);
419 std::string tmp_query_subtypes = bdg[
"SubType"];
420 query_ret_subtypes.push_back(tmp_query_subtypes);
422 for (
unsigned int i = 0; i < query_ret_tests.size(); i++) {
423 res.tests.push_back(query_ret_tests[i]);
424 res.scores.push_back(query_ret_scores[i]);
425 res.difficulty.push_back(query_ret_difficulty[i]);
426 res.timestamps.push_back(query_ret_timestamps[i]);
427 res.subtypes.push_back(query_ret_subtypes[i]);
430 }
catch (std::string error) {
432 res.trace.push_back(error);
445 rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Response res;
447 if (req.username == std::string(
"")) {
448 throw std::string(
"Error, ontology alias empty");
451 if (req.test_type == std::string(
"")) {
452 std::string query = std::string(
"rdf_has(P,knowrob:cognitiveTestPerformedPatient,knowrob:'") + currentAlias + std::string(
"'),rdf_retractall(P,L,S)");
453 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
454 char status = results.getStatus();
456 throw std::string(
"No performance records exist for the user or invalid user or invalid test type");
457 }
else if (status == 3) {
461 std::string query = std::string(
"rdf_has(A,rdf:type,knowrob:'") + req.test_type + std::string(
"'),rdf_has(P,knowrob:cognitiveTestPerformedTestName,A),rdf_has(P,knowrob:cognitiveTestPerformedPatient,knowrob:'") + currentAlias + std::string(
"'),rdf_retractall(P,L,S)");
462 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
463 char status = results.getStatus();
465 throw std::string(
"No performance records exist for the user or invalid user or invalid test type");
466 }
else if (status == 3) {
472 }
catch (std::string error) {
474 res.trace.push_back(error);
486 rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response
KnowrobWrapper::subclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req) {
487 rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response res;
489 if (req.ontology_class == std::string(
"")) {
490 throw std::string(
"Error, empty ontology class");
492 std::string query = std::string(
"");
493 if (req.recursive ==
true) {
494 query = std::string(
"superclassesOf_withCheck(knowrob:'") + req.ontology_class + std::string(
"',A)");
496 query = std::string(
"direct_superclassesOf_withCheck(knowrob:'") + req.ontology_class + std::string(
"',A)");
498 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
499 char status = results.getStatus();
501 throw std::string(std::string(
"Class: ") + req.ontology_class + std::string(
" does not exist"));
504 std::vector<std::string> query_ret;
505 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
506 it != results.end(); it++) {
507 json_prolog::PrologBindings bdg = *it;
508 std::string temp_query_result = bdg[
"A"];
511 query_ret.push_back(temp_query_result);
515 for (
unsigned int i = 0; i < query_ret.size(); i++) {
516 res.results.push_back(query_ret[i]);
519 }
catch (std::string error) {
521 res.trace.push_back(error);
533 rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response
KnowrobWrapper::superclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req) {
534 rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response res;
536 if (req.ontology_class == std::string(
"")) {
537 throw std::string(
"Error, empty ontology class");
539 std::string query = std::string(
"");
540 if (req.recursive ==
true) {
541 query = std::string(
"subclassesOf_withCheck(knowrob:'") + req.ontology_class + std::string(
"',A)");
543 query = std::string(
"direct_subclassesOf_withCheck(knowrob:'") + req.ontology_class + std::string(
"',A)");
545 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
546 char status = results.getStatus();
548 throw std::string(std::string(
"Class: ") + req.ontology_class + std::string(
" does not exist"));
551 std::vector<std::string> query_ret;
552 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
553 it != results.end(); it++) {
554 json_prolog::PrologBindings bdg = *it;
555 std::string temp_query_result = bdg[
"A"];
558 query_ret.push_back(temp_query_result);
562 for (
unsigned int i = 0; i < query_ret.size(); i++) {
563 res.results.push_back(query_ret[i]);
566 }
catch (std::string error) {
568 res.trace.push_back(error);
581 rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Response res;
583 if (req.parent_class == std::string(
"")) {
584 throw std::string(
"Error, empty ontology class");
586 if (req.child_class == std::string(
"")) {
587 throw std::string(
"Error, empty other class");
589 std::string query = std::string(
"");
590 if (req.recursive ==
true) {
591 query = std::string(
"superclassesOf_withCheck(knowrob:'") + req.parent_class + std::string(
"',A)");
593 query = std::string(
"direct_superclassesOf_withCheck(knowrob:'") + req.parent_class + std::string(
"',A)");
595 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
596 char status = results.getStatus();
598 throw std::string(std::string(
"Class: ") + req.parent_class + std::string(
" does not exist"));
601 std::vector<std::string> query_ret;
603 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
604 it != results.end(); it++) {
605 json_prolog::PrologBindings bdg = *it;
606 std::string temp_query_result = bdg[
"A"];
607 std::vector<std::string> seperator =
split(temp_query_result, std::string(
"#"));
608 if (seperator[1] == req.child_class) {
619 }
catch (std::string error) {
621 res.trace.push_back(error);
634 rapp_platform_ros_communications::createInstanceSrv::Response res;
636 if (req.username == std::string(
"")) {
637 throw std::string(
"Error, empty username");
639 if (req.ontology_class == std::string(
"")) {
640 throw std::string(
"Error, empty ontology class");
643 std::vector<std::string> instance_name;
644 std::string query = std::string(
"instanceFromClass_withCheck_andAssign(knowrob:'") + req.ontology_class + std::string(
"',A,knowrob:'") + ontology_alias + std::string(
"')");
645 res.trace.push_back(query);
646 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
647 char status = results.getStatus();
649 throw std::string(std::string(
"Class: ") + req.ontology_class + std::string(
" does not exist probably.. or ontology_alias for user exists in the mysqlDatabase and not in the ontology"));
652 for (json_prolog::PrologQueryProxy::iterator it = results.begin(); it != results.end(); it++) {
653 json_prolog::PrologBindings bdg = *it;
654 instance_name.push_back(bdg[
"A"]);
656 if (instance_name.size() == 1) {
657 instance_name =
split(instance_name[0],
"#");
658 if (instance_name.size() == 2) {
659 res.instance_name = (std::string(
"Created instance name is: ") + instance_name[1]);
661 throw std::string(
"Fatal Error, instance not created.. split to # error");
664 throw std::string(
"Fatal Error, instance not created.., retrieval error");
668 }
catch (std::string error) {
670 res.trace.push_back(error);
683 rapp_platform_ros_communications::ontologyLoadDumpSrv::Response res;
685 std::string path = getenv(
"HOME");
686 path = path + std::string(
"/rapp_platform_files/");
687 if (req.file_url.empty()) {
688 throw std::string(
"Empty file path");
690 size_t pathDepth = std::count(req.file_url.begin(), req.file_url.end(),
'/');
691 std::string str2(
"/");
692 std::size_t found = req.file_url.find(str2);
693 if (found != std::string::npos && pathDepth > 1) {
695 const char * c = folderFromPath.c_str();
697 throw std::string(
"Path does not exist, invalid folder?");
700 req.file_url = path + req.file_url;
701 std::string query = std::string(
"rdf_save('") + req.file_url + std::string(
"')");
702 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
703 char status = results.getStatus();
705 throw std::string(
"Ontology dump failed");
709 }
catch (std::string error) {
711 res.trace.push_back(error);
724 rapp_platform_ros_communications::ontologyLoadDumpSrv::Response res;
726 if (req.file_url.empty()) {
727 throw std::string(
"Empty file path");
729 std::string path = getenv(
"HOME");
730 path = path + std::string(
"/rapp_platform_files/");
731 req.file_url = path + req.file_url;
732 const char * c = req.file_url.c_str();
734 throw std::string(std::string(
"File does not exist in provided file path: '")
735 + std::string(req.file_url) + std::string(
"'"));
737 std::string query = std::string(
"rdf_load('") + req.file_url + std::string(
"')");
738 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
739 char status = results.getStatus();
741 throw std::string(
"Ontology load failed");
745 }
catch (std::string error) {
747 res.trace.push_back(error);
760 rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Response res;
762 if (req.username == std::string(
"")) {
763 throw std::string(
"Error, empty username");
765 if (req.ontology_class == std::string(
"")) {
766 throw std::string(
"Error, empty ontology class");
769 std::string query = std::string(
"rdf_has(knowrob:'") + ontology_alias + std::string(
"',knowrob:'belongsToUser',A)");
770 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
771 char status = results.getStatus();
773 throw std::string(
"User has no instances");
776 std::vector<std::string> query_ret;
777 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
778 it != results.end(); it++) {
779 json_prolog::PrologBindings bdg = *it;
780 std::string temp_query_result = bdg[
"A"];
783 query_ret.push_back(temp_query_result);
787 for (
unsigned int i = 0; i < query_ret.size(); i++) {
788 res.results.push_back(query_ret[i]);
791 }
catch (std::string error) {
793 res.trace.push_back(error);
805 rapp_platform_ros_communications::registerImageObjectToOntologySrv::Response res;
807 if (req.user_ontology_alias == std::string(
"") || req.timestamp < 1 || req.image_path == std::string(
"") || req.object_ontology_class == std::string(
"")) {
809 res.trace.push_back(
"Error, one or more arguments not provided or out of range");
810 res.error = std::string(
"Error, one or more arguments not provided or out of range");
814 std::string timestamp =
intToString(req.timestamp);
816 std::string query = std::string(
"createObjectAndRegisterImage(Object,knowrob:'") + req.object_ontology_class + std::string(
"',knowrob:'") + req.user_ontology_alias + std::string(
"','") + timestamp + std::string(
"','") + req.image_path + std::string(
"','") + req.caffe_class + std::string(
"')");
818 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
819 char status = results.getStatus();
822 res.trace.push_back(std::string(
"Test performance entry insertion into ontology FAILED, either invalid test or patient alias"));
823 res.error = std::string(
"Test performance entry insertion into ontology FAILED, either invalid test or patient alias");
825 }
else if (status == 3) {
828 std::vector<std::string> query_ret_tests;
829 for (json_prolog::PrologQueryProxy::iterator it = results.begin();
830 it != results.end(); it++) {
831 json_prolog::PrologBindings bdg = *it;
832 std::string temp_query_tests = bdg[
"Object"];
833 query_ret_tests.push_back(temp_query_tests);
835 for (
unsigned int i = 0; i < query_ret_tests.size(); i++) {
836 res.object_entry = (query_ret_tests[i]);
840 }
catch (std::string error) {
842 res.trace.push_back(error);
854 rapp_platform_ros_communications::retractUserOntologyAliasSrv::Response res;
856 if (req.ontology_alias == std::string(
"")) {
857 throw std::string(
"User ontology_alias not provided");
859 std::string query = std::string(
"rdf_retractall(knowrob:'"+req.ontology_alias+
"',rdf:type,knowrob:'Person')");
860 json_prolog::PrologQueryProxy results =
pl.query(query.c_str());
861 char status = results.getStatus();
863 throw std::string(
"Retract failed at ontology level");
864 }
else if (status == 3) {
869 }
catch (std::string error) {
871 res.trace.push_back(error);
std::string get_ontology_alias(std::string user_id)
Returns the ontology alias of the user.
rapp_platform_ros_communications::createInstanceSrv::Response createInstanceQuery(rapp_platform_ros_communications::createInstanceSrv::Request req)
Implements the createInstance ROS service.
rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Response user_instances_of_class(rapp_platform_ros_communications::returnUserInstancesOfClassSrv::Request req)
Implements the returnUserInstancesOfClass ROS service.
rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Response create_cognitve_tests(rapp_platform_ros_communications::createCognitiveExerciseTestSrv::Request req)
Implements the create_cognitve_tests ROS service.
rapp_platform_ros_communications::ontologyLoadDumpSrv::Response loadOntologyQuery(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request req)
Implements the loadOntology ROS service.
rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Response record_user_cognitive_tests_performance(rapp_platform_ros_communications::recordUserPerformanceCognitiveTestsSrv::Request req)
Implements the record_user_cognitive_tests_performance ROS service.
rapp_platform_ros_communications::registerImageObjectToOntologySrv::Response register_image_object_to_ontology(rapp_platform_ros_communications::registerImageObjectToOntologySrv::Request req)
Implements the register_image_object_to_ontology ROS service.
KnowrobWrapper(ros::NodeHandle nh)
Default constructor.
rapp_platform_ros_communications::createOntologyAliasSrv::Response create_ontology_alias(rapp_platform_ros_communications::createOntologyAliasSrv::Request req)
Implements the create_ontology_alias ROS service.
ros::ServiceClient mysql_get_user_ontology_alias_client
rapp_platform_ros_communications::retractUserOntologyAliasSrv::Response retract_user_ontology_alias(rapp_platform_ros_communications::retractUserOntologyAliasSrv::Request req)
Implements the retract_user_ontology_alias ROS service.
bool checkIfStringVectorContainsString(std::vector< std::string > vec, std::string a)
Check if a string is contained in a vector string.
rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Response clear_user_cognitive_tests_performance_records(rapp_platform_ros_communications::clearUserPerformanceCognitveTestsSrv::Request req)
Implements the clear_user_cognitive_tests_performance_records ROS service.
bool checkIfFileExists(const char *fileName)
Checks if path exists.
bool checkIfStringContainsString(std::string a, std::string b)
Checks if the second string is contained within the first string.
std::string SplitFilename(const std::string &str)
Keeps only the final folder or file from a path.
rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response subclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req)
Implements the subclassesOf ROS service.
rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Response superclassesOfQuery(rapp_platform_ros_communications::ontologySubSuperClassesOfSrv::Request req)
Implements the superclassesOf ROS service.
void dump_ontology_now()
Dumps the ontology to default path.
ros::ServiceClient mysql_register_user_ontology_alias_client
rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Response isSubSuperclassOfQuery(rapp_platform_ros_communications::ontologyIsSubSuperClassOfSrv::Request req)
Implements the isSubSuperclass ROS service.
rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Response user_performance_cognitve_tests(rapp_platform_ros_communications::userPerformanceCognitveTestsSrv::Request req)
Implements the user_performance_cognitve_tests ROS service.
rapp_platform_ros_communications::ontologyLoadDumpSrv::Response dumpOntologyQuery(rapp_platform_ros_communications::ontologyLoadDumpSrv::Request req)
Implements the dumpOntology ROS service.
rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Response cognitive_tests_of_type(rapp_platform_ros_communications::cognitiveTestsOfTypeSrv::Request req)
Implements the cognitive_tests_of_type ROS service.
std::string intToString(int a)
Converts integer to string.
std::vector< std::string > split(std::string str, std::string sep)
Splits string by delimiter.
std::string create_ontology_alias_for_new_user(std::string user_id)
Creates a new ontology alias for a user.