From 52461ee11dfc5e3693c7fa6df16dcb668cd395ae Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Thu, 5 Oct 2023 11:01:25 +0200 Subject: [PATCH 01/37] [Graph] fix removeFromDictionary --- include/ontologenius/core/ontoGraphs/Graphs/Graph.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ontologenius/core/ontoGraphs/Graphs/Graph.h b/include/ontologenius/core/ontoGraphs/Graphs/Graph.h index 6a5d15a8..79aa9fe0 100644 --- a/include/ontologenius/core/ontoGraphs/Graphs/Graph.h +++ b/include/ontologenius/core/ontoGraphs/Graphs/Graph.h @@ -64,6 +64,8 @@ class Graph for(size_t i = 0; i < dictionary[lang].size();) if(dictionary[lang][i] == word) dictionary[lang].erase(dictionary[lang].begin() + i); + else + i++; } } From f0fac732f6a1610f74c0eb7068134ad3f431df8c Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Thu, 5 Oct 2023 11:36:26 +0200 Subject: [PATCH 02/37] [IndividualGraph] avoid getSames use in isA --- src/core/ontoGraphs/Graphs/IndividualGraph.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/ontoGraphs/Graphs/IndividualGraph.cpp b/src/core/ontoGraphs/Graphs/IndividualGraph.cpp index f5c9cf81..5f056fb6 100644 --- a/src/core/ontoGraphs/Graphs/IndividualGraph.cpp +++ b/src/core/ontoGraphs/Graphs/IndividualGraph.cpp @@ -1548,10 +1548,8 @@ bool IndividualGraph::isA(const std::string& indiv, const std::string& class_sel std::shared_lock lock_class(class_graph_->mutex_); if(branch->same_as_.size()) { - std::unordered_set sames; - getSame(branch, sames); - for(IndividualBranch_t* it : sames) - for(auto& is_a : it->is_a_) + for(auto& it : branch->same_as_) + for(auto& is_a : it.elem->is_a_) if(class_graph_->existInInheritance(is_a.elem, class_selector)) return true; } @@ -1574,10 +1572,8 @@ bool IndividualGraph::isA(index_t indiv, index_t class_selector) std::shared_lock lock_class(class_graph_->mutex_); if(branch->same_as_.size()) { - std::unordered_set sames; - getSame(branch, sames); - for(IndividualBranch_t* it : sames) - for(auto& is_a : it->is_a_) + for(auto& it : branch->same_as_) + for(auto& is_a : it.elem->is_a_) if(class_graph_->existInInheritance(is_a.elem, class_selector)) return true; } From ad500ab39fac1a661409337041f39c59883fe5a8 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Thu, 5 Oct 2023 11:37:59 +0200 Subject: [PATCH 03/37] [ontopy] fix removeLanguage --- ontopy/ontologenius/FeederPublisher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ontopy/ontologenius/FeederPublisher.py b/ontopy/ontologenius/FeederPublisher.py index b44ca9a5..8dce9b78 100644 --- a/ontopy/ontologenius/FeederPublisher.py +++ b/ontopy/ontologenius/FeederPublisher.py @@ -135,7 +135,7 @@ def removeLanguage(self, concept_from, lang, name, stamp = None): """Removes the label name(str) in the language lang(str) the class, individual, or property concept_from(str). If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp. """ - msg = '[add]' + concept_from + '|@' + lang + '|' + name + msg = '[del]' + concept_from + '|@' + lang + '|' + name if stamp == None: stamp = rospy.get_rostime() self._publish_stamped(msg, stamp) From cb7538da2119eccf56d2cb52497f7d30508ae32e Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Mon, 16 Oct 2023 15:07:34 +0200 Subject: [PATCH 04/37] [files] fix CI files --- files/attribute.owl | 705 +++++++++++++++++++------------------ files/positionProperty.owl | 246 ++++++------- 2 files changed, 478 insertions(+), 473 deletions(-) diff --git a/files/attribute.owl b/files/attribute.owl index 382d865f..8f2e2bcc 100644 --- a/files/attribute.owl +++ b/files/attribute.owl @@ -1,13 +1,16 @@ - - - + + @@ -23,10 +26,10 @@ - + - - + + explain if an entity can move by it self activity activité @@ -34,38 +37,38 @@ - + - - + + - + - - + + adult - + - - - + + + affairs are every little non alive objects affaire - + - - + + approximated age description age âge @@ -73,75 +76,75 @@ - + - - - + + + an agent is an animated entity agent - + - - - + + + animal - + - - - + + + animé - + - - + + zone - + - - + + bras - + - + attribut - + - - + + - + - - + + black musta noir @@ -149,10 +152,10 @@ - + - - + + bleu blue sininen @@ -160,74 +163,74 @@ - + - - - + + + blue book - + - - - + + + blue lamp - + - - + + livre - + - - + + boite - + - - + + - + - - + + - + - - - + + + enfant - + - - + + color couleur väri @@ -235,62 +238,62 @@ - + - - + + - + - - - + + + cube - + - - + + tasse - + - - + + - + - - - 1 + + + 1 - + - - + + - + - - + + entity can describe every physical things like human, robot, objetcs, ... entity entité @@ -298,421 +301,421 @@ - + - - - + + + ventilateur - + - - - + + + féminin - + - - + + - + - - + + pied - + - - - + + + meuble - + - - + + gender genre - + - - - - + + + + herbe - + - - + + vert vihreä - + - - - + + + green cup - + - - + + main - + - - + + tête - + - - - - - - 2 + + + + + + 2 humain - + - - + + inanimé - + - - - + + + indoor area zone intérieure - + - - - + + + joints are parts of agent jointure - + - - - + + + lampe - + - - + + jambe - + - - - + + + vivant - + - - + + capteur de luminosité luminosity sensor - + - - + + masculin - + - - - - - 0 + + + + + 0 homme - + - - + + capteur de mouvement motion sensor - + - - + + non vivant non-living - + - - - + + + an object is an inanimated entity objet - + - - + + vieux - + - - + + outdoor area zone extérieur - + - - - + + + - + - - + + pinkki rose - + - - + + plante - + - - + + - + - - + + capteur de présence presence sensor - + - - + + violet violetti - + - - + + punainen rouge - + - - - + + + red bed - + - - - + + + red fan - + - - - + + + red fish - + - - - + + + robot - + - - - + + + capteur - + - - + + - + - - + + - + - - + + - + - - + + cassette - + - - - - + + + + a technical object can also be an affair or a furniture objet technique technical object @@ -722,58 +725,58 @@ furniture - + - - + + capteur de température temperature sensor - + - - + + torse - + - - + + poubelle - + - - - + + + arbre - + - - - + + + végétal - + - - + + vitality describe if an entity is alive or not vitality vitalité @@ -782,126 +785,126 @@ furniture - + - - + + blanc valkoinen - + - - - + + + femme - + - - + + jaune keltainen - + - - + + jeune - + - - + + oiseau - + - - - false + + + false manchot - + - - - false + + + false autruche - + - - - false + + + false takahe - + - - - false + + + false kiwi - + - - - false + + + false - + - - - false + + + false - + - - - true + + + true canari - + - - + + colombe @@ -918,11 +921,11 @@ furniture - + - - - + + + @@ -938,62 +941,62 @@ furniture - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - + + + + + + - - - - - + + + + + diff --git a/files/positionProperty.owl b/files/positionProperty.owl index 4a212ef8..2270cffa 100644 --- a/files/positionProperty.owl +++ b/files/positionProperty.owl @@ -1,12 +1,14 @@ - - + @@ -23,223 +25,223 @@ - + - - + + - + - - - + + + - + - - - + + + - - + + - + - - - - - + + + + + - + - - + + - - + + - + - - + + - - - + + + - - + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - + + - + - - - - + + + + - + - - - - + + + + - + - - + + - - + + - + - - - + + + - - + + - + - - - + + + - - + + - + - - + + - - + + - + - + - + - - + + - - + + - + - + - - + + - + - - + + - + - - + + @@ -256,30 +258,30 @@ - + - - + + - + - - - + + + - + - - + + @@ -296,33 +298,33 @@ - + - + - + - + - + - + - + - + - + - + From b493fd37e8f677c1164ed741c2b9dfab81445de8 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Tue, 17 Oct 2023 10:58:07 +0200 Subject: [PATCH 05/37] [ReasonerChain] fix purge --- include/ontologenius/core/reasoner/plugins/ReasonerChain.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ontologenius/core/reasoner/plugins/ReasonerChain.h b/include/ontologenius/core/reasoner/plugins/ReasonerChain.h index 27f74a93..23e7cf19 100644 --- a/include/ontologenius/core/reasoner/plugins/ReasonerChain.h +++ b/include/ontologenius/core/reasoner/plugins/ReasonerChain.h @@ -219,8 +219,12 @@ class ChainTree if(node->prev != nullptr) { for(size_t i = 0; i < node->prev->nexts.size(); ) + { if(node->prev->nexts[i] == node) node->prev->nexts.erase(node->prev->nexts.begin() + i); + else + i++; + } } if(node == begin) From 7bb50486711ffa36b1874898181519a0ad511d48 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Tue, 17 Oct 2023 14:11:37 +0200 Subject: [PATCH 06/37] [ReasonerChain] use flags to keep trace of potential begining --- src/core/reasoner/plugins/ReasonerChain.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/reasoner/plugins/ReasonerChain.cpp b/src/core/reasoner/plugins/ReasonerChain.cpp index 17401126..fe4f1849 100644 --- a/src/core/reasoner/plugins/ReasonerChain.cpp +++ b/src/core/reasoner/plugins/ReasonerChain.cpp @@ -9,17 +9,26 @@ void ReasonerChain::postReason() std::lock_guard lock(ontology_->individual_graph_.mutex_); std::vector indivs = ontology_->individual_graph_.get(); for(auto indiv : indivs) - if(indiv->updated_ == true) + if((indiv->updated_ == true) || (indiv->flags_.find("chain") != indiv->flags_.end())) { + bool has_active_chain = false; // Do not use a for each loop style. // The vector object_relations_ is modified by resolveChain for(size_t rel_i = 0; rel_i < indiv->object_relations_.size(); rel_i++) { std::unordered_set props = ontology_->object_property_graph_.getUpPtrSafe(indiv->object_relations_[rel_i].first); for(ObjectPropertyBranch_t* it_prop : props) + { + has_active_chain = has_active_chain || (it_prop->chains_.size() != 0); for(auto& chain : it_prop->chains_) resolveChain(it_prop, chain, indiv, indiv->object_relations_[rel_i].second); + } } + + if(has_active_chain) + indiv->flags_["chain"] = {}; + else + indiv->flags_.erase("chain"); } } From 2fb981c78a08fc6ce74ce3f8ce5244bdf5c34320 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Tue, 17 Oct 2023 14:12:05 +0200 Subject: [PATCH 07/37] [ObjectPropertyGraph] no more construct inverse chains --- src/core/ontoGraphs/Graphs/ObjectPropertyGraph.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ontoGraphs/Graphs/ObjectPropertyGraph.cpp b/src/core/ontoGraphs/Graphs/ObjectPropertyGraph.cpp index 7dbcde13..2ae9b100 100644 --- a/src/core/ontoGraphs/Graphs/ObjectPropertyGraph.cpp +++ b/src/core/ontoGraphs/Graphs/ObjectPropertyGraph.cpp @@ -29,7 +29,8 @@ ObjectPropertyGraph::ObjectPropertyGraph(const ObjectPropertyGraph& other, Class void ObjectPropertyGraph::close() { OntoGraph::close(); - createInvertChains(); + //createInvertChains(); // The inverse chain is no more required + // We keep this just in case } ObjectPropertyBranch_t* ObjectPropertyGraph::newDefaultBranch(const std::string& name) From 1de3a41bdab00dfd0d6e9af39ef20d76acd64b0d Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Tue, 17 Oct 2023 16:40:27 +0200 Subject: [PATCH 08/37] [CI] fix CI files --- files/attribute.owl | 1 - 1 file changed, 1 deletion(-) diff --git a/files/attribute.owl b/files/attribute.owl index 8f2e2bcc..c3b4581c 100644 --- a/files/attribute.owl +++ b/files/attribute.owl @@ -250,7 +250,6 @@ - cube From e0f7f5d1c0ea9db86d84b707fe0e89436583d029 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 16:52:15 +0100 Subject: [PATCH 09/37] [OntologyLoader] use curl to download files --- CMakeLists.txt | 10 ++--- .../core/ontologyIO/OntologyLoader.h | 1 + src/core/ontologyIO/OntologyLoader.cpp | 39 +++++++++++++++---- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9449086..69d24965 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,9 @@ find_package(TinyXML REQUIRED) find_package(OpenCV REQUIRED) find_package(pluginlib REQUIRED) find_package(Qt5 COMPONENTS Core Gui Widgets PrintSupport) +find_package(PkgConfig REQUIRED) + +pkg_search_module(CURL REQUIRED libcurl IMPORTED_TARGET GLOBAL) # Install python scripts using distutils catkin_python_setup() @@ -82,7 +85,6 @@ catkin_python_setup() ## Generate services in the 'srv' folder add_service_files( FILES - REST.srv OntologeniusConversion.srv OntologeniusService.srv OntologeniusIndexService.srv @@ -158,7 +160,7 @@ target_include_directories(ontologenius_ontoGraphs_lib ) target_link_libraries(ontologenius_ontoGraphs_lib PUBLIC - ${TinyXML_LIBRARIES} + ${TinyXML_LIBRARIES} PkgConfig::CURL ) add_onto_library(ontologenius_core_lib @@ -394,10 +396,6 @@ install(DIRECTORY include/${PROJECT_NAME}/ PATTERN ".svn" EXCLUDE ) -install(PROGRAMS scripts/REST.py - DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION} -) - install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch ) diff --git a/include/ontologenius/core/ontologyIO/OntologyLoader.h b/include/ontologenius/core/ontologyIO/OntologyLoader.h index 246fc32b..6f27da9a 100644 --- a/include/ontologenius/core/ontologyIO/OntologyLoader.h +++ b/include/ontologenius/core/ontologyIO/OntologyLoader.h @@ -46,6 +46,7 @@ class OntologyLoader bool isProtected(const std::string& page_content); int downloadFile(const std::string& uri); + std::string downlaodFileCurl(const std::string& uri); void loadImports(const std::vector& imports); std::pair resolvePath(const std::string& raw_path); diff --git a/src/core/ontologyIO/OntologyLoader.cpp b/src/core/ontologyIO/OntologyLoader.cpp index c6c41f53..b7741226 100644 --- a/src/core/ontologyIO/OntologyLoader.cpp +++ b/src/core/ontologyIO/OntologyLoader.cpp @@ -1,11 +1,11 @@ #include "ontologenius/core/ontologyIO/OntologyLoader.h" #include "ontologenius/core/utility/error_code.h" -#include "ontologenius/core/utility/utility.h" #include "ontologenius/graphical/Display.h" #include "ontologenius/utils/String.h" #include +#include namespace ontologenius { @@ -158,19 +158,44 @@ bool OntologyLoader::isProtected(const std::string& page_content) int OntologyLoader::downloadFile(const std::string& uri) { - std::string response = ""; - int err = send_request("GET", uri, "", response); + std::string response = downlaodFileCurl(uri); if(isProtected(response)) + { Display::warning("The requested file may be protected: " + uri); - - if(err == NO_ERROR) + return REQUEST_ERROR; + } + else { uri_to_file_.emplace(uri, response); return NO_ERROR; } - else - return REQUEST_ERROR; +} + +std::string OntologyLoader::downlaodFileCurl(const std::string& uri) +{ + std::string res; + res.reserve(1024*1024); + CURL* curl_handle; + curl_global_init(CURL_GLOBAL_ALL); + curl_handle = curl_easy_init(); + curl_easy_setopt(curl_handle, CURLOPT_URL, uri.c_str()); + curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, + +[](void *ptr, size_t size, size_t nmemb, void *stream) -> size_t // the + forces the cast into void* + { + if(stream != nullptr) { + ((std::string*)stream)->append((const char*)ptr, size*nmemb); + return size*nmemb; + } + else + return 0; + }); + curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &res); + curl_easy_perform(curl_handle); + curl_easy_cleanup(curl_handle); + curl_global_cleanup(); + return res; } void OntologyLoader::loadImports(const std::vector& imports) From e83623266d33a475ef3c8ad05c737b79e102eba7 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 16:52:35 +0100 Subject: [PATCH 10/37] remove REST script --- include/ontologenius/core/utility/utility.h | 37 ---- scripts/REST.py | 172 ------------------ .../ontologyIO/Turtle/OntologyTtlReader.cpp | 1 - srv/REST.srv | 7 - 4 files changed, 217 deletions(-) delete mode 100644 include/ontologenius/core/utility/utility.h delete mode 100755 scripts/REST.py delete mode 100644 srv/REST.srv diff --git a/include/ontologenius/core/utility/utility.h b/include/ontologenius/core/utility/utility.h deleted file mode 100644 index e6e8aa89..00000000 --- a/include/ontologenius/core/utility/utility.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef ONTOLOGENIUS_UTILITY_H -#define ONTOLOGENIUS_UTILITY_H - -#include - -#include - -#include "ontologenius/REST.h" - -namespace ontologenius { - -inline int send_request(const std::string& method, const std::string& url, const std::string& body, std::string& response) -{ - ros::NodeHandle n; - - ros::ServiceClient client = n.serviceClient("ontologenius/rest"); - - ontologenius::REST srv; - srv.request.method = method; - srv.request.URL = url; - srv.request.body = body; - - if(!client.call(srv)) - { - ROS_ERROR("REST client call failed"); - return -1; - } - else - { - response = srv.response.text; - return 0; - } -} - -} // namespace ontologenius - -#endif // ONTOLOGENIUS_UTILITY_H diff --git a/scripts/REST.py b/scripts/REST.py deleted file mode 100755 index aef27717..00000000 --- a/scripts/REST.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python - -import rospy -import requests - -from ontologenius.srv import REST -import std_msgs.msg -from ontologenius.msg import HTTP_headers - - -def get_resource(url, headers): - """ - Gets a resource at the given URL - :param url: URL of the resource to get - :return: (string) Body of the HTTP response - """ - try: - response = None - response_code = None - rospy.loginfo("[REST.get_resource()] GET " + url) - - req = requests.get(url, timeout=20) - - if req.status_code != requests.codes.ok: - req.raise_for_status() - if req.status_code == requests.codes.ok: - response = req.text - - response_code = req.status_code - return response_code, response - - except requests.exceptions.ConnectionError as err: - rospy.logwarn("[REST.get_resource()] Connection error (network problem): " + str(err)) - except requests.exceptions.Timeout as err: - rospy.logwarn("[REST.get_resource()] Timeout error: " + str(err)) - except requests.exceptions.HTTPError as err: - rospy.logwarn("[REST.get_resource()] HTTP error: " + str(err)) - except requests.exceptions.RequestException as err: - rospy.logwarn("[REST.get_resource()] Request error: " + str(err)) - - return response_code, "" - - -def delete_resource(url, headers): - """ - Removes a resource at the given URL - :param url: URL of the resource to remove - :return: None - """ - try: - response_code = None - rospy.loginfo("[REST.delete_resource()] DELETE " + url) - - req = requests.delete(url, headers=headers, timeout=8) - - if req.status_code != requests.codes.ok: - req.raise_for_status() - - response_code = req.status_code - return response_code, None - - except requests.exceptions.ConnectionError as err: - rospy.logwarn("[REST.delete_resource()] Connection error (network problem): " + str(err)) - except requests.exceptions.Timeout as err: - rospy.logwarn("[REST.delete_resource()] Timeout error: " + str(err)) - except requests.exceptions.HTTPError as err: - rospy.logwarn("[REST.delete_resource()] HTTP error: " + str(err)) - except requests.exceptions.RequestException as err: - rospy.logwarn("[REST.delete_resource()] Request error: " + str(err)) - - -def post_resource(url, headers, payload=None): - """ - :param url: The URL where to put the new resource - :param headers: The header of the POST request - :param payload: The payload of the request - :return: (int, string) Response code of the HTTP request, Response body - """ - response_code = None - response = None - try: - - rospy.loginfo("[REST.post_resource()] POST " + url) - if payload is not None: - req = requests.post(url, headers=headers, data=payload, timeout=8) - else: - req = requests.post(url, headers=headers, timeout=8) - if not (req.status_code == requests.codes.created or req.status_code == requests.codes.ok): - req.raise_for_status() - rospy.logwarn(str(req.status_code)) - else: - response_code = req.status_code - response = req.text - - except requests.exceptions.ConnectionError as err: - rospy.logwarn("[REST.post_resource()] Connection error (network problem): " + str(err)) - except requests.exceptions.Timeout as err: - rospy.logwarn("[REST.post_resource()] Timeout error: " + str(err)) - except requests.exceptions.HTTPError as err: - rospy.logwarn("[REST.post_resource()] HTTP error: " + str(err)) - except requests.exceptions.RequestException as err: - rospy.logwarn("[REST.post_resource()] Request error: " + str(err)) - - return response_code, response - -def put_in_resource(url, header, payload=None): - """ - Put a payload in the resource at the given URL - :param url: URL of the resource to modify - :param payload: The content we put in resource - :return: None - """ - try: - rospy.loginfo("[REST.put_in_resource()] PUT " + payload + " in " + url) - req = requests.put(url, data=payload, headers=header, timeout=8) - if req.status_code != requests.codes.ok: - req.raise_for_status() - else: - response_code = req.status_code - - except requests.exceptions.ConnectionError as err: - rospy.logwarn("[REST.put_in_resource()] Connection error (network problem): " + str(err)) - except requests.exceptions.Timeout as err: - rospy.logwarn("[REST.put_in_resource()] Timeout error: " + str(err)) - except requests.exceptions.HTTPError as err: - rospy.logwarn("[REST.put_in_resource()] HTTP error: " + str(err)) - except requests.exceptions.RequestException as err: - rospy.logwarn("[REST.put_in_resource()] Request error: " + str(err)) - - return response_code, "" - -def handle_http(req): - """ - Generic interface for http request - :param req: - :return: (int, string) Response code of the HTTP request, Response body - """ - response = None - response_code = None - URL = req.URL - names = req.headers.names.split(' ') - values = req.headers.values.split(' ') - headers = {} - i = 0 - - while i < len(names): - headers.update({names[i]: values[i]}) - i = i + 1 - - if req.method == "GET": - response_code, response = get_resource(URL, headers) - elif req.method == "DELETE": - response_code, response = delete_resource(URL, headers) - elif req.method == "POST": - response_code, response = post_resource(URL, headers, req.body) - elif req.method == "PUT": - response_code, response = put_in_resource(URL, headers, req.body) - - if response_code != requests.codes.ok: - return( None, -1) - if response_code == requests.codes.ok: - return(response, 0) - -def http_resquest(): - rospy.init_node('ontologenius_rest', anonymous=True) - - rospy.Service('ontologenius/rest', REST, handle_http) - print("[ INFO] ready to make http request") - rospy.spin() - -if __name__ == "__main__": - http_resquest() diff --git a/src/core/ontologyIO/Turtle/OntologyTtlReader.cpp b/src/core/ontologyIO/Turtle/OntologyTtlReader.cpp index 323c266d..6f7ffe92 100644 --- a/src/core/ontologyIO/Turtle/OntologyTtlReader.cpp +++ b/src/core/ontologyIO/Turtle/OntologyTtlReader.cpp @@ -4,7 +4,6 @@ #include "ontologenius/core/ontoGraphs/Ontology.h" #include "ontologenius/core/utility/error_code.h" -#include "ontologenius/core/utility/utility.h" #include "ontologenius/graphical/Display.h" namespace ontologenius { diff --git a/srv/REST.srv b/srv/REST.srv deleted file mode 100644 index 557fb4e4..00000000 --- a/srv/REST.srv +++ /dev/null @@ -1,7 +0,0 @@ -string method -string URL -HTTP_headers headers -string body ---- -string text -int16 status From d1da483e8da0e157cd29d1a48adcef1444c4d9bf Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 16:53:31 +0100 Subject: [PATCH 11/37] [launch] remove REST node in launch files --- docs/overview/launchers.html | 14 ++------------ launch/ontologenius.launch | 1 - launch/ontologenius_empty.launch | 1 - launch/ontologenius_full.launch | 1 - launch/ontologenius_multi.launch | 1 - launch/ontologenius_multi_empty.launch | 1 - launch/ontologenius_multi_full.launch | 1 - launch/ontologenius_sparql.launch | 1 - launch/ontologenius_valgrind.launch | 1 - 9 files changed, 2 insertions(+), 20 deletions(-) diff --git a/docs/overview/launchers.html b/docs/overview/launchers.html index 23fbfecc..a1775d0a 100644 --- a/docs/overview/launchers.html +++ b/docs/overview/launchers.html @@ -84,8 +84,8 @@

Ontologenius launchers

-

Ontologenius consists of three executables: the kernel, the REST module and a graphical interface (ontoloGUI). - While the first two are mandatory, the only purpose of the latter is to quickly see the effect of queries.

+

Ontologenius consists of two executables: the kernel and a graphical interface (ontoloGUI). + While the first is mandatory, the only purpose of the latter is to quickly see the effect of queries.

Ontologenius core

An Ontologenius core needs at least three parameters to be able to run:

@@ -190,16 +190,6 @@

Ontologenius core

Arguments are passed to the executable as options (-l, -i, -c). If you do not set an option, the setting will take a default value.

-

Ontologenius REST

- -

The REST executable is actually just a python node that provides Ontologenius with a way to access the Internet to download - ontologies, for example.

-

This node does not need to be started if you do not want to load ontologies from the Internet.

- -
-
<node name="ontologenius_rest" pkg="ontologenius" type="REST.py" output="screen" > </node>
-
-

OntoloGUI

OntoloGUI is the Ontologenius GUI. Its only purpose is to help you develop applications using Ontologenius. It is not diff --git a/launch/ontologenius.launch b/launch/ontologenius.launch index 47926414..b2387f2b 100644 --- a/launch/ontologenius.launch +++ b/launch/ontologenius.launch @@ -15,5 +15,4 @@ - diff --git a/launch/ontologenius_empty.launch b/launch/ontologenius_empty.launch index 16d90202..e920877a 100644 --- a/launch/ontologenius_empty.launch +++ b/launch/ontologenius_empty.launch @@ -9,6 +9,5 @@ - diff --git a/launch/ontologenius_full.launch b/launch/ontologenius_full.launch index d163d528..5cae154f 100644 --- a/launch/ontologenius_full.launch +++ b/launch/ontologenius_full.launch @@ -15,6 +15,5 @@ - diff --git a/launch/ontologenius_multi.launch b/launch/ontologenius_multi.launch index d59b444e..2e2da222 100644 --- a/launch/ontologenius_multi.launch +++ b/launch/ontologenius_multi.launch @@ -17,5 +17,4 @@ - diff --git a/launch/ontologenius_multi_empty.launch b/launch/ontologenius_multi_empty.launch index 1db0e013..1c5b3820 100644 --- a/launch/ontologenius_multi_empty.launch +++ b/launch/ontologenius_multi_empty.launch @@ -11,5 +11,4 @@ - diff --git a/launch/ontologenius_multi_full.launch b/launch/ontologenius_multi_full.launch index 316f90bb..48580411 100644 --- a/launch/ontologenius_multi_full.launch +++ b/launch/ontologenius_multi_full.launch @@ -17,6 +17,5 @@ - diff --git a/launch/ontologenius_sparql.launch b/launch/ontologenius_sparql.launch index 9a5972c7..eff71779 100644 --- a/launch/ontologenius_sparql.launch +++ b/launch/ontologenius_sparql.launch @@ -13,6 +13,5 @@ - diff --git a/launch/ontologenius_valgrind.launch b/launch/ontologenius_valgrind.launch index 87c71630..cb59801a 100644 --- a/launch/ontologenius_valgrind.launch +++ b/launch/ontologenius_valgrind.launch @@ -11,5 +11,4 @@ - From 40450a5f47bd72ec744ba5f5c02286d16e0dc040 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 18:09:08 +0100 Subject: [PATCH 12/37] [OntologyLoader] remove ros dependencies --- CMakeLists.txt | 19 +++++- .../core/ontologyIO/Owl/OntologyOwlReader.h | 2 - include/ontologenius/utils/Commands.h | 58 +++++++++++++++++++ src/core/ontologyIO/OntologyLoader.cpp | 7 +-- 4 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 include/ontologenius/utils/Commands.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 69d24965..4fd67dc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,20 @@ if(WITH_CLANG_TIDY) endif() include(cmake/Sanitizers.cmake) +function(add_onto_base_library TARGET) + if(NOT TARGET) + message(FATAL_ERROR "Expected the target name as first argument") + endif() + if(NOT ARGN) + message(FATAL_ERROR "Expected source file list after target name") + endif() + add_library(${TARGET} ${ARGN}) + target_include_directories(${TARGET} PUBLIC include) + set_target_properties(${TARGET} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) + target_compile_options(${TARGET} PRIVATE -Wall -Wextra) + target_enable_sanitizers(${TARGET}) +endfunction(add_onto_base_library) + function(add_onto_library TARGET) if(NOT TARGET) message(FATAL_ERROR "Expected the target name as first argument") @@ -55,7 +69,6 @@ find_package(catkin REQUIRED COMPONENTS ) ## System dependencies are found with CMake's conventions -find_package(Boost REQUIRED COMPONENTS system) find_package(cmake_modules REQUIRED) find_package(TinyXML REQUIRED) find_package(OpenCV REQUIRED) @@ -126,7 +139,7 @@ catkin_package( ## CORE ############################## -add_onto_library(ontologenius_ontoGraphs_lib +add_onto_base_library(ontologenius_ontoGraphs_lib src/core/ontoGraphs/Branchs/ClassBranch.cpp src/core/ontoGraphs/Branchs/ObjectPropertyBranch.cpp src/core/ontoGraphs/Branchs/DataPropertyBranch.cpp @@ -181,7 +194,7 @@ target_link_libraries(ontologenius_core_lib ## DRAWER ############################## -add_onto_library(ontologenius_drawer_lib +add_onto_base_library(ontologenius_drawer_lib src/graphical/versioning/TreeReader.cpp src/graphical/versioning/TreeDrawer.cpp ) diff --git a/include/ontologenius/core/ontologyIO/Owl/OntologyOwlReader.h b/include/ontologenius/core/ontologyIO/Owl/OntologyOwlReader.h index 3b4a87c6..43d7939e 100644 --- a/include/ontologenius/core/ontologyIO/Owl/OntologyOwlReader.h +++ b/include/ontologenius/core/ontologyIO/Owl/OntologyOwlReader.h @@ -8,8 +8,6 @@ #include -#include - #include "ontologenius/core/ontologyIO/OntologyReader.h" #include "ontologenius/core/ontoGraphs/Graphs/ClassGraph.h" diff --git a/include/ontologenius/utils/Commands.h b/include/ontologenius/utils/Commands.h new file mode 100644 index 00000000..27ff0db0 --- /dev/null +++ b/include/ontologenius/utils/Commands.h @@ -0,0 +1,58 @@ +#include +#include +#include + +#include "ontologenius/utils/String.h" + +namespace ontologenius { + +std::string execCmd(std::string cmd) +{ + char buffer[128]; + std::string result = ""; + cmd.append(" 2>&1"); + FILE* pipe = popen(cmd.c_str(), "r"); + if (!pipe) throw std::runtime_error("popen() failed!"); + try + { + while (fgets(buffer, sizeof buffer, pipe) != NULL) + result += buffer; + } + catch (...) + { + pclose(pipe); + return ""; + } + + pclose(pipe); + if(result.find("not found") != std::string::npos) + return ""; + + return result; +} + +std::string findPackageRos1(const std::string& pkg_name) +{ + std::string results = execCmd("rospack find " + pkg_name); + if(results.size()) + { + auto split_res = split(results, "\n"); + return split_res.front(); + } + else + return ""; +} + +std::vector listPackagesRos1() +{ + std::string results = execCmd("rospack list-names"); + if(results.size()) + { + auto split_res = split(results, "\n"); + return split_res; + } + else + return {}; +} + +} // namespace ontologenius \ No newline at end of file diff --git a/src/core/ontologyIO/OntologyLoader.cpp b/src/core/ontologyIO/OntologyLoader.cpp index b7741226..f354d5ec 100644 --- a/src/core/ontologyIO/OntologyLoader.cpp +++ b/src/core/ontologyIO/OntologyLoader.cpp @@ -3,8 +3,8 @@ #include "ontologenius/core/utility/error_code.h" #include "ontologenius/graphical/Display.h" #include "ontologenius/utils/String.h" +#include "ontologenius/utils/Commands.h" -#include #include namespace ontologenius { @@ -206,7 +206,7 @@ void OntologyLoader::loadImports(const std::vector& imports) auto with_package = resolvePath(import); if(with_package.first != "") { - std::string path = ros::package::getPath(with_package.first); + std::string path = findPackageRos1(with_package.first); path += "/" + with_package.second; fixPath(path); @@ -249,8 +249,7 @@ void OntologyLoader::loadImports(const std::vector& imports) std::pair OntologyLoader::resolvePath(const std::string& raw_path) { - std::vector packages; - ros::package::getAll(packages); + std::vector packages = listPackagesRos1(); auto parts = split(raw_path, "/"); for(auto part_it = parts.begin(); part_it != parts.end(); ++part_it) From ab04684b4ffa3d118c9a8f2722b8910a21e89902 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 18:25:23 +0100 Subject: [PATCH 13/37] [CMakeLists] remove ros dep to ontologenius_core_lib --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fd67dc2..26286374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,10 +62,10 @@ endfunction(add_onto_executable) find_package(catkin REQUIRED COMPONENTS roscpp rospy + roslib std_msgs genmsg message_generation - pluginlib ) ## System dependencies are found with CMake's conventions @@ -176,7 +176,7 @@ target_link_libraries(ontologenius_ontoGraphs_lib ${TinyXML_LIBRARIES} PkgConfig::CURL ) -add_onto_library(ontologenius_core_lib +add_onto_base_library(ontologenius_core_lib src/core/feeder/Feeder.cpp src/core/feeder/FeedStorage.cpp src/core/feeder/Versionor.cpp @@ -185,9 +185,12 @@ add_onto_library(ontologenius_core_lib src/core/reasoner/Reasoners.cpp src/core/reasoner/ConfigReader.cpp ) +target_include_directories(ontologenius_core_lib + PUBLIC ${pluginlib_INCLUDE_DIRS} +) target_link_libraries(ontologenius_core_lib PUBLIC - ontologenius_ontoGraphs_lib + ontologenius_ontoGraphs_lib ${pluginlib_LIBRARIES} ) ############################## @@ -381,7 +384,7 @@ target_include_directories(ontoloGUI PRIVATE ${catkin_INCLUDE_DIRS} ) -add_dependencies(ontoloGUI ontologenius_gencpp) +add_dependencies(ontoloGUI ontologenius_gencpp ${catkin_EXPORTED_TARGETS}) target_link_libraries(ontoloGUI ${catkin_LIBRARIES} Qt5::Core From 18285224e1ab8d93b214f06466fd8274837795f6 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 18:32:04 +0100 Subject: [PATCH 14/37] [API] remove useless ros includes --- include/ontologenius/API/ontologenius/OntologiesManipulator.h | 2 -- include/ontologenius/API/ontologenius/OntologyManipulator.h | 2 -- .../ontologenius/API/ontologenius/OntologyManipulatorIndex.h | 2 -- 3 files changed, 6 deletions(-) diff --git a/include/ontologenius/API/ontologenius/OntologiesManipulator.h b/include/ontologenius/API/ontologenius/OntologiesManipulator.h index 396d9476..64e80b96 100644 --- a/include/ontologenius/API/ontologenius/OntologiesManipulator.h +++ b/include/ontologenius/API/ontologenius/OntologiesManipulator.h @@ -4,8 +4,6 @@ #include #include -#include - #include "ontologenius/API/ontologenius/clients/ManagerClient.h" #include "ontologenius/API/ontologenius/OntologyManipulator.h" #include "ontologenius/API/ontologenius/OntologyManipulatorIndex.h" diff --git a/include/ontologenius/API/ontologenius/OntologyManipulator.h b/include/ontologenius/API/ontologenius/OntologyManipulator.h index 77e71805..af436bbd 100644 --- a/include/ontologenius/API/ontologenius/OntologyManipulator.h +++ b/include/ontologenius/API/ontologenius/OntologyManipulator.h @@ -4,8 +4,6 @@ #include #include -#include - #include "ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h" #include "ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h" #include "ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h" diff --git a/include/ontologenius/API/ontologenius/OntologyManipulatorIndex.h b/include/ontologenius/API/ontologenius/OntologyManipulatorIndex.h index cafc1cc3..c37bb303 100644 --- a/include/ontologenius/API/ontologenius/OntologyManipulatorIndex.h +++ b/include/ontologenius/API/ontologenius/OntologyManipulatorIndex.h @@ -4,8 +4,6 @@ #include #include -#include - #include "ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h" #include "ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h" #include "ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h" From e48eaad097261c2a7d33e3d10fa1225f0e097eca Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 18:40:46 +0100 Subject: [PATCH 15/37] [CMakeLists] remove ros deps to ontologenius_interface --- CMakeLists.txt | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26286374..1547f33d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,20 @@ function(add_onto_library TARGET) target_enable_sanitizers(${TARGET}) endfunction(add_onto_library) +function(add_onto_base_executable TARGET) + if(NOT TARGET) + message(FATAL_ERROR "Expected the target name as first argument") + endif() + if(NOT ARGN) + message(FATAL_ERROR "Expected source file list after target name") + endif() + add_executable(${TARGET} ${ARGN}) + target_include_directories(${TARGET} PUBLIC include) + set_target_properties(${TARGET} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) + target_compile_options(${TARGET} PRIVATE -Wall -Wextra) + target_enable_sanitizers(${TARGET}) +endfunction(add_onto_base_executable) + function(add_onto_executable TARGET) if(NOT TARGET) message(FATAL_ERROR "Expected the target name as first argument") @@ -247,7 +261,7 @@ target_link_libraries(ontologenius_lib ############################## ## PLUGINS ############################## -add_onto_library(ontologenius_reasoner_plugin +add_onto_base_library(ontologenius_reasoner_plugin src/core/reasoner/plugins/ReasonerNone.cpp src/core/reasoner/plugins/ReasonerInverseOf.cpp src/core/reasoner/plugins/ReasonerSymetric.cpp @@ -256,9 +270,12 @@ add_onto_library(ontologenius_reasoner_plugin src/core/reasoner/plugins/ReasonerGeneralize.cpp src/core/reasoner/plugins/ReasonerRangeDomain.cpp ) +target_include_directories(ontologenius_reasoner_plugin + PUBLIC ${pluginlib_INCLUDE_DIRS} +) target_link_libraries(ontologenius_reasoner_plugin PUBLIC - ontologenius_core_lib + ontologenius_core_lib ${pluginlib_LIBRARIES} ) ############################## @@ -295,7 +312,7 @@ target_link_libraries(ontologenius PRIVATE ontologenius_interface) add_onto_executable(ontologenius_multi src/nodes/ontologenius_multi.cpp) target_link_libraries(ontologenius_multi PRIVATE ontologenius_interface) -add_onto_executable(ontologenius_draw src/graphical/versioning/main.cpp ) +add_onto_base_executable(ontologenius_draw src/graphical/versioning/main.cpp ) target_link_libraries(ontologenius_draw PRIVATE ontologenius_drawer_lib ontologenius_core_lib) ############################## From 41bdc0376205e86e7df3520312937074136d9e07 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 19:01:24 +0100 Subject: [PATCH 16/37] [CI] add libcurl --- .github/workflows/main.yml | 2 +- .gitlab-ci.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66517d67..4636b499 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,7 @@ jobs: sudo apt update -qq sudo apt install dpkg sudo apt install -y ros-$ROS_DISTRO-desktop qtbase5-dev qtdeclarative5-dev - sudo apt install -y libcppunit-dev + sudo apt install -y libcppunit-dev libcurl4-openssl-dev if [ $ROS_DISTRO != noetic ] then sudo apt-get install python-rosdep diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef9f1787..bfce1f14 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,12 +39,12 @@ .melodic_before_template : &melodic_before_definition before_script: - source /opt/ros/melodic/setup.bash - - apt-get update -qq && apt-get install -y libcppunit-1.14-0 libcppunit-dev libtinyxml-dev python-rosdep python-pip + - apt-get update -qq && apt-get install -y libcppunit-1.14-0 libcppunit-dev libtinyxml-dev python-rosdep python-pip libcurl4-openssl-dev .noetic_before_template : &noetic_before_definition before_script: - source /opt/ros/noetic/setup.bash - - apt-get update -qq && apt-get install -y libcppunit-1.15-0 libcppunit-dev libtinyxml-dev git-all python3-rosdep python3-pip + - apt-get update -qq && apt-get install -y libcppunit-1.15-0 libcppunit-dev libtinyxml-dev git-all python3-rosdep python3-pip libcurl4-openssl-dev stages: - build From 3517a245ffd855b76f179a6a0ffd7edaf5fb0cab Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sat, 2 Dec 2023 19:05:17 +0100 Subject: [PATCH 17/37] [CMakeLists] remove operators from ontologenius_interfacelib --- CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1547f33d..aa1ad146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,6 +278,17 @@ target_link_libraries(ontologenius_reasoner_plugin ontologenius_core_lib ${pluginlib_LIBRARIES} ) +add_onto_base_library(ontologenius_operators + src/core/ontologyOperators/differenceFinder.cpp + src/core/ontologyOperators/Sparql.cpp + src/core/ontologyOperators/SparqlSolver.cpp + src/core/ontologyOperators/SparqlUtils.cpp +) +target_link_libraries(ontologenius_operators + PUBLIC + ontologenius_core_lib +) + ############################## ## INTERFACE ############################## @@ -286,14 +297,10 @@ add_onto_library(ontologenius_interface src/interface/RosInterface.cpp src/interface/RosInterfaceStringHandlers.cpp src/interface/RosInterfaceIndexHandlers.cpp - src/core/ontologyOperators/differenceFinder.cpp - src/core/ontologyOperators/Sparql.cpp - src/core/ontologyOperators/SparqlSolver.cpp - src/core/ontologyOperators/SparqlUtils.cpp ) target_link_libraries(ontologenius_interface PUBLIC - ontologenius_core_lib + ontologenius_core_lib ontologenius_operators ) ############################## From fe3d77585b35e8d6daf98873ea78a30e1f905fa5 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 15:16:23 +0100 Subject: [PATCH 18/37] [CI] copy_test remove ros deps --- src/tests/CI/copy_test.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tests/CI/copy_test.cpp b/src/tests/CI/copy_test.cpp index 2dba0c3b..be663906 100644 --- a/src/tests/CI/copy_test.cpp +++ b/src/tests/CI/copy_test.cpp @@ -1,7 +1,7 @@ #include "ontologenius/core/ontoGraphs/Ontology.h" +#include "ontologenius/utils/Commands.h" #include -#include #include @@ -12,7 +12,7 @@ TEST(cpy_tests, reset) ontologenius::Ontology onto1; onto1.setDisplay(false); - std::string path_base = ros::package::getPath("ontologenius"); + std::string path_base = ontologenius::findPackageRos1("ontologenius"); std::string path = path_base + "/files/attribute.owl"; onto1.readFromFile(path); path = path_base + "/files/positionProperty.owl"; @@ -47,10 +47,6 @@ TEST(cpy_tests, reset) int main(int argc, char** argv) { - ros::init(argc, argv, "ontologenius_cpy"); - testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } From a75d266b4fd238872b61d53e4e6db6d85a27506e Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 15:16:47 +0100 Subject: [PATCH 19/37] [CI] clean mains --- src/tests/CI/dynamic.cpp | 2 -- src/tests/CI/globalFeatures.cpp | 2 -- src/tests/CI/library.cpp | 2 -- src/tests/CI/multi.cpp | 2 -- src/tests/CI/propertiesInheritage.cpp | 2 -- src/tests/CI/propertiesInheritageIndex.cpp | 2 -- src/tests/CI/requests.cpp | 2 -- 7 files changed, 14 deletions(-) diff --git a/src/tests/CI/dynamic.cpp b/src/tests/CI/dynamic.cpp index a1c59471..dbae420a 100644 --- a/src/tests/CI/dynamic.cpp +++ b/src/tests/CI/dynamic.cpp @@ -72,6 +72,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/globalFeatures.cpp b/src/tests/CI/globalFeatures.cpp index d5384fb3..6421dc19 100644 --- a/src/tests/CI/globalFeatures.cpp +++ b/src/tests/CI/globalFeatures.cpp @@ -157,6 +157,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/library.cpp b/src/tests/CI/library.cpp index dd43a334..7816d4e7 100644 --- a/src/tests/CI/library.cpp +++ b/src/tests/CI/library.cpp @@ -110,6 +110,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/multi.cpp b/src/tests/CI/multi.cpp index 75df970d..e15618cd 100644 --- a/src/tests/CI/multi.cpp +++ b/src/tests/CI/multi.cpp @@ -104,6 +104,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/propertiesInheritage.cpp b/src/tests/CI/propertiesInheritage.cpp index 5d383dc5..70f8db5d 100644 --- a/src/tests/CI/propertiesInheritage.cpp +++ b/src/tests/CI/propertiesInheritage.cpp @@ -734,6 +734,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/propertiesInheritageIndex.cpp b/src/tests/CI/propertiesInheritageIndex.cpp index 3bc5ef68..16796017 100644 --- a/src/tests/CI/propertiesInheritageIndex.cpp +++ b/src/tests/CI/propertiesInheritageIndex.cpp @@ -734,6 +734,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } diff --git a/src/tests/CI/requests.cpp b/src/tests/CI/requests.cpp index 0951dc82..88ba5c7b 100644 --- a/src/tests/CI/requests.cpp +++ b/src/tests/CI/requests.cpp @@ -195,6 +195,4 @@ int main(int argc, char** argv) testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); - - return 0; } From f120c3ab0f20c5adf034c369f589d12c26fe103d Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 16:16:15 +0100 Subject: [PATCH 20/37] [API] reduce NodeHandle use --- CMakeLists.txt | 1 + .../API/ontologenius/ConversionClient.h | 5 +- .../API/ontologenius/FeederPublisher.h | 19 +++--- .../API/ontologenius/OntologiesManipulator.h | 7 +- .../API/ontologenius/clients/ActionClient.h | 3 +- .../API/ontologenius/clients/ClientBase.h | 22 +++---- .../API/ontologenius/clients/ManagerClient.h | 6 +- .../API/ontologenius/clients/ReasonerClient.h | 6 +- .../API/ontologenius/clients/SparqlClient.h | 11 ++-- .../clients/ontologyClients/ClassClient.h | 6 +- .../ontologyClients/DataPropertyClient.h | 3 +- .../ontologyClients/IndividualClient.h | 3 +- .../ontologyClients/ObjectPropertyClient.h | 3 +- .../clients/ontologyClients/OntologyClient.h | 3 +- .../clientsIndex/ClientBaseIndex.h | 26 ++++---- .../clientsIndex/SparqlIndexClient.h | 14 ++-- .../ontologyClients/ClassIndexClient.h | 3 +- .../ontologyClients/DataPropertyIndexClient.h | 3 +- .../ontologyClients/IndividualIndexClient.h | 3 +- .../ObjectPropertyIndexClient.h | 3 +- .../ontologyClients/OntologyIndexClient.h | 3 +- src/API/ontologenius/ConversionClient.cpp | 8 +-- .../ontologenius/OntologiesManipulator.cpp | 7 +- src/API/ontologenius/OntologyManipulator.cpp | 64 +++++++++---------- .../ontologenius/OntologyManipulatorIndex.cpp | 54 ++++++++-------- src/API/ontologenius/clients/SparqlClient.cpp | 2 +- .../clientsIndex/SparqlIndexClient.cpp | 2 +- 27 files changed, 134 insertions(+), 156 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa1ad146..3a0daed6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,6 +253,7 @@ add_onto_library(ontologenius_lib src/API/ontologenius/OntologyManipulatorIndex.cpp src/API/ontologenius/OntologiesManipulator.cpp ) +target_include_directories(ontologenius_lib PUBLIC include/ontologenius/API) target_link_libraries(ontologenius_lib PUBLIC ontologenius_core_lib diff --git a/include/ontologenius/API/ontologenius/ConversionClient.h b/include/ontologenius/API/ontologenius/ConversionClient.h index 4668a88a..598859b0 100644 --- a/include/ontologenius/API/ontologenius/ConversionClient.h +++ b/include/ontologenius/API/ontologenius/ConversionClient.h @@ -13,9 +13,8 @@ class ConversionClient { public: /// @brief Constructs a ROS conversion client. - /// @param n is an initialized ROS node handle. /// @param name is the name of the ontologenius service - ConversionClient(ros::NodeHandle* n, const std::string& name); + ConversionClient(const std::string& name); void verbose(bool verbose) { verbose_ = verbose; } @@ -45,7 +44,7 @@ class ConversionClient private: std::string name_; - ros::NodeHandle* n_; + ros::NodeHandle n_; bool verbose_; ros::ServiceClient client_; diff --git a/include/ontologenius/API/ontologenius/FeederPublisher.h b/include/ontologenius/API/ontologenius/FeederPublisher.h index a5a67eea..a0954e72 100644 --- a/include/ontologenius/API/ontologenius/FeederPublisher.h +++ b/include/ontologenius/API/ontologenius/FeederPublisher.h @@ -21,27 +21,24 @@ class FeederPublisher public: /// @brief Constructs a FeederPublisher. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - FeederPublisher(ros::NodeHandle* n, const std::string& name) : - n_(n), + FeederPublisher(const std::string& name) : name_(name), - pub_(n->advertise((name == "") ? "ontologenius/insert" : "ontologenius/insert/" + name, 1000)), - stamped_pub_(n->advertise((name == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + name, 1000)) + pub_(n_.advertise((name == "") ? "ontologenius/insert" : "ontologenius/insert/" + name, 1000)), + stamped_pub_(n_.advertise((name == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + name, 1000)) { srand (time(NULL)); commit_nb_ = rand() % 100000 + 1; - commit_sub_ = n_->subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); + commit_sub_ = n_.subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); updated_ = false; } FeederPublisher(FeederPublisher& other) : - n_(other.n_), name_(other.name_), - pub_(other.n_->advertise((other.name_ == "") ? "ontologenius/insert" : "ontologenius/insert/" + other.name_, 1000)), - stamped_pub_(other.n_->advertise((other.name_ == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + other.name_, 1000)) + pub_(n_.advertise((other.name_ == "") ? "ontologenius/insert" : "ontologenius/insert/" + other.name_, 1000)), + stamped_pub_(n_.advertise((other.name_ == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + other.name_, 1000)) { - commit_sub_ = n_->subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); + commit_sub_ = n_.subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); commit_nb_ = other.commit_nb_; updated_ = false; } @@ -175,7 +172,7 @@ class FeederPublisher bool checkout(const std::string& commit_name, int32_t timeout = -1); private: - ros::NodeHandle* n_; + ros::NodeHandle n_; std::string name_; ros::Publisher pub_; ros::Publisher stamped_pub_; diff --git a/include/ontologenius/API/ontologenius/OntologiesManipulator.h b/include/ontologenius/API/ontologenius/OntologiesManipulator.h index 64e80b96..98b0998f 100644 --- a/include/ontologenius/API/ontologenius/OntologiesManipulator.h +++ b/include/ontologenius/API/ontologenius/OntologiesManipulator.h @@ -16,10 +16,9 @@ namespace onto { class OntologiesManipulator : public ManagerClient { public: - /// @brief Constructs a manipulator for several instance of ontologies with a pointer to a NodeHandle n. - /// This pointer is necessary to create the ros services in the constructor. - /// @param n is an initialized ros node handle + /// @brief Constructs a manipulator for several instance of ontologies explicit OntologiesManipulator(ros::NodeHandle* n); + OntologiesManipulator(); ~OntologiesManipulator(); /// @brief Wait for ontologenius services to be advertised and available for. Blocks until it is. @@ -61,7 +60,7 @@ class OntologiesManipulator : public ManagerClient } private: - ros::NodeHandle* n_; // do not move this line below + ros::NodeHandle n_; // do not move this line below std::map manipulators_; std::map manipulators_index_; }; diff --git a/include/ontologenius/API/ontologenius/clients/ActionClient.h b/include/ontologenius/API/ontologenius/clients/ActionClient.h index 72bd4245..78b51b48 100644 --- a/include/ontologenius/API/ontologenius/clients/ActionClient.h +++ b/include/ontologenius/API/ontologenius/clients/ActionClient.h @@ -14,9 +14,8 @@ class ActionClient : public ClientBase public: /// @brief Constructs an action client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ActionClient(ros::NodeHandle* n, const std::string& name) : ClientBase(n, (name == "") ? "actions" : "actions/" + name) + ActionClient(const std::string& name) : ClientBase((name == "") ? "actions" : "actions/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ClientBase.h b/include/ontologenius/API/ontologenius/clients/ClientBase.h index 5e6723a4..74015df6 100644 --- a/include/ontologenius/API/ontologenius/clients/ClientBase.h +++ b/include/ontologenius/API/ontologenius/clients/ClientBase.h @@ -31,12 +31,10 @@ class ClientBase { public: /// @brief Constructs a ROS client. - /// @param n is an initialized ROS node handle. /// @param name is the name of the ontologenius service - ClientBase(ros::NodeHandle* n, const std::string& name) : client(n->serviceClient("/ontologenius/" + name, true)), name_(name) - { - n_ = n; - } + ClientBase(const std::string& name) : name_(name), + client(n_.serviceClient("/ontologenius/" + name, true)) + {} /// @brief Gives the total number of service calls from all ClientBase instances since the last reset. size_t nb() {return cpt;} @@ -45,7 +43,6 @@ class ClientBase static void verbose(bool verbose) { verbose_ = verbose; } protected: - ros::ServiceClient client; /// @brief Calls the service set up in the constructor of ClientBase. /// @param srv is the request. @@ -61,7 +58,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -97,7 +94,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -130,7 +127,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -159,7 +156,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -177,9 +174,12 @@ class ClientBase private: std::string name_; - ros::NodeHandle* n_; + ros::NodeHandle n_; static size_t cpt; static bool verbose_; + +protected: + ros::ServiceClient client; }; } // namespace onto diff --git a/include/ontologenius/API/ontologenius/clients/ManagerClient.h b/include/ontologenius/API/ontologenius/clients/ManagerClient.h index 8f3a592e..e8057ee2 100644 --- a/include/ontologenius/API/ontologenius/clients/ManagerClient.h +++ b/include/ontologenius/API/ontologenius/clients/ManagerClient.h @@ -18,11 +18,9 @@ class ManagerClient : public ClientBase public: /// @brief Constructs a manager client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - explicit ManagerClient(ros::NodeHandle* n) : ClientBase(n, "manage") - { - } + explicit ManagerClient() : ClientBase("manage") + { } /// @brief Gets the name of the instantiated ontologies. /// @return the list as the instantiated ontologies in the form of a verctor of string. diff --git a/include/ontologenius/API/ontologenius/clients/ReasonerClient.h b/include/ontologenius/API/ontologenius/clients/ReasonerClient.h index 4afed6b1..2bbee8e1 100644 --- a/include/ontologenius/API/ontologenius/clients/ReasonerClient.h +++ b/include/ontologenius/API/ontologenius/clients/ReasonerClient.h @@ -16,11 +16,9 @@ class ReasonerClient : public ClientBase public: /// @brief Constructs a reasoner client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ReasonerClient(ros::NodeHandle* n, const std::string& name) : ClientBase(n, (name == "") ? "reasoner" : "reasoner/" + name) - { - } + ReasonerClient(const std::string& name) : ClientBase((name == "") ? "reasoner" : "reasoner/" + name) + {} /// @brief Gets the name of the plugins available. /// @return the list as the available plugins in the form of a verctor of string. diff --git a/include/ontologenius/API/ontologenius/clients/SparqlClient.h b/include/ontologenius/API/ontologenius/clients/SparqlClient.h index 131dee43..b9246b5d 100644 --- a/include/ontologenius/API/ontologenius/clients/SparqlClient.h +++ b/include/ontologenius/API/ontologenius/clients/SparqlClient.h @@ -15,20 +15,17 @@ class SparqlClient public: /// @brief Constructs a sparql client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - SparqlClient(ros::NodeHandle* n, const std::string& name) : client(n->serviceClient((name == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name, true)), - name_((name == "") ? "sparql" : "sparql/" + name) - { - n_ = n; - } + SparqlClient(const std::string& name) : client(n_.serviceClient((name == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name, true)), + name_((name == "") ? "sparql" : "sparql/" + name) + {} std::pair, std::vector> call(const std::string& query); private: + ros::NodeHandle n_; ros::ServiceClient client; std::string name_; - ros::NodeHandle* n_; }; } // namespace onto diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h index b02b90b1..ec68e8f3 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h @@ -15,11 +15,9 @@ class ClassClient : public OntologyClient public: /// @brief Constructs a class client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ClassClient(ros::NodeHandle* n, const std::string& name) : OntologyClient(n, (name == "") ? "class" : "class/" + name) - { - } + ClassClient(const std::string& name) : OntologyClient((name == "") ? "class" : "class/" + name) + {} /// @brief Gives all classes below the one given in the specified parameter. /// @param name is a class identifier. diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h index 73c48998..ca46a960 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h @@ -15,9 +15,8 @@ class DataPropertyClient : public OntologyClient public: /// @brief Constructs a data property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - DataPropertyClient(ros::NodeHandle* n, const std::string& name) : OntologyClient(n, (name == "") ? "data_property" : "data_property/" + name) + DataPropertyClient(const std::string& name) : OntologyClient((name == "") ? "data_property" : "data_property/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h index 3ea5b6a9..b5c6903c 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h @@ -15,9 +15,8 @@ class IndividualClient : public OntologyClient public: /// @brief Constructs an individual client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - IndividualClient(ros::NodeHandle* n, const std::string& name) : OntologyClient(n, (name == "")? "individual" : "individual/" + name) + IndividualClient(const std::string& name) : OntologyClient((name == "")? "individual" : "individual/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h index acb87a91..5ac76f71 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h @@ -15,9 +15,8 @@ class ObjectPropertyClient : public OntologyClient public: /// @brief Constructs an object property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ObjectPropertyClient(ros::NodeHandle* n, const std::string& name) : OntologyClient(n, (name == "") ? "object_property" : "object_property/" + name) + ObjectPropertyClient(const std::string& name) : OntologyClient((name == "") ? "object_property" : "object_property/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h index 94ddb643..99ce1e49 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h @@ -15,9 +15,8 @@ class OntologyClient : public ClientBase public: /// @brief Constructs an ontology client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - OntologyClient(ros::NodeHandle* n, const std::string& name) : ClientBase(n, name) + OntologyClient(const std::string& name) : ClientBase(name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h b/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h index 163047a4..043e7787 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h @@ -31,12 +31,10 @@ class ClientBaseIndex { public: /// @brief Constructs a ROS client. - /// @param n is an initialized ROS node handle. /// @param name is the name of the ontologenius service - ClientBaseIndex(ros::NodeHandle* n, const std::string& name) : client(n->serviceClient("/ontologenius/" + name, true)), name_(name) - { - n_ = n; - } + ClientBaseIndex(const std::string& name) : name_(name), + client(n_.serviceClient("/ontologenius/" + name, true)) + {} /// @brief Gives the total number of service calls from all ClientBaseIndex instances since the last reset. size_t nb() {return cpt;} @@ -45,7 +43,6 @@ class ClientBaseIndex static void verbose(bool verbose) { verbose_ = verbose; } protected: - ros::ServiceClient client; /// @brief Calls the service set up in the constructor of ClientBaseIndex. /// @param srv is the request. @@ -61,7 +58,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -92,7 +89,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -127,7 +124,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -164,7 +161,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -196,7 +193,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -225,7 +222,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call ontologenius/" << name_ << COLOR_OFF << std::endl; - client = n_->serviceClient("/ontologenius/" + name_, true); + client = n_.serviceClient("/ontologenius/" + name_, true); if(client.call(srv)) { if(verbose_) @@ -243,9 +240,12 @@ class ClientBaseIndex private: std::string name_; - ros::NodeHandle* n_; + ros::NodeHandle n_; static size_t cpt; static bool verbose_; + +protected: + ros::ServiceClient client; }; } // namespace onto diff --git a/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h index cd3eb316..fddf0051 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h @@ -15,20 +15,18 @@ class SparqlIndexClient public: /// @brief Constructs a sparql client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - SparqlIndexClient(ros::NodeHandle* n, const std::string& name) : client(n->serviceClient((name == "") ? "ontologenius/sparql_index" : "ontologenius/sparql_index/" + name, true)), - name_((name == "") ? "sparql_index" : "sparql_index/" + name) - { - n_ = n; - } + SparqlIndexClient(const std::string& name) : name_((name == "") ? "sparql_index" : "sparql_index/" + name), + client(n_.serviceClient((name == "") ? "ontologenius/sparql_index" : "ontologenius/sparql_index/" + name, true)) + + {} std::pair, std::vector> call(const std::string& query); private: - ros::ServiceClient client; + ros::NodeHandle n_; std::string name_; - ros::NodeHandle* n_; + ros::ServiceClient client; }; } // namespace onto diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h index 48455d87..c31d4253 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h @@ -15,9 +15,8 @@ class ClassIndexClient : public OntologyIndexClient public: /// @brief Constructs a class client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ClassIndexClient(ros::NodeHandle* n, const std::string& name) : OntologyIndexClient(n, (name == "") ? "class_index" : "class_index/" + name) + ClassIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "class_index" : "class_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h index c67f2e48..c40c4603 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h @@ -15,9 +15,8 @@ class DataPropertyIndexClient : public OntologyIndexClient public: /// @brief Constructs a data property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - DataPropertyIndexClient(ros::NodeHandle* n, const std::string& name) : OntologyIndexClient(n, (name == "") ? "data_property_index" : "data_property_index/" + name) + DataPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "data_property_index" : "data_property_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h index 1dfd4610..73fb0682 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h @@ -15,9 +15,8 @@ class IndividualIndexClient : public OntologyIndexClient public: /// @brief Constructs an individual client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - IndividualIndexClient(ros::NodeHandle* n, const std::string& name) : OntologyIndexClient(n, (name == "")? "individual_index" : "individual_index/" + name) + IndividualIndexClient(const std::string& name) : OntologyIndexClient((name == "")? "individual_index" : "individual_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h index a12435a0..1092518f 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h @@ -15,9 +15,8 @@ class ObjectPropertyIndexClient : public OntologyIndexClient public: /// @brief Constructs an object property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ObjectPropertyIndexClient(ros::NodeHandle* n, const std::string& name) : OntologyIndexClient(n, (name == "") ? "object_property_index" : "object_property_index/" + name) + ObjectPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "object_property_index" : "object_property_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h index 8924e99d..7ebe176a 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h @@ -15,9 +15,8 @@ class OntologyIndexClient : public ClientBaseIndex public: /// @brief Constructs an ontology client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. - /// @param n is an initialized ROS node handle. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - OntologyIndexClient(ros::NodeHandle* n, const std::string& name) : ClientBaseIndex(n, name) + OntologyIndexClient(const std::string& name) : ClientBaseIndex(name) { } diff --git a/src/API/ontologenius/ConversionClient.cpp b/src/API/ontologenius/ConversionClient.cpp index d88c44f5..bf3a2e97 100644 --- a/src/API/ontologenius/ConversionClient.cpp +++ b/src/API/ontologenius/ConversionClient.cpp @@ -15,9 +15,9 @@ namespace onto { -ConversionClient::ConversionClient(ros::NodeHandle* n, const std::string& name) : name_((name == "") ? "/ontologenius/conversion" : "/ontologenius/conversion/" + name), - n_(n), verbose_(false), - client_(n->serviceClient(name_, true)) +ConversionClient::ConversionClient(const std::string& name) : name_((name == "") ? "/ontologenius/conversion" : "/ontologenius/conversion/" + name), + verbose_(false), + client_(n_.serviceClient(name_, true)) {} std::vector ConversionClient::individualsIndex2Id(const std::vector& indexes) @@ -172,7 +172,7 @@ bool ConversionClient::call(ontologenius::OntologeniusConversion& srv) { if(verbose_) std::cout << COLOR_ORANGE << "Failure to call " << name_ << COLOR_OFF << std::endl; - client_ = n_->serviceClient(name_, true); + client_ = n_.serviceClient(name_, true); if(client_.call(srv)) { if(verbose_) diff --git a/src/API/ontologenius/OntologiesManipulator.cpp b/src/API/ontologenius/OntologiesManipulator.cpp index e446147b..013d11be 100644 --- a/src/API/ontologenius/OntologiesManipulator.cpp +++ b/src/API/ontologenius/OntologiesManipulator.cpp @@ -2,11 +2,14 @@ namespace onto { -OntologiesManipulator::OntologiesManipulator(ros::NodeHandle* n) : ManagerClient(n) +OntologiesManipulator::OntologiesManipulator(ros::NodeHandle* n) : ManagerClient() { - n_ = n; + (void)n; } +OntologiesManipulator::OntologiesManipulator() : ManagerClient() +{} + OntologiesManipulator::~OntologiesManipulator() { for(auto& manipulator : manipulators_) diff --git a/src/API/ontologenius/OntologyManipulator.cpp b/src/API/ontologenius/OntologyManipulator.cpp index 539dcc24..f3a2da88 100644 --- a/src/API/ontologenius/OntologyManipulator.cpp +++ b/src/API/ontologenius/OntologyManipulator.cpp @@ -4,14 +4,14 @@ namespace onto { OntologyManipulator::OntologyManipulator(ros::NodeHandle* n, const std::string& name) : name_(name), - individuals(&n_, name), - objectProperties(&n_, name), - dataProperties(&n_, name), - classes(&n_, name), - actions(&n_, name), - reasoners(&n_, name), - feeder(&n_, name), - sparql(&n_, name) + individuals(name), + objectProperties(name), + dataProperties(name), + classes(name), + actions(name), + reasoners(name), + feeder(name), + sparql(name) { (void)n; ontologenius::Display::warning("OntologyManipulator(ros::NodeHandle* n, const std::string& name) is deprecated. Use OntologyManipulator(const std::string& name) instead."); @@ -21,42 +21,42 @@ OntologyManipulator::OntologyManipulator(ros::NodeHandle* n, const std::string& } OntologyManipulator::OntologyManipulator(const std::string& name) : name_(name), - individuals(&n_, name), - objectProperties(&n_, name), - dataProperties(&n_, name), - classes(&n_, name), - actions(&n_, name), - reasoners(&n_, name), - feeder(&n_, name), - sparql(&n_, name) + individuals(name), + objectProperties(name), + dataProperties(name), + classes(name), + actions(name), + reasoners(name), + feeder(name), + sparql(name) { std::string service_name = (name == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name; ros::service::waitForService(service_name); } OntologyManipulator::OntologyManipulator(const OntologyManipulator& other): name_(other.name_), - individuals(&n_, other.name_), - objectProperties(&n_, other.name_), - dataProperties(&n_, other.name_), - classes(&n_, other.name_), - actions(&n_, other.name_), - reasoners(&n_, other.name_), - feeder(&n_, other.name_), - sparql(&n_, other.name_) + individuals(other.name_), + objectProperties(other.name_), + dataProperties(other.name_), + classes(other.name_), + actions(other.name_), + reasoners(other.name_), + feeder(other.name_), + sparql(other.name_) { std::string service_name = (name_ == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name_; ros::service::waitForService(service_name); } OntologyManipulator::OntologyManipulator(OntologyManipulator&& other): name_(other.name_), - individuals(&n_, other.name_), - objectProperties(&n_, other.name_), - dataProperties(&n_, other.name_), - classes(&n_, other.name_), - actions(&n_, other.name_), - reasoners(&n_, other.name_), - feeder(&n_, other.name_), - sparql(&n_, other.name_) + individuals(other.name_), + objectProperties(other.name_), + dataProperties(other.name_), + classes(other.name_), + actions(other.name_), + reasoners(other.name_), + feeder(other.name_), + sparql(other.name_) { std::string service_name = (name_ == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name_; ros::service::waitForService(service_name); diff --git a/src/API/ontologenius/OntologyManipulatorIndex.cpp b/src/API/ontologenius/OntologyManipulatorIndex.cpp index c279d1ff..d89c3962 100644 --- a/src/API/ontologenius/OntologyManipulatorIndex.cpp +++ b/src/API/ontologenius/OntologyManipulatorIndex.cpp @@ -4,45 +4,45 @@ namespace onto { OntologyManipulatorIndex::OntologyManipulatorIndex(const std::string& name) : name_(name), - individuals(&n_, name), - objectProperties(&n_, name), - dataProperties(&n_, name), - classes(&n_, name), - actions(&n_, name), - reasoners(&n_, name), - feeder(&n_, name), - sparql(&n_, name), - conversion(&n_, name) + individuals(name), + objectProperties(name), + dataProperties(name), + classes(name), + actions(name), + reasoners(name), + feeder(name), + sparql(name), + conversion(name) { std::string service_name = (name == "") ? "ontologenius/conversion" : "ontologenius/conversion/" + name; ros::service::waitForService(service_name); } OntologyManipulatorIndex::OntologyManipulatorIndex(const OntologyManipulatorIndex& other): name_(other.name_), - individuals(&n_, other.name_), - objectProperties(&n_, other.name_), - dataProperties(&n_, other.name_), - classes(&n_, other.name_), - actions(&n_, other.name_), - reasoners(&n_, other.name_), - feeder(&n_, other.name_), - sparql(&n_, other.name_), - conversion(&n_, other.name_) + individuals(other.name_), + objectProperties(other.name_), + dataProperties(other.name_), + classes(other.name_), + actions(other.name_), + reasoners(other.name_), + feeder(other.name_), + sparql(other.name_), + conversion(other.name_) { std::string service_name = (name_ == "") ? "ontologenius/conversion" : "ontologenius/conversion/" + name_; ros::service::waitForService(service_name); } OntologyManipulatorIndex::OntologyManipulatorIndex(OntologyManipulatorIndex&& other): name_(other.name_), - individuals(&n_, other.name_), - objectProperties(&n_, other.name_), - dataProperties(&n_, other.name_), - classes(&n_, other.name_), - actions(&n_, other.name_), - reasoners(&n_, other.name_), - feeder(&n_, other.name_), - sparql(&n_, other.name_), - conversion(&n_, other.name_) + individuals(other.name_), + objectProperties(other.name_), + dataProperties(other.name_), + classes(other.name_), + actions(other.name_), + reasoners(other.name_), + feeder(other.name_), + sparql(other.name_), + conversion(other.name_) { std::string service_name = (name_ == "") ? "ontologenius/conversion" : "ontologenius/conversion/" + name_; ros::service::waitForService(service_name); diff --git a/src/API/ontologenius/clients/SparqlClient.cpp b/src/API/ontologenius/clients/SparqlClient.cpp index 9e7cf5ab..ea280b65 100644 --- a/src/API/ontologenius/clients/SparqlClient.cpp +++ b/src/API/ontologenius/clients/SparqlClient.cpp @@ -11,7 +11,7 @@ std::pair, std::vectorserviceClient("ontologenius/" + name_, true); + client = n_.serviceClient("ontologenius/" + name_, true); if(client.call(srv)) return {srv.response.names, srv.response.results}; else diff --git a/src/API/ontologenius/clientsIndex/SparqlIndexClient.cpp b/src/API/ontologenius/clientsIndex/SparqlIndexClient.cpp index 64ada339..2bc18996 100644 --- a/src/API/ontologenius/clientsIndex/SparqlIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/SparqlIndexClient.cpp @@ -11,7 +11,7 @@ std::pair, std::vectorserviceClient("ontologenius/" + name_, true); + client = n_.serviceClient("ontologenius/" + name_, true); if(client.call(srv)) return {srv.response.names, srv.response.results}; else From 0f0b6c6d48ab15a699ea027f9fd7c3d7c1b8c9f0 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 16:27:25 +0100 Subject: [PATCH 21/37] [Doc] upadte cpp API doc without NodeHandles --- docs/cpp_API/ActionClient.html | 6 +++--- docs/cpp_API/ClassClient.html | 6 +++--- docs/cpp_API/ClassIndexClient.html | 6 +++--- docs/cpp_API/ClientBase.html | 6 +++--- docs/cpp_API/ClientBaseIndex.html | 6 +++--- docs/cpp_API/ConversionClient.html | 6 +++--- docs/cpp_API/DataPropertyClient.html | 6 +++--- docs/cpp_API/DataPropertyIndexClient.html | 6 +++--- docs/cpp_API/FeederPublisher.html | 6 +++--- docs/cpp_API/IndividualClient.html | 6 +++--- docs/cpp_API/IndividualIndexClient.html | 6 +++--- docs/cpp_API/ManagerClient.html | 6 +++--- docs/cpp_API/ObjectPropertyClient.html | 6 +++--- docs/cpp_API/ObjectPropertyIndexClient.html | 6 +++--- docs/cpp_API/OntologiesManipulator.html | 7 +++---- docs/cpp_API/OntologyClient.html | 6 +++--- docs/cpp_API/OntologyIndexClient.html | 6 +++--- docs/cpp_API/ReasonerClient.html | 6 +++--- docs/cpp_API/SparqlClient.html | 4 ++-- docs/cpp_API/SparqlIndexClient.html | 4 ++-- 20 files changed, 58 insertions(+), 59 deletions(-) diff --git a/docs/cpp_API/ActionClient.html b/docs/cpp_API/ActionClient.html index 7dae5058..41151fb9 100644 --- a/docs/cpp_API/ActionClient.html +++ b/docs/cpp_API/ActionClient.html @@ -136,7 +136,7 @@

Public Functions

- + @@ -165,8 +165,8 @@

Detailed Description

Public Function Documentation

-

ActionClient::ActionClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an action client with a pointer to a NodeHandle n.

+

ActionClient::ActionClient(const std::string& name)

+

Constructs an action client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

bool ActionClient::close()

diff --git a/docs/cpp_API/ClassClient.html b/docs/cpp_API/ClassClient.html index 18216c3f..4384b850 100644 --- a/docs/cpp_API/ClassClient.html +++ b/docs/cpp_API/ClassClient.html @@ -136,7 +136,7 @@

Public Functions

ActionClient(ros::NodeHandle* n, const std::string& name)
ActionClient(rconst std::string& name)
bool close()
bool save(const std::string& path)
bool exportToXml(const std::string& path)
- + @@ -174,8 +174,8 @@

Detailed Description

Public Function Documentation

-

ClassClient::ClassClient(ros::NodeHandle* n, const std::string& name)

-

Constructs a class client with a pointer to a NodeHandle n.

+

ClassClient::ClassClient(const std::string& name)

+

Constructs a class client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<std::string> ClassClient::getDown(const std::string& name, int depth = -1, const std::string& selector = "")

diff --git a/docs/cpp_API/ClassIndexClient.html b/docs/cpp_API/ClassIndexClient.html index 72215220..163cb3c4 100644 --- a/docs/cpp_API/ClassIndexClient.html +++ b/docs/cpp_API/ClassIndexClient.html @@ -136,7 +136,7 @@

Public Functions

ClassClient(ros::NodeHandle* n, const std::string& name)
ClassClient(const std::string& name)
std::vector<std::string> getDown(const std::string& name, int depth = -1, const std::string& selector = "")
std::vector<std::string> getDisjoint(const std::string& name)
std::vector<std::string> getOn(const std::string& name, const std::string& property, const std::string& selector = "")
- + @@ -179,8 +179,8 @@

Detailed Description

Public Function Documentation

-

ClassIndexClient::ClassIndexClient(ros::NodeHandle* n, const string& name)

-

Constructs a class client with a pointer to a NodeHandle n.

+

ClassIndexClient::ClassIndexClient(const string& name)

+

Constructs a class client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<int64_t> ClassIndexClient::getDown(int64_t index, int depth = -1, int64_t selector = 0)

diff --git a/docs/cpp_API/ClientBase.html b/docs/cpp_API/ClientBase.html index 257a0788..04f7f22a 100644 --- a/docs/cpp_API/ClientBase.html +++ b/docs/cpp_API/ClientBase.html @@ -135,7 +135,7 @@

Public Functions

ClassIndexClient(ros::NodeHandle* n, const std::string& name)
ClassIndexClient(const std::string& name)
std::vector<int64_t> getDown(int64_t index, int depth = -1, int64_t selector = 0)
std::vector<int64_t> getDisjoint(int64_t index)
std::vector<int64_t> getOn(int64_t index, int64_t property, int64_t selector = 0)
- + @@ -165,8 +165,8 @@

Detailed Description

Public Function Documentation

-

ClientBase::ClientBase(ros::NodeHandle* n, const std::string& name)

-

Constructs a ROS client linked to the service name with a pointer to a NodeHandle n.

+

ClientBase::ClientBase(const std::string& name)

+

Constructs a ROS client linked to the service name.

size_t ClientBase::nb()

Gives the total number of service calls from all ClientBase instances since the last reset.

diff --git a/docs/cpp_API/ClientBaseIndex.html b/docs/cpp_API/ClientBaseIndex.html index e72ab4d8..98e8b300 100644 --- a/docs/cpp_API/ClientBaseIndex.html +++ b/docs/cpp_API/ClientBaseIndex.html @@ -135,7 +135,7 @@

Public Functions

ClientBase(ros::NodeHandle* n, std::string name)
ClientBase(std::string name)
size_t nb()
resetNb()
- + @@ -169,8 +169,8 @@

Detailed Description

Public Function Documentation

-

ClientBaseIndex::ClientBaseIndex(ros::NodeHandle* n, const std::string& name)

-

Constructs a ROS client linked to the service name with a pointer to a NodeHandle n.

+

ClientBaseIndex::ClientBaseIndex(const std::string& name)

+

Constructs a ROS client linked to the service name.

size_t ClientBaseIndex::nb()

Gives the total number of service calls from all ClientBaseIndex instances since the last reset.

diff --git a/docs/cpp_API/ConversionClient.html b/docs/cpp_API/ConversionClient.html index 5d668da3..c6bdb7ff 100644 --- a/docs/cpp_API/ConversionClient.html +++ b/docs/cpp_API/ConversionClient.html @@ -134,7 +134,7 @@

Public Functions

ClientBaseIndex(ros::NodeHandle* n, std::string name)
ClientBaseIndex(std::string name)
size_t nb()
resetNb()
- + @@ -171,8 +171,8 @@

Detailed Description

Public Function Documentation

-

ConversionClient::ConversionClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an conversion client with a pointer to a NodeHandle n.

+

ConversionClient::ConversionClient(const std::string& name)

+

Constructs an conversion client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

void ConversionClient::verbose(bool verbose)

diff --git a/docs/cpp_API/DataPropertyClient.html b/docs/cpp_API/DataPropertyClient.html index e795bb2b..0a671d8f 100644 --- a/docs/cpp_API/DataPropertyClient.html +++ b/docs/cpp_API/DataPropertyClient.html @@ -134,7 +134,7 @@

Public Functions

ConversionClient(ros::NodeHandle* n, const std::string& name)
ConversionClient(const std::string& name)
verbose(bool verbose)
std::vector<std::string> individualsIndex2Id(const std::vector<int64_t>& indexes)
std::vector<std::string> classesIndex2Id(const std::vector<int64_t>& indexes)
- + @@ -163,8 +163,8 @@

Detailed Description

Public Function Documentation

-

DataPropertyClient::DataPropertyClient(ros::NodeHandle* n, const std::string& name)

-

Constructs a data property client with a pointer to a NodeHandle n.

+

DataPropertyClient::DataPropertyClient(const std::string& name)

+

Constructs a data property client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<std::string> DataPropertyClient::getDown(const std::string& name, int depth = -1)

diff --git a/docs/cpp_API/DataPropertyIndexClient.html b/docs/cpp_API/DataPropertyIndexClient.html index 5168fdcb..534bb47a 100644 --- a/docs/cpp_API/DataPropertyIndexClient.html +++ b/docs/cpp_API/DataPropertyIndexClient.html @@ -134,7 +134,7 @@

Public Functions

DataPropertyClient(ros::NodeHandle* n, const std::string& name)
DataPropertyClient(const std::string& name)
std::vector<std::string> getDown(const std::string& name, int depth = -1)
std::vector<std::string> getDisjoint(const std::string& name)
std::vector<std::string> getDomain(const std::string& name)
- + @@ -168,8 +168,8 @@

Detailed Description

Public Function Documentation

-

DataPropertyIndexClient::DataPropertyIndexClient(ros::NodeHandle* n, const std::string& name)

-

Constructs a data property client with a pointer to a NodeHandle n.

+

DataPropertyIndexClient::DataPropertyIndexClient(const std::string& name)

+

Constructs a data property client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<int64_t> DataPropertyIndexClient::getDown(int64_t index, int depth = -1)

diff --git a/docs/cpp_API/FeederPublisher.html b/docs/cpp_API/FeederPublisher.html index 6a1f1de2..5779bee5 100644 --- a/docs/cpp_API/FeederPublisher.html +++ b/docs/cpp_API/FeederPublisher.html @@ -134,7 +134,7 @@

Public Functions

DataPropertyIndexClient(ros::NodeHandle* n, const std::string& name)
DataPropertyIndexClient(const std::string& name)
std::vector<int64_t> getDown(int64_t index, int depth = -1)
std::vector<int64_t> getDisjoint(int64_t index)
std::vector<int64_t> getDomain(int64_t index)
- + @@ -172,8 +172,8 @@

Detailed Description

Public Function Documentation

-

FeederPublisher::FeederPublisher(ros::NodeHandle* n, const std::string& name)

-

Constructs a FeederPublisher with a pointer to a NodeHandle n.

+

FeederPublisher::FeederPublisher(const std::string& name)

+

Constructs a FeederPublisher.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

FeederPublisher::addProperty(const std::string& from, const std::string& property, const std::string& on, const ros::Time& stamp = ros::Time::now())

diff --git a/docs/cpp_API/IndividualClient.html b/docs/cpp_API/IndividualClient.html index e8b60f0d..ada67a9c 100644 --- a/docs/cpp_API/IndividualClient.html +++ b/docs/cpp_API/IndividualClient.html @@ -135,7 +135,7 @@

Public Functions

FeederPublisher(ros::NodeHandle* n, const std::string& name)
FeederPublisher(const std::string& name)
addProperty(const std::string& from, const std::string& property, const std::string& on, const ros::Time& stamp = ros::Time::now())
addProperty(const std::string& from, const std::string& property, const std::string& type, const std::string& value, const ros::Time& stamp = ros::Time::now())
addInheritage(const std::string& from, const std::string& on, const ros::Time& stamp = ros::Time::now())
- + @@ -174,8 +174,8 @@

Detailed Description

Public Function Documentation

-

IndividualClient::IndividualClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an individual client with a pointer to a NodeHandle n.

+

IndividualClient::IndividualClient(const std::string& name)

+

Constructs an individual client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<std::string> IndividualClient::getType(const std::string& name)

diff --git a/docs/cpp_API/IndividualIndexClient.html b/docs/cpp_API/IndividualIndexClient.html index 2bda52bb..96e3fc75 100644 --- a/docs/cpp_API/IndividualIndexClient.html +++ b/docs/cpp_API/IndividualIndexClient.html @@ -135,7 +135,7 @@

Public Functions

IndividualClient(ros::NodeHandle* n, const std::string& name)
IndividualClient(const std::string& name)
std::vector<std::string> getType(const std::string& name)
std::vector<std::string> getSame(const std::string& name)
std::vector<std::string> getDistincts(const std::string& name)
- + @@ -178,8 +178,8 @@

Detailed Description

Public Function Documentation

-

IndividualIndexClient::IndividualIndexClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an individual client with a pointer to a NodeHandle n.

+

IndividualIndexClient::IndividualIndexClient(const std::string& name)

+

Constructs an individual client with.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<int64_t> IndividualIndexClient::getType(int64_t index)

diff --git a/docs/cpp_API/ManagerClient.html b/docs/cpp_API/ManagerClient.html index ac38bd3c..b677b1e7 100644 --- a/docs/cpp_API/ManagerClient.html +++ b/docs/cpp_API/ManagerClient.html @@ -138,7 +138,7 @@

Public Functions

IndividualIndexClient(ros::NodeHandle* n, const std::string& name)
IndividualIndexClient(const std::string& name)
std::vector<int64_t> getType(int64_t index)
std::vector<int64_t> getSame(int64_t index)
std::vector<int64_t> getDistincts(int64_t index)
- + @@ -165,8 +165,8 @@

Detailed Description

Public Function Documentation

-

ManagerClient::ManagerClient(ros::NodeHandle* n)

-

Constructs a manager client with a pointer to a NodeHandle n.

+

ManagerClient::ManagerClient()

+

Constructs a manager client.

Can only be used in a multi-ontology mode.

std::vector<std::string> ManagerClient::list()

diff --git a/docs/cpp_API/ObjectPropertyClient.html b/docs/cpp_API/ObjectPropertyClient.html index e2bb84bd..85e4e023 100644 --- a/docs/cpp_API/ObjectPropertyClient.html +++ b/docs/cpp_API/ObjectPropertyClient.html @@ -136,7 +136,7 @@

Public Functions

ManagerClient(ros::NodeHandle* n)
ManagerClient()
std::vector<std::string> list()
bool add(const std::string& name)
bool copy(const std::string& dest_name, const std::string& src_name)
- + @@ -166,8 +166,8 @@

Detailed Description

Public Function Documentation

-

ObjectPropertyClient::ObjectPropertyClient(ros::NodeHandle* n, const std::string& name)

-

Constructs am object property client with a pointer to a NodeHandle n.

+

ObjectPropertyClient::ObjectPropertyClient(const std::string& name)

+

Constructs am object property client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<std::string> ObjectPropertyClient::getDown(const std::string& name, int depth = -1)

diff --git a/docs/cpp_API/ObjectPropertyIndexClient.html b/docs/cpp_API/ObjectPropertyIndexClient.html index a5da51f4..e15bdb28 100644 --- a/docs/cpp_API/ObjectPropertyIndexClient.html +++ b/docs/cpp_API/ObjectPropertyIndexClient.html @@ -136,7 +136,7 @@

Public Functions

ObjectPropertyClient(ros::NodeHandle* n, const std::string& name)
ObjectPropertyClient(const std::string& name)
std::vector<std::string> getDown(const std::string& name, int depth = -1)
std::vector<std::string> getDisjoint(const std::string& name)
std::vector<std::string> getDomain(const std::string& name)
- + @@ -170,8 +170,8 @@

Detailed Description

Public Function Documentation

-

ObjectPropertyIndexClient::ObjectPropertyIndexClient(ros::NodeHandle* n, const std::string& name)

-

Constructs am object property client with a pointer to a NodeHandle n.

+

ObjectPropertyIndexClient::ObjectPropertyIndexClient(const std::string& name)

+

Constructs am object property client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<int64_t> ObjectPropertyIndexClient::getDown(int64_t index, int depth = -1)

diff --git a/docs/cpp_API/OntologiesManipulator.html b/docs/cpp_API/OntologiesManipulator.html index 47c98ed2..bc59ee1b 100644 --- a/docs/cpp_API/OntologiesManipulator.html +++ b/docs/cpp_API/OntologiesManipulator.html @@ -136,7 +136,7 @@

Public Functions

ObjectPropertyIndexClient(ros::NodeHandle* n, const std::string& name)
ObjectPropertyIndexClient(const std::string& name)
std::vector<int64_t> getDown(int64_t index, int depth = -1)
std::vector<int64_t> getDisjoint(int64_t; index)
std::vector<int64_t> getDomain(int64_t index)
- + @@ -171,9 +171,8 @@

Detailed Description

Public Function Documentation

-

OntologiesManipulator::OntologiesManipulator(ros::NodeHandle* n)

-

Constructs a manipulator for several instance of ontologies with a pointer to a NodeHandle n. - This pointer is necessary to create the ros services in the constructor.

+

OntologiesManipulator::OntologiesManipulator()

+

Constructs a manipulator for several instance of ontologies.

OntologiesManipulator::waitInit(int32_t timeout = -1)

Wait for ontologenius services to be advertised and available for. Blocks until it is.

diff --git a/docs/cpp_API/OntologyClient.html b/docs/cpp_API/OntologyClient.html index f9e39f39..90b63f38 100644 --- a/docs/cpp_API/OntologyClient.html +++ b/docs/cpp_API/OntologyClient.html @@ -137,7 +137,7 @@

Public Functions

OntologiesManipulator(ros::NodeHandle* n)
OntologiesManipulator()
waitInit(int32_t timeout = -1)
OntologyManipulator* operator[](const std::string& name)
OntologyManipulator* get(const std::string& name)
- + @@ -171,8 +171,8 @@

Detailed Description

Public Function Documentation

-

OntologyClient::OntologyClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an ontology client linked to the service ontologenius/name with a pointer to a NodeHandle n.

+

OntologyClient::OntologyClient(const std::string& name)

+

Constructs an ontology client linked to the service ontologenius/name.

std::vector<std::string> OntologyClient::getUp(const std::string& name, int depth = -1, const std::string& selector = "")

Gives all concepts below the one given in the parameter: name.

diff --git a/docs/cpp_API/OntologyIndexClient.html b/docs/cpp_API/OntologyIndexClient.html index 78ee0668..0a5b44aa 100644 --- a/docs/cpp_API/OntologyIndexClient.html +++ b/docs/cpp_API/OntologyIndexClient.html @@ -137,7 +137,7 @@

Public Functions

OntologyClient(ros::NodeHandle* n, const std::string& name)
OntologyClient(const std::string& name)
std::vector<std::string> getUp(const std::string& name, int depth = -1, const std::string& selector = "")
bool isA(const std::string& name, const std::string& base_class)
std::string getName(const std::string& name, bool take_id = true)
- + @@ -175,8 +175,8 @@

Detailed Description

Public Function Documentation

-

OntologyIndexClient::OntologyIndexClient(ros::NodeHandle* n, const std::string& name)

-

Constructs an ontology client linked to the service ontologenius/name with a pointer to a NodeHandle n.

+

OntologyIndexClient::OntologyIndexClient(const std::string& name)

+

Constructs an ontology client linked to the service ontologenius/name.

std::vector<int64_t> OntologyIndexClient::getUp(int64_t index, int depth = -1, int64_t selector = 0)

Gives all concepts below the one given in the parameter: index.

diff --git a/docs/cpp_API/ReasonerClient.html b/docs/cpp_API/ReasonerClient.html index b93d798f..b1659316 100644 --- a/docs/cpp_API/ReasonerClient.html +++ b/docs/cpp_API/ReasonerClient.html @@ -136,7 +136,7 @@

Public Functions

OntologyIndexClient(ros::NodeHandle* n, const std::string& name)
OntologyIndexClient(const std::string& name)
std::vector<int64_t> getUp(int64_t index, int depth = -1, int64_t selector = 0)
bool isA(int64_t index, int64_t base_class)
std::string getName(int64_t index, bool take_id = true)
- + @@ -163,8 +163,8 @@

Detailed Description

Public Function Documentation

-

ReasonerClient::ReasonerClient(ros::NodeHandle* n, const std::string& name)

-

Constructs a reasoner client with a pointer to a NodeHandle n.

+

ReasonerClient::ReasonerClient(const std::string& name)

+

Constructs a reasoner client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

std::vector<std::string> ReasonerClient::list()

diff --git a/docs/cpp_API/SparqlClient.html b/docs/cpp_API/SparqlClient.html index 6ace0dab..9f931d8d 100644 --- a/docs/cpp_API/SparqlClient.html +++ b/docs/cpp_API/SparqlClient.html @@ -134,7 +134,7 @@

Methods

ReasonerClient(ros::NodeHandle* n, const std::string& name)
ReasonerClient(const std::string& name)
std::vector<std::string> list()
std::vector<std::string> activeList()
bool activate(const std::string& name)
- +
SparqlClient(ros::NodeHandle* n, const std::string& name)
SparqlClient(const std::string& name)
std::pair<std::vector<std::string>, std::vector<OntologeniusSparqlResponse>> call(const std::string& query)
@@ -150,7 +150,7 @@

Detailed Description

Methods Documentation

-

SparqlClient(ros::NodeHandle* n, const std::string& name)

+

SparqlClient(const std::string& name)

Constructs a sparql client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

diff --git a/docs/cpp_API/SparqlIndexClient.html b/docs/cpp_API/SparqlIndexClient.html index a2dae137..d642bc91 100644 --- a/docs/cpp_API/SparqlIndexClient.html +++ b/docs/cpp_API/SparqlIndexClient.html @@ -134,7 +134,7 @@

Methods

- +
SparqlIndexClient(ros::NodeHandle* n, const std::string& name)
SparqlIndexClient(const std::string& name)
std::pair<std::vector<std::string>, std::vector<OntologeniusSparqlIndexResponse>> call(const std::string& query)
@@ -153,7 +153,7 @@

Detailed Description

Methods Documentation

-

SparqlIndexClient(ros::NodeHandle* n, const std::string& name)

+

SparqlIndexClient(const std::string& name)

Constructs a sparql client.

Can be used in a multi-ontology mode by specifying the name of the ontology name. For classic use, name should be defined as "".

From 2f18d2e53e109d1400437ebf37bd9ff08ff26c14 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 18:31:28 +0100 Subject: [PATCH 22/37] [OntologiesManipulator] waitInit returns a boolean --- include/ontologenius/API/ontologenius/OntologiesManipulator.h | 2 +- src/API/ontologenius/OntologiesManipulator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ontologenius/API/ontologenius/OntologiesManipulator.h b/include/ontologenius/API/ontologenius/OntologiesManipulator.h index 98b0998f..298799b2 100644 --- a/include/ontologenius/API/ontologenius/OntologiesManipulator.h +++ b/include/ontologenius/API/ontologenius/OntologiesManipulator.h @@ -23,7 +23,7 @@ class OntologiesManipulator : public ManagerClient /// @brief Wait for ontologenius services to be advertised and available for. Blocks until it is. /// @param timeout is the amount of time to wait for before timing out. If timeout is -1 (default), waits until the node is shutdown. - void waitInit(int32_t timeout = -1); + bool waitInit(int32_t timeout = -1); /// @brief Gets a pointer on the OntologyManipulator instance named name. /// @param name is the name of the instance to get. diff --git a/src/API/ontologenius/OntologiesManipulator.cpp b/src/API/ontologenius/OntologiesManipulator.cpp index 013d11be..0f9cad7f 100644 --- a/src/API/ontologenius/OntologiesManipulator.cpp +++ b/src/API/ontologenius/OntologiesManipulator.cpp @@ -21,9 +21,9 @@ OntologiesManipulator::~OntologiesManipulator() delete manipulator.second; } -void OntologiesManipulator::waitInit(int32_t timeout) +bool OntologiesManipulator::waitInit(int32_t timeout) { - ros::service::waitForService("ontologenius/manage", timeout); + return ros::service::waitForService("ontologenius/manage", timeout); } OntologyManipulator* OntologiesManipulator::operator[](const std::string& name) From a8dc50da147d221735e2ef39f0b7544ff8a2a3c2 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 18:32:01 +0100 Subject: [PATCH 23/37] [ClientBase] public call method with action and param --- include/ontologenius/API/ontologenius/clients/ClientBase.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/ontologenius/API/ontologenius/clients/ClientBase.h b/include/ontologenius/API/ontologenius/clients/ClientBase.h index 74015df6..69a50699 100644 --- a/include/ontologenius/API/ontologenius/clients/ClientBase.h +++ b/include/ontologenius/API/ontologenius/clients/ClientBase.h @@ -42,6 +42,13 @@ class ClientBase void resetNb() {cpt = 0;} static void verbose(bool verbose) { verbose_ = verbose; } + std::vector call(const std::string& action, const std::string& param) + { + ontologenius::OntologeniusService srv; + srv.request.action = action; + srv.request.param = param; + return call(srv); + } protected: /// @brief Calls the service set up in the constructor of ClientBase. From 6631ac2e8548e15c081100eb852f7db214786594 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 18:32:13 +0100 Subject: [PATCH 24/37] [ClientBase] getErrorCode --- .../API/ontologenius/clients/ClientBase.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/ontologenius/API/ontologenius/clients/ClientBase.h b/include/ontologenius/API/ontologenius/clients/ClientBase.h index 69a50699..b9affb69 100644 --- a/include/ontologenius/API/ontologenius/clients/ClientBase.h +++ b/include/ontologenius/API/ontologenius/clients/ClientBase.h @@ -49,6 +49,9 @@ class ClientBase srv.request.param = param; return call(srv); } + + int getErrorCode() { return error_code_; } + protected: /// @brief Calls the service set up in the constructor of ClientBase. @@ -60,7 +63,10 @@ class ClientBase cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return srv.response.values; + } else { if(verbose_) @@ -70,12 +76,14 @@ class ClientBase { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return srv.response.values; } else { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; res.push_back("ERR:SERVICE_FAIL"); return res; } @@ -92,6 +100,7 @@ class ClientBase if(client.call(srv)) { + error_code_ = srv.response.code; if(srv.response.values.size()) return srv.response.values[0]; else @@ -106,6 +115,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; if(srv.response.values.size()) return srv.response.values[0]; else @@ -115,6 +125,7 @@ class ClientBase { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; res = "ERR:SERVICE_FAIL"; return res; } @@ -129,7 +140,10 @@ class ClientBase cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return true; + } else { if(verbose_) @@ -139,12 +153,14 @@ class ClientBase { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return true; } else { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; return false; } } @@ -158,7 +174,10 @@ class ClientBase cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return (srv.response.code == 0); + } else { if(verbose_) @@ -168,12 +187,14 @@ class ClientBase { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return (srv.response.code == 0); } else { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; return false; } } @@ -184,6 +205,7 @@ class ClientBase ros::NodeHandle n_; static size_t cpt; static bool verbose_; + int error_code_; protected: ros::ServiceClient client; From 946f83a5b45fe89a9ef7fa69eadf214ddb852c32 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Sun, 3 Dec 2023 18:35:59 +0100 Subject: [PATCH 25/37] [OntoloGUI] use cpp API - miss feeder notifications --- CMakeLists.txt | 1 + .../graphical/ontoloGUI/ontologui.h | 13 +- src/graphical/ontoloGUI/main.cpp | 9 +- src/graphical/ontoloGUI/ontologui.cpp | 338 ++++++++---------- 4 files changed, 170 insertions(+), 191 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a0daed6..4d019dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,6 +415,7 @@ target_link_libraries(ontoloGUI Qt5::Core Qt5::Widgets Qt5::PrintSupport + ontologenius_lib ) install(TARGETS ontoloGUI RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) diff --git a/include/ontologenius/graphical/ontoloGUI/ontologui.h b/include/ontologenius/graphical/ontoloGUI/ontologui.h index 64757d0e..d37128be 100644 --- a/include/ontologenius/graphical/ontoloGUI/ontologui.h +++ b/include/ontologenius/graphical/ontoloGUI/ontologui.h @@ -5,6 +5,7 @@ #include "include/ontologenius/graphical/ontoloGUI/QCheckBoxExtended.h" #include +#include "ontologenius/OntologiesManipulator.h" #include #include #include @@ -23,17 +24,18 @@ class ontoloGUI : public QMainWindow explicit ontoloGUI(QWidget *parent = 0); ~ontoloGUI(); - void init(ros::NodeHandle* n); + void init(); void wait(); void start(); void loadReasoners(); private: Ui::ontoloGUI *ui; - ros::NodeHandle* n_; - std::map publishers_; - std::map feeder_notifications_subs_; + onto::OntologiesManipulator ontos_; + onto::OntologyManipulator* onto_; + bool multi_usage_; + std::string feeder_notifications_; std::vector reasoners_names_; @@ -85,7 +87,8 @@ public slots: void feederDelSlot(); void feederCommitSlot(); void feederCheckoutSlot(); - void createPublisher(const std::string& onto_ns); + + bool updateOntoPtr(); signals: void feederSetHtmlSignal(QString); diff --git a/src/graphical/ontoloGUI/main.cpp b/src/graphical/ontoloGUI/main.cpp index 36ce7710..20d1fb68 100644 --- a/src/graphical/ontoloGUI/main.cpp +++ b/src/graphical/ontoloGUI/main.cpp @@ -21,6 +21,8 @@ void spinThread(bool* run) int main(int argc, char *argv[]) { + ros::init(argc, argv, "ontoloGUI"); + QApplication a(argc, argv); a.setStyle(new DarkStyle); @@ -33,18 +35,15 @@ int main(int argc, char *argv[]) ontoloGUI w; w.show(); - ros::init(argc, argv, "ontoloGUI"); - - ros::NodeHandle n; bool run = true; - w.init(&n); + w.init(); w.wait(); w.start(); w.loadReasoners(); - std::thread spin_thread(spinThread,&run); + std::thread spin_thread(spinThread, &run); signal(SIGINT, SIG_DFL); auto a_exec = a.exec(); diff --git a/src/graphical/ontoloGUI/ontologui.cpp b/src/graphical/ontoloGUI/ontologui.cpp index 8b4e369a..c6a0cb45 100644 --- a/src/graphical/ontoloGUI/ontologui.cpp +++ b/src/graphical/ontoloGUI/ontologui.cpp @@ -251,11 +251,20 @@ ontoloGUI::~ontoloGUI() delete ui; } -void ontoloGUI::init(ros::NodeHandle* n) +void ontoloGUI::init() { - n_ = n; - publishers_["_"] = n_->advertise("ontologenius/insert", QUEU_SIZE); - feeder_notifications_subs_["_"] = n_->subscribe("ontologenius/feeder_notifications", QUEU_SIZE, &ontoloGUI::feederCallback, this); + if(ontos_.waitInit(1000) == false) + { + onto_ = new onto::OntologyManipulator(); + multi_usage_ = false; + } + else + { + onto_ == nullptr; + multi_usage_ = true; + } + + //feeder_notifications_subs_["_"] = n_->subscribe("ontologenius/feeder_notifications", QUEU_SIZE, &ontoloGUI::feederCallback, this); } void ontoloGUI::wait() @@ -332,23 +341,24 @@ void ontoloGUI::classClickedSlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/class" : "ontologenius/class/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + std::string action = dynamic_cast(sender())->text().toStdString(); + std::string param = ui->classParameter->text().toStdString(); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = dynamic_cast(sender())->text().toStdString(); - srv.request.param = ui->classParameter->text().toStdString(); QString text = dynamic_cast(sender())->text() + " : " + ui->classParameter->text(); ui->ClassDescription->setText(text); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + auto res_vect = onto_->classes.call(action, param); + int err = onto_->classes.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); - if(srv.response.code == 3) + std::string res_str = vector2string(res_vect); + ui->ResultArea->setText(QString::fromStdString(res_str)); + if(err == 3) displayUnClosed(); } } @@ -361,23 +371,24 @@ void ontoloGUI::objectPropertyClickedSlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/object_property" : "ontologenius/object_property/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + std::string action = dynamic_cast(sender())->text().toStdString(); + std::string param = ui->objectPropertyParameter->text().toStdString(); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = dynamic_cast(sender())->text().toStdString(); - srv.request.param = ui->objectPropertyParameter->text().toStdString(); QString text = dynamic_cast(sender())->text() + " : " + ui->objectPropertyParameter->text(); ui->ObjectPropertyDescription->setText(text); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + auto res_vect = onto_->objectProperties.call(action, param); + int err = onto_->objectProperties.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); - if(srv.response.code == 3) + std::string res_str = vector2string(res_vect); + ui->ResultArea->setText(QString::fromStdString(res_str)); + if(err == 3) displayUnClosed(); } } @@ -390,23 +401,24 @@ void ontoloGUI::dataPropertyClickedSlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/data_property" : "ontologenius/data_property/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + std::string action = dynamic_cast(sender())->text().toStdString(); + std::string param = ui->dataPropertyParameter->text().toStdString(); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = dynamic_cast(sender())->text().toStdString(); - srv.request.param = ui->dataPropertyParameter->text().toStdString(); QString text = dynamic_cast(sender())->text() + " : " + ui->dataPropertyParameter->text(); ui->DataPropertyDescription->setText(text); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + auto res_vect = onto_->dataProperties.call(action, param); + int err = onto_->dataProperties.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); - if(srv.response.code == 3) + std::string res_str = vector2string(res_vect); + ui->ResultArea->setText(QString::fromStdString(res_str)); + if(err == 3) displayUnClosed(); } } @@ -419,23 +431,24 @@ void ontoloGUI::individualClickedSlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/individual" : "ontologenius/individual/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); - - ontologenius::OntologeniusService srv; - srv.request.action = dynamic_cast(sender())->text().toStdString(); - srv.request.param = ui->individualParameter->text().toStdString(); + std::string action = dynamic_cast(sender())->text().toStdString(); + std::string param = ui->individualParameter->text().toStdString(); + if(updateOntoPtr() == false) + return; + QString text = dynamic_cast(sender())->text() + " : " + ui->individualParameter->text(); ui->IndividualDescription->setText(text); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + auto res_vect = onto_->individuals.call(action, param); + int err = onto_->individuals.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); - if(srv.response.code == 3) + std::string res_str = vector2string(res_vect); + ui->ResultArea->setText(QString::fromStdString(res_str)); + if(err == 3) displayUnClosed(); } } @@ -448,18 +461,16 @@ void ontoloGUI::closeOntologySlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/actions" : "ontologenius/actions/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); - - ontologenius::OntologeniusService srv; - srv.request.action = "close"; + if(updateOntoPtr() == false) + return; - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + onto_->close(); + int err = onto_->actions.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); + ui->ResultArea->setText(""); start(); } } @@ -477,23 +488,22 @@ void ontoloGUI::ReasonerClickedSlot(int) return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/reasoner" : "ontologenius/reasoner/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + std::string param = dynamic_cast(sender())->text().toStdString(); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; if(dynamic_cast(sender())->isChecked()) - srv.request.action = "activate"; + onto_->reasoners.activate(param); else - srv.request.action = "deactivate"; - srv.request.param = dynamic_cast(sender())->text().toStdString(); + onto_->reasoners.deactivate(param); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + int err = onto_->reasoners.getErrorCode(); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - std::string res = vector2string(srv.response.values); - ui->ResultArea->setText(QString::fromStdString(res)); + ui->ResultArea->setText(""); } } @@ -533,18 +543,18 @@ void ontoloGUI::loadReasoners() delete item; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/reasoner" : "ontologenius/reasoner/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = "list"; + auto res_vect = onto_->reasoners.list(); + int err = onto_->reasoners.getErrorCode(); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + if(err == -1) + displayErrorInfo("client call failed"); else { start(); - reasoners_names_ = srv.response.values; + reasoners_names_ = res_vect; ui->ResultArea->setText(""); constructReasonersCheckBoxs(); @@ -573,17 +583,16 @@ void ontoloGUI::updateReasonersCheckBoxs() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/reasoner" : "ontologenius/reasoner/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = "activeList"; + auto active_reasoners = onto_->reasoners.activeList(); + int err = onto_->reasoners.getErrorCode(); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + if(err == -1) + displayErrorInfo("client call failed"); else { - std::vector active_reasoners = srv.response.values; for(int i = 1; i < ui->ReasonerListLayout->count(); ++i) { QWidget* widget = ui->ReasonerListLayout->itemAt(i)->widget(); @@ -623,17 +632,16 @@ std::string ontoloGUI::getReasonerDescription(std::string box) return ""; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/reasoner" : "ontologenius/reasoner/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + if(updateOntoPtr() == false) + return ""; - ontologenius::OntologeniusService srv; - srv.request.action = "getDescription"; - srv.request.param = std::move(box); + auto description = onto_->reasoners.getDescription(box); + int err = onto_->reasoners.getErrorCode(); - if(!client.call(srv)) - displayErrorInfo(service_name + " client call failed"); + if(err == -1) + displayErrorInfo("client call failed"); else - return vector2string(srv.response.values); + return description; return ""; } @@ -650,13 +658,10 @@ void ontoloGUI::displayErrorInfo(const std::string& text) void ontoloGUI::displayOntologiesList() { - ros::ServiceClient client = n_->serviceClient("ontologenius/manage"); - - ontologenius::OntologeniusService srv; - srv.request.action = "list"; - + auto res_vect = ontos_.list(); + int err = ontos_.getErrorCode(); std::string html; - if(!client.call(srv)) + if(err == -1) { html = "" "" "

" + text + "

"; } - ui->OntologiesList->setHtml(QString::fromStdString(html)); } @@ -708,44 +712,28 @@ void ontoloGUI::currentTabChangedSlot(int index) void ontoloGUI::addOntologySlot() { - ros::ServiceClient client = n_->serviceClient("ontologenius/manage"); - - ontologenius::OntologeniusService srv; - srv.request.action = "add"; - srv.request.param = ui->OntologyNameAddDel->text().toStdString(); + std::string param = ui->OntologyNameAddDel->text().toStdString(); std::regex base_regex("(.*)=(.*)"); std::smatch base_match; - if (std::regex_match(srv.request.param, base_match, base_regex)) + if (std::regex_match(param, base_match, base_regex)) { if (base_match.size() == 3) - { - srv.request.action = "copy"; - if(publishers_.find(base_match[1].str()) == publishers_.end()) - publishers_[base_match[1].str()] = n_->advertise("ontologenius/insert/" + base_match[1].str(), QUEU_SIZE); - - if(feeder_notifications_subs_.find(base_match[1].str()) == feeder_notifications_subs_.end()) - feeder_notifications_subs_[base_match[1].str()] = n_->subscribe("ontologenius/feeder_notifications", QUEU_SIZE, &ontoloGUI::feederCallback, this); - } + ontos_.copy(base_match[1].str(), base_match[2].str()); } else - { - if(publishers_.find(srv.request.param) == publishers_.end()) - publishers_[srv.request.param] = n_->advertise("ontologenius/insert/" + srv.request.param, QUEU_SIZE); - - if(feeder_notifications_subs_.find(srv.request.param) == feeder_notifications_subs_.end()) - feeder_notifications_subs_[srv.request.param] = n_->subscribe("ontologenius/feeder_notifications", QUEU_SIZE, &ontoloGUI::feederCallback, this); - } + ontos_.add(param); - if(!client.call(srv)) + int err = ontos_.getErrorCode(); + if(err == -1) displayErrorInfo("ontologenius/manage client call failed"); else { start(); - if(srv.response.code == 4) - ui->ResultArea->setText(QString::fromStdString(srv.request.param + " already created")); - else if(srv.response.code == 1) - ui->ResultArea->setText(QString::fromStdString("fail to stop " + srv.request.param + " : please retry")); + if(err == 4) + ui->ResultArea->setText(QString::fromStdString(param + " already created")); + else if(err == 1) + ui->ResultArea->setText(QString::fromStdString("fail to stop " + param + " : please retry")); else ui->ResultArea->setText(QString::fromStdString("")); displayOntologiesList(); @@ -754,19 +742,17 @@ void ontoloGUI::addOntologySlot() void ontoloGUI::deleteOntologySlot() { - ros::ServiceClient client = n_->serviceClient("ontologenius/manage"); - - ontologenius::OntologeniusService srv; - srv.request.action = "delete"; - srv.request.param = ui->OntologyNameAddDel->text().toStdString(); + std::string param = ui->OntologyNameAddDel->text().toStdString(); + ontos_.del(param); + int err = ontos_.getErrorCode(); - if(!client.call(srv)) + if(err == -1) displayErrorInfo("ontologenius/manage client call failed"); else { start(); - if(srv.response.code == 4) - ui->ResultArea->setText(QString::fromStdString(srv.request.param + " don't exist")); + if(err == 4) + ui->ResultArea->setText(QString::fromStdString(param + " don't exist")); else ui->ResultArea->setText(QString::fromStdString("")); displayOntologiesList(); @@ -781,19 +767,19 @@ void ontoloGUI::saveOntologySlot() return; } - std::string service_name = (ui->OntologyName->text().toStdString() == "") ? "ontologenius/actions" : "ontologenius/actions/" + ui->OntologyName->text().toStdString(); - ros::ServiceClient client = n_->serviceClient(service_name); + if(updateOntoPtr() == false) + return; - ontologenius::OntologeniusService srv; - srv.request.action = "save"; - srv.request.param = ui->OntologSavePath->text().toStdString(); + std::string param = ui->OntologSavePath->text().toStdString(); + onto_->actions.save(param); + int err = onto_->actions.getErrorCode(); - if(!client.call(srv)) - displayErrorInfo("ontologenius/manage client call failed"); + if(err == -1) + displayErrorInfo("client call failed"); else { - if(srv.response.code == 4) - ui->ResultArea->setText(QString::fromStdString(srv.request.param + " don't exist")); + if(err == 4) + ui->ResultArea->setText(QString::fromStdString(param + " don't exist")); else ui->ResultArea->setText(QString::fromStdString("")); } @@ -801,28 +787,27 @@ void ontoloGUI::saveOntologySlot() void ontoloGUI::differenceOntologySlot() { - ros::ServiceClient client = n_->serviceClient("ontologenius/manage"); + std::string param1 = ui->OntologyDiffName1->text().toStdString(); + std::string param2 = ui->OntologyDiffName2->text().toStdString(); + std::string concept = ui->OntologyDiffConcept->text().toStdString(); - ontologenius::OntologeniusService srv; - srv.request.action = "difference"; - srv.request.param = ui->OntologyDiffName1->text().toStdString() + "|" + - ui->OntologyDiffName2->text().toStdString() + "|" + - ui->OntologyDiffConcept->text().toStdString(); + auto diff = ontos_.getDifference(param1, param2, concept); + int err = ontos_.getErrorCode(); - if(!client.call(srv)) + if(err == -1) displayErrorInfo("ontologenius/manage client call failed"); else { start(); - if(srv.response.code == 4) + if(err == 4) ui->ResultArea->setText("no effect"); - else if(srv.response.code == 0) + else if(err == 0) { - std::string res = vector2string(srv.response.values); + std::string res = vector2string(diff); ui->ResultArea->setText(QString::fromStdString(res)); } else - ui->ResultArea->setText(QString::fromStdString(std::to_string(srv.response.code))); + ui->ResultArea->setText(QString::fromStdString(std::to_string(err))); displayOntologiesList(); } } @@ -863,54 +848,45 @@ void ontoloGUI::feederCallback(const std_msgs::String& msg) void ontoloGUI::feederAddSlot() { - std_msgs::String msg; - msg.data = "[ADD]" + ui->FeederSubject->text().toStdString() + "|" + ui->FeederProperty->text().toStdString() + "|" + ui->FeederObject->text().toStdString(); - std::string onto_ns = ui->OntologyName->text().toStdString(); - if(onto_ns == "") - onto_ns = "_"; - createPublisher(onto_ns); - publishers_[onto_ns].publish(msg); + if(updateOntoPtr() == false) + return; + onto_->feeder.addProperty(ui->FeederSubject->text().toStdString(), ui->FeederProperty->text().toStdString(), ui->FeederObject->text().toStdString()); } void ontoloGUI::feederDelSlot() { - std_msgs::String msg; - msg.data = "[DEL]" + ui->FeederSubject->text().toStdString() + "|" + ui->FeederProperty->text().toStdString() + "|" + ui->FeederObject->text().toStdString(); - std::string onto_ns = ui->OntologyName->text().toStdString(); - if(onto_ns == "") - onto_ns = "_"; - createPublisher(onto_ns); - publishers_[onto_ns].publish(msg); + if(updateOntoPtr() == false) + return; + onto_->feeder.removeProperty(ui->FeederSubject->text().toStdString(), ui->FeederProperty->text().toStdString(), ui->FeederObject->text().toStdString()); } void ontoloGUI::feederCommitSlot() { - std_msgs::String msg; - msg.data = "[commit]" + ui->FeederCommitName->text().toStdString() + "|"; - std::string onto_ns = ui->OntologyName->text().toStdString(); - if(onto_ns == "") - onto_ns = "_"; - createPublisher(onto_ns); - publishers_[onto_ns].publish(msg); + if(updateOntoPtr() == false) + return; + onto_->feeder.commit(ui->FeederCommitName->text().toStdString()); } void ontoloGUI::feederCheckoutSlot() { - std_msgs::String msg; - msg.data = "[checkout]" + ui->FeederCommitName->text().toStdString() + "|"; - std::string onto_ns = ui->OntologyName->text().toStdString(); - if(onto_ns == "") - onto_ns = "_"; - createPublisher(onto_ns); - publishers_[onto_ns].publish(msg); + if(updateOntoPtr() == false) + return; + onto_->feeder.checkout(ui->FeederCommitName->text().toStdString()); } -void ontoloGUI::createPublisher(const std::string& onto_ns) +bool ontoloGUI::updateOntoPtr() { - if(publishers_.find(onto_ns) == publishers_.end()) + if(multi_usage_ == false) + return true; + + std::string instance_name = ui->OntologyName->text().toStdString(); + onto_ = ontos_.get(instance_name); + if(onto_ == nullptr) { - publishers_[onto_ns] = n_->advertise("ontologenius/insert/" + onto_ns, QUEU_SIZE); - while(ros::ok() && (publishers_[onto_ns].getNumSubscribers() == 0)) - ros::spinOnce(); + if(instance_name != "") + displayErrorInfo("Ontology " + instance_name + " does not exist"); + return false; } + else + return true; } From 2b6364049b454d01ab6fc9910978051b6e94b070 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Mon, 4 Dec 2023 13:17:41 +0100 Subject: [PATCH 26/37] [CI] remove melodic from gitlab CI --- .gitlab-ci.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bfce1f14..4162e62d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,20 +8,6 @@ - cd .. - catkin_make -DCMAKE_BUILD_TYPE=Release -.test_script_template : &test_script_definition_py2 - script: - - mkdir -p ~/ros_ws/src - - cd ~/ros_ws - - catkin_make -DCMAKE_BUILD_TYPE=Release - - cd src - - cp -r /builds/$GITLAB_USER_LOGIN/ontologenius . - - cd .. - - pip install requests --user - - source devel/setup.bash - - catkin_make -DCMAKE_BUILD_TYPE=Release - - source devel/setup.bash - - catkin_make run_tests_ontologenius_rostest -j1 -DCMAKE_BUILD_TYPE=Release && catkin_make test -j1 -DCMAKE_BUILD_TYPE=Release - .test_script_template : &test_script_definition_py3 script: - mkdir -p ~/ros_ws/src @@ -36,11 +22,6 @@ - source devel/setup.bash - catkin_make run_tests_ontologenius_rostest -j1 -DCMAKE_BUILD_TYPE=Release && catkin_make test -j1 -DCMAKE_BUILD_TYPE=Release -.melodic_before_template : &melodic_before_definition - before_script: - - source /opt/ros/melodic/setup.bash - - apt-get update -qq && apt-get install -y libcppunit-1.14-0 libcppunit-dev libtinyxml-dev python-rosdep python-pip libcurl4-openssl-dev - .noetic_before_template : &noetic_before_definition before_script: - source /opt/ros/noetic/setup.bash @@ -50,18 +31,6 @@ stages: - build - test -run-test-melodic: - stage: test - image: ros:melodic-perception-bionic - <<: *melodic_before_definition - <<: *test_script_definition_py2 - -run-build-melodic: - image: ros:melodic-perception-bionic - stage: build - <<: *melodic_before_definition - <<: *build_script_definition - run-test-noetic: stage: test image: ros:noetic-perception-focal From f6e5b9c808aaa4e2e706975009356b151912e985 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Wed, 6 Dec 2023 11:37:09 +0100 Subject: [PATCH 27/37] [Doc] remove request installation --- docs/InstallOntologenius.html | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/docs/InstallOntologenius.html b/docs/InstallOntologenius.html index 5766d176..b689916c 100644 --- a/docs/InstallOntologenius.html +++ b/docs/InstallOntologenius.html @@ -94,31 +94,13 @@

Install Ontologenius

-

Since Ontologenius is a ROS package, make sure that ROS is installed on your platform. Ontologenius is fully supported and maintained on ROS Melodic Morenia and ROS Noetic Ninjemys. Desktop ROS configuration is not required for use of ontologenius.

+

Since Ontologenius is a ROS package, make sure that ROS is installed on your platform. Ontologenius is fully supported and maintained on ROS Noetic Ninjemys. Desktop ROS configuration is not required for use of ontologenius.

Clone the package on your catkin workspace:

cd ~/catkin_ws/src/

git clone https://github.com/sarthou/ontologenius.git

cd ..

catkin_make

-

If you want to load ontologies from the internet, you will need the requests package. Ontologenius uses it to make HTTP requests.

-

This installation is optional

- -

You can install it through pip:

-
-

pip install requests --user

-
- -

You can also install it from the source in the catkin_ws:

-
-

git clone https://github.com/kennethreitz/requests.git

export PYTHONPATH=~/catkin_ws/devel/lib/python2.7/site-packages:$PYTHONPATH

cd requests

python setup.py install --prefix=~/catkin_ws/devel

-
- -

you might have to create ~/catkin_ws/devel/lib/python2.7/site-packages

-
-

mkdir ~/catkin_ws/devel/lib/python2.7/site-packages

-
-

Troubles

If you have the following error :

From 0c1e22e05c43391f62c6d1f1296f5e52d7eee588 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Wed, 6 Dec 2023 13:59:48 +0100 Subject: [PATCH 28/37] [FeederPublisher] add notification callback --- .../API/ontologenius/FeederPublisher.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/ontologenius/API/ontologenius/FeederPublisher.h b/include/ontologenius/API/ontologenius/FeederPublisher.h index a0954e72..fda87c8b 100644 --- a/include/ontologenius/API/ontologenius/FeederPublisher.h +++ b/include/ontologenius/API/ontologenius/FeederPublisher.h @@ -22,14 +22,17 @@ class FeederPublisher /// @brief Constructs a FeederPublisher. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - FeederPublisher(const std::string& name) : + explicit FeederPublisher(const std::string& name) : name_(name), + notification_callback_([](auto& msg){ (void) msg; }), pub_(n_.advertise((name == "") ? "ontologenius/insert" : "ontologenius/insert/" + name, 1000)), stamped_pub_(n_.advertise((name == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + name, 1000)) { + srand (time(NULL)); commit_nb_ = rand() % 100000 + 1; commit_sub_ = n_.subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); + notif_sub_ = n_.subscribe(name_ == "" ? "ontologenius/feeder_notifications" : "ontologenius/feeder_notifications/" + name_, 1000, &FeederPublisher::notificationCallback, this); updated_ = false; } @@ -39,6 +42,7 @@ class FeederPublisher stamped_pub_(n_.advertise((other.name_ == "") ? "ontologenius/insert_stamped" : "ontologenius/insert_stamped/" + other.name_, 1000)) { commit_sub_ = n_.subscribe(name_ == "" ? "ontologenius/end" : "ontologenius/end/" + name_, 1000, &FeederPublisher::commitCallback, this); + notif_sub_ = n_.subscribe(name_ == "" ? "ontologenius/feeder_notifications" : "ontologenius/feeder_notifications/" + name_, 1000, &FeederPublisher::notificationCallback, this); commit_nb_ = other.commit_nb_; updated_ = false; } @@ -171,21 +175,29 @@ class FeederPublisher /// @return Returns false if the function returns on a timeout. bool checkout(const std::string& commit_name, int32_t timeout = -1); + /// @brief Register a callback function to get notifications from the feeder. + /// @param callback is the callback function taking a string. + void registerNotificationCallback(const std::function& callback) { notification_callback_ = callback; } + private: ros::NodeHandle n_; std::string name_; + std::function notification_callback_; + ros::Publisher pub_; ros::Publisher stamped_pub_; ros::Subscriber commit_sub_; + ros::Subscriber notif_sub_; std::atomic updated_; size_t commit_nb_; void sendNop(); -public: + void publish(const std::string& str); void publishStamped(const std::string& str, const ros::Time& stamp); void commitCallback(const std_msgs::String::ConstPtr& msg); + void notificationCallback(const std_msgs::String::ConstPtr& msg) { notification_callback_(msg->data); } }; } // namespace onto From 9ccac5dcad84ab8c8c89dfd8725d9113471b803d Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Wed, 6 Dec 2023 14:01:21 +0100 Subject: [PATCH 29/37] [ontoloGUI] use feeder callback for notifications --- .../ontologenius/graphical/ontoloGUI/ontologui.h | 2 +- src/graphical/ontoloGUI/ontologui.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/ontologenius/graphical/ontoloGUI/ontologui.h b/include/ontologenius/graphical/ontoloGUI/ontologui.h index d37128be..466b385d 100644 --- a/include/ontologenius/graphical/ontoloGUI/ontologui.h +++ b/include/ontologenius/graphical/ontoloGUI/ontologui.h @@ -82,7 +82,7 @@ public slots: void OntologyNameAddDelChangedSlot(const QString&); void OntologyNameChangedSlot(const QString&); - void feederCallback(const std_msgs::String& msg); + void feederCallback(const std::string& msg); void feederAddSlot(); void feederDelSlot(); void feederCommitSlot(); diff --git a/src/graphical/ontoloGUI/ontologui.cpp b/src/graphical/ontoloGUI/ontologui.cpp index c6a0cb45..c8937fe5 100644 --- a/src/graphical/ontoloGUI/ontologui.cpp +++ b/src/graphical/ontoloGUI/ontologui.cpp @@ -256,6 +256,7 @@ void ontoloGUI::init() if(ontos_.waitInit(1000) == false) { onto_ = new onto::OntologyManipulator(); + onto_->feeder.registerNotificationCallback([this](auto msg){ this->feederCallback(msg); }); multi_usage_ = false; } else @@ -263,8 +264,6 @@ void ontoloGUI::init() onto_ == nullptr; multi_usage_ = true; } - - //feeder_notifications_subs_["_"] = n_->subscribe("ontologenius/feeder_notifications", QUEU_SIZE, &ontoloGUI::feederCallback, this); } void ontoloGUI::wait() @@ -275,7 +274,6 @@ void ontoloGUI::wait() "" "

Wainting for ontologenius

"; ui->InfoArea->setHtml(html); - //ros::service::waitForService("ontologenius/reasoner", -1); } void ontoloGUI::start() @@ -713,13 +711,17 @@ void ontoloGUI::currentTabChangedSlot(int index) void ontoloGUI::addOntologySlot() { std::string param = ui->OntologyNameAddDel->text().toStdString(); + std::string onto_name = param; std::regex base_regex("(.*)=(.*)"); std::smatch base_match; if (std::regex_match(param, base_match, base_regex)) { if (base_match.size() == 3) + { ontos_.copy(base_match[1].str(), base_match[2].str()); + onto_name = base_match[1].str(); + } } else ontos_.add(param); @@ -735,7 +737,11 @@ void ontoloGUI::addOntologySlot() else if(err == 1) ui->ResultArea->setText(QString::fromStdString("fail to stop " + param + " : please retry")); else + { ui->ResultArea->setText(QString::fromStdString("")); + ontos_.get(onto_name)->feeder.registerNotificationCallback([this](auto msg){ this->feederCallback(msg); }); + } + displayOntologiesList(); } } @@ -831,9 +837,9 @@ void ontoloGUI::OntologyNameChangedSlot(const QString& text) ui->OntologyNameAddDel->setText(text); } -void ontoloGUI::feederCallback(const std_msgs::String& msg) +void ontoloGUI::feederCallback(const std::string& msg) { - feeder_notifications_ += "

-" + msg.data + "

"; + feeder_notifications_ += "

-" + msg + "

"; std::string html = "" "" - "

" + feeder_notifications_ + "

"; + "

" + feeder_notifications_ + "

"; - ui->FeederInfo->moveCursor(QTextCursor::End); feederSetHtmlSignal(QString::fromStdString(html)); - ui->FeederInfo->ensureCursorVisible(); + feederScrollSignal("scrollToMe"); } void ontoloGUI::feederAddSlot() From ac06de821b82761e5c7cee953127e83bf962f1cd Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Fri, 8 Dec 2023 13:01:26 +0100 Subject: [PATCH 33/37] [API] reduce ROS depedencies --- .../API/ontologenius/ConversionClient.h | 2 +- .../API/ontologenius/clients/ActionClient.h | 2 +- .../API/ontologenius/clients/ClientBase.h | 48 +++++--- .../API/ontologenius/clients/ReasonerClient.h | 2 +- .../API/ontologenius/clients/SparqlClient.h | 4 +- .../clients/ontologyClients/ClassClient.h | 2 +- .../ontologyClients/DataPropertyClient.h | 2 +- .../ontologyClients/IndividualClient.h | 2 +- .../ontologyClients/ObjectPropertyClient.h | 2 +- .../clients/ontologyClients/OntologyClient.h | 2 +- .../clientsIndex/ClientBaseIndex.h | 77 +++++++++--- .../clientsIndex/SparqlIndexClient.h | 4 +- .../ontologyClients/ClassIndexClient.h | 2 +- .../ontologyClients/DataPropertyIndexClient.h | 2 +- .../ontologyClients/IndividualIndexClient.h | 2 +- .../ObjectPropertyIndexClient.h | 2 +- .../ontologyClients/OntologyIndexClient.h | 2 +- src/API/ontologenius/clients/ActionClient.cpp | 45 ++----- .../ontologenius/clients/ManagerClient.cpp | 30 +---- .../ontologenius/clients/ReasonerClient.cpp | 28 +---- .../clients/ontologyClients/ClassClient.cpp | 112 ++++++----------- .../ontologyClients/DataPropertyClient.cpp | 30 ++--- .../ontologyClients/IndividualClient.cpp | 115 ++++++------------ .../ontologyClients/ObjectPropertyClient.cpp | 37 ++---- .../ontologyClients/OntologyClient.cpp | 86 +++++-------- .../ontologyClients/ClassIndexClient.cpp | 112 ++++++----------- .../DataPropertyIndexClient.cpp | 30 ++--- .../ontologyClients/IndividualIndexClient.cpp | 115 ++++++------------ .../ObjectPropertyIndexClient.cpp | 37 ++---- .../ontologyClients/OntologyIndexClient.cpp | 86 +++++-------- 30 files changed, 380 insertions(+), 642 deletions(-) diff --git a/include/ontologenius/API/ontologenius/ConversionClient.h b/include/ontologenius/API/ontologenius/ConversionClient.h index 598859b0..5e3a3ca3 100644 --- a/include/ontologenius/API/ontologenius/ConversionClient.h +++ b/include/ontologenius/API/ontologenius/ConversionClient.h @@ -14,7 +14,7 @@ class ConversionClient public: /// @brief Constructs a ROS conversion client. /// @param name is the name of the ontologenius service - ConversionClient(const std::string& name); + explicit ConversionClient(const std::string& name); void verbose(bool verbose) { verbose_ = verbose; } diff --git a/include/ontologenius/API/ontologenius/clients/ActionClient.h b/include/ontologenius/API/ontologenius/clients/ActionClient.h index 78b51b48..99cfb081 100644 --- a/include/ontologenius/API/ontologenius/clients/ActionClient.h +++ b/include/ontologenius/API/ontologenius/clients/ActionClient.h @@ -15,7 +15,7 @@ class ActionClient : public ClientBase /// @brief Constructs an action client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ActionClient(const std::string& name) : ClientBase((name == "") ? "actions" : "actions/" + name) + explicit ActionClient(const std::string& name) : ClientBase((name == "") ? "actions" : "actions/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ClientBase.h b/include/ontologenius/API/ontologenius/clients/ClientBase.h index b9affb69..56c91c0f 100644 --- a/include/ontologenius/API/ontologenius/clients/ClientBase.h +++ b/include/ontologenius/API/ontologenius/clients/ClientBase.h @@ -32,8 +32,10 @@ class ClientBase public: /// @brief Constructs a ROS client. /// @param name is the name of the ontologenius service - ClientBase(const std::string& name) : name_(name), - client(n_.serviceClient("/ontologenius/" + name, true)) + explicit ClientBase(const std::string& name) : name_(name), + error_code_(0), + client(n_.serviceClient("/ontologenius/" + name, true)) + {} /// @brief Gives the total number of service calls from all ClientBase instances since the last reset. @@ -42,23 +44,17 @@ class ClientBase void resetNb() {cpt = 0;} static void verbose(bool verbose) { verbose_ = verbose; } - std::vector call(const std::string& action, const std::string& param) - { - ontologenius::OntologeniusService srv; - srv.request.action = action; - srv.request.param = param; - return call(srv); - } - int getErrorCode() { return error_code_; } -protected: - /// @brief Calls the service set up in the constructor of ClientBase. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a list of string. If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL". - inline std::vector call(ontologenius::OntologeniusService& srv) + inline std::vector call(const std::string& action, const std::string& param) { + ontologenius::OntologeniusService srv; + srv.request.action = action; + srv.request.param = param; std::vector res; cpt++; @@ -91,10 +87,14 @@ class ClientBase } /// @brief Calls the service set up in the constructor of ClientBase. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a single string. If the service call fails, the returned value is "ERR:SERVICE_FAIL". - inline std::string callStr(ontologenius::OntologeniusService& srv) + inline std::string callStr(const std::string& action, const std::string& param) { + ontologenius::OntologeniusService srv; + srv.request.action = action; + srv.request.param = param; std::string res = ""; cpt++; @@ -133,10 +133,14 @@ class ClientBase } /// @brief Calls the service set up in the constructor of ClientBase. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns false if the service call fails. - inline bool callNR(ontologenius::OntologeniusService& srv) + inline bool callNR(const std::string& action, const std::string& param) { + ontologenius::OntologeniusService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) @@ -167,10 +171,14 @@ class ClientBase } /// @brief Calls the service set up in the constructor of ClientBase. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns false if the service call fails or the result code of the service is different from SUCCESS. - inline bool callBool(ontologenius::OntologeniusService& srv) + inline bool callBool(const std::string& action, const std::string& param) { + ontologenius::OntologeniusService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) diff --git a/include/ontologenius/API/ontologenius/clients/ReasonerClient.h b/include/ontologenius/API/ontologenius/clients/ReasonerClient.h index 2bbee8e1..cbd3685e 100644 --- a/include/ontologenius/API/ontologenius/clients/ReasonerClient.h +++ b/include/ontologenius/API/ontologenius/clients/ReasonerClient.h @@ -17,7 +17,7 @@ class ReasonerClient : public ClientBase /// @brief Constructs a reasoner client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ReasonerClient(const std::string& name) : ClientBase((name == "") ? "reasoner" : "reasoner/" + name) + explicit ReasonerClient(const std::string& name) : ClientBase((name == "") ? "reasoner" : "reasoner/" + name) {} /// @brief Gets the name of the plugins available. diff --git a/include/ontologenius/API/ontologenius/clients/SparqlClient.h b/include/ontologenius/API/ontologenius/clients/SparqlClient.h index b9246b5d..bced2bc1 100644 --- a/include/ontologenius/API/ontologenius/clients/SparqlClient.h +++ b/include/ontologenius/API/ontologenius/clients/SparqlClient.h @@ -16,8 +16,8 @@ class SparqlClient /// @brief Constructs a sparql client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - SparqlClient(const std::string& name) : client(n_.serviceClient((name == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name, true)), - name_((name == "") ? "sparql" : "sparql/" + name) + explicit SparqlClient(const std::string& name) : client(n_.serviceClient((name == "") ? "ontologenius/sparql" : "ontologenius/sparql/" + name, true)), + name_((name == "") ? "sparql" : "sparql/" + name) {} std::pair, std::vector> call(const std::string& query); diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h index ec68e8f3..2c159676 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/ClassClient.h @@ -16,7 +16,7 @@ class ClassClient : public OntologyClient /// @brief Constructs a class client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ClassClient(const std::string& name) : OntologyClient((name == "") ? "class" : "class/" + name) + explicit ClassClient(const std::string& name) : OntologyClient((name == "") ? "class" : "class/" + name) {} /// @brief Gives all classes below the one given in the specified parameter. diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h index ca46a960..7fc622ba 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/DataPropertyClient.h @@ -16,7 +16,7 @@ class DataPropertyClient : public OntologyClient /// @brief Constructs a data property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - DataPropertyClient(const std::string& name) : OntologyClient((name == "") ? "data_property" : "data_property/" + name) + explicit DataPropertyClient(const std::string& name) : OntologyClient((name == "") ? "data_property" : "data_property/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h index b5c6903c..3871ce6c 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/IndividualClient.h @@ -16,7 +16,7 @@ class IndividualClient : public OntologyClient /// @brief Constructs an individual client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - IndividualClient(const std::string& name) : OntologyClient((name == "")? "individual" : "individual/" + name) + explicit IndividualClient(const std::string& name) : OntologyClient((name == "")? "individual" : "individual/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h index 5ac76f71..0fb2f5e9 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.h @@ -16,7 +16,7 @@ class ObjectPropertyClient : public OntologyClient /// @brief Constructs an object property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ObjectPropertyClient(const std::string& name) : OntologyClient((name == "") ? "object_property" : "object_property/" + name) + explicit ObjectPropertyClient(const std::string& name) : OntologyClient((name == "") ? "object_property" : "object_property/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h b/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h index 99ce1e49..689a2c06 100644 --- a/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h +++ b/include/ontologenius/API/ontologenius/clients/ontologyClients/OntologyClient.h @@ -16,7 +16,7 @@ class OntologyClient : public ClientBase /// @brief Constructs an ontology client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - OntologyClient(const std::string& name) : ClientBase(name) + explicit OntologyClient(const std::string& name) : ClientBase(name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h b/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h index 043e7787..c9b7c796 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ClientBaseIndex.h @@ -32,8 +32,9 @@ class ClientBaseIndex public: /// @brief Constructs a ROS client. /// @param name is the name of the ontologenius service - ClientBaseIndex(const std::string& name) : name_(name), - client(n_.serviceClient("/ontologenius/" + name, true)) + explicit ClientBaseIndex(const std::string& name) : name_(name), + error_code_(0), + client(n_.serviceClient("/ontologenius/" + name, true)) {} /// @brief Gives the total number of service calls from all ClientBaseIndex instances since the last reset. @@ -42,18 +43,25 @@ class ClientBaseIndex void resetNb() {cpt = 0;} static void verbose(bool verbose) { verbose_ = verbose; } -protected: + int getErrorCode() { return error_code_; } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a list of string. If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL". - inline std::vector call(ontologenius::OntologeniusIndexService& srv) + inline std::vector call(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; std::vector res; cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return srv.response.string_values; + } else { if(verbose_) @@ -63,6 +71,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return srv.response.string_values; } else @@ -70,21 +79,29 @@ class ClientBaseIndex if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; res.push_back("ERR:SERVICE_FAIL"); + error_code_ = -1; return res; } } } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a list of int64. If the service call fails, the first element of the returned vector is "0". - inline std::vector callIndexes(ontologenius::OntologeniusIndexService& srv) + inline std::vector callIndexes(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; std::vector res; cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return srv.response.index_values; + } else { if(verbose_) @@ -94,6 +111,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return srv.response.index_values; } else @@ -101,20 +119,26 @@ class ClientBaseIndex if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; res.push_back(0); + error_code_ = -1; return res; } } } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a single string. If the service call fails, the returned value is "ERR:SERVICE_FAIL". - inline std::string callStr(ontologenius::OntologeniusIndexService& srv) + inline std::string callStr(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) { + error_code_ = srv.response.code; if(srv.response.string_values.size()) return srv.response.string_values[0]; else @@ -129,6 +153,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; if(srv.response.string_values.size()) return srv.response.string_values[0]; else @@ -138,20 +163,26 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; return "ERR:SERVICE_FAIL"; } } } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns a single int64. If the service call fails or has no response, the returned value is "0". - inline int64_t callIndex(ontologenius::OntologeniusIndexService& srv) + inline int64_t callIndex(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) { + error_code_ = srv.response.code; if(srv.response.index_values.size()) return srv.response.index_values[0]; else @@ -166,6 +197,7 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; if(srv.response.index_values.size()) return srv.response.index_values[0]; else @@ -175,20 +207,28 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; return 0; } } } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns false if the service call fails. - inline bool callNR(ontologenius::OntologeniusIndexService& srv) + inline bool callNR(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) + { + error_code_ = srv.response.code; return true; + } else { if(verbose_) @@ -198,22 +238,28 @@ class ClientBaseIndex { if(verbose_) std::cout << COLOR_GREEN << "Restored ontologenius/" << name_ << COLOR_OFF << std::endl; + error_code_ = srv.response.code; return true; } else { if(verbose_) std::cout << COLOR_RED << "Failure of service restoration" << COLOR_OFF << std::endl; + error_code_ = -1; return false; } } } /// @brief Calls the service set up in the constructor of ClientBaseIndex. - /// @param srv is the request. + /// @param action the query action. + /// @param param the query parameters. /// @return Returns false if the service call fails or the result code of the service is different from SUCCESS. - inline bool callBool(ontologenius::OntologeniusIndexService& srv) + inline bool callBool(const std::string& action, const std::string& param) { + ontologenius::OntologeniusIndexService srv; + srv.request.action = action; + srv.request.param = param; cpt++; if(client.call(srv)) @@ -243,6 +289,7 @@ class ClientBaseIndex ros::NodeHandle n_; static size_t cpt; static bool verbose_; + int error_code_; protected: ros::ServiceClient client; diff --git a/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h index fddf0051..86109891 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/SparqlIndexClient.h @@ -16,8 +16,8 @@ class SparqlIndexClient /// @brief Constructs a sparql client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - SparqlIndexClient(const std::string& name) : name_((name == "") ? "sparql_index" : "sparql_index/" + name), - client(n_.serviceClient((name == "") ? "ontologenius/sparql_index" : "ontologenius/sparql_index/" + name, true)) + explicit SparqlIndexClient(const std::string& name) : name_((name == "") ? "sparql_index" : "sparql_index/" + name), + client(n_.serviceClient((name == "") ? "ontologenius/sparql_index" : "ontologenius/sparql_index/" + name, true)) {} diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h index c31d4253..ca5ab5bf 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.h @@ -16,7 +16,7 @@ class ClassIndexClient : public OntologyIndexClient /// @brief Constructs a class client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ClassIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "class_index" : "class_index/" + name) + explicit ClassIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "class_index" : "class_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h index c40c4603..bf3a0bc0 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.h @@ -16,7 +16,7 @@ class DataPropertyIndexClient : public OntologyIndexClient /// @brief Constructs a data property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - DataPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "data_property_index" : "data_property_index/" + name) + explicit DataPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "data_property_index" : "data_property_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h index 73fb0682..f843daaf 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.h @@ -16,7 +16,7 @@ class IndividualIndexClient : public OntologyIndexClient /// @brief Constructs an individual client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - IndividualIndexClient(const std::string& name) : OntologyIndexClient((name == "")? "individual_index" : "individual_index/" + name) + explicit IndividualIndexClient(const std::string& name) : OntologyIndexClient((name == "")? "individual_index" : "individual_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h index 1092518f..749b3477 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.h @@ -16,7 +16,7 @@ class ObjectPropertyIndexClient : public OntologyIndexClient /// @brief Constructs an object property client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - ObjectPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "object_property_index" : "object_property_index/" + name) + explicit ObjectPropertyIndexClient(const std::string& name) : OntologyIndexClient((name == "") ? "object_property_index" : "object_property_index/" + name) { } diff --git a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h index 7ebe176a..3227d1e1 100644 --- a/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h +++ b/include/ontologenius/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.h @@ -16,7 +16,7 @@ class OntologyIndexClient : public ClientBaseIndex /// @brief Constructs an ontology client. /// Can be used in a multi-ontology mode by specifying the name of the ontology name. /// @param name is the instance to be connected to. For classic use, name should be defined as "". - OntologyIndexClient(const std::string& name) : ClientBaseIndex(name) + explicit OntologyIndexClient(const std::string& name) : ClientBaseIndex(name) { } diff --git a/src/API/ontologenius/clients/ActionClient.cpp b/src/API/ontologenius/clients/ActionClient.cpp index 879cc4b4..00f86ea2 100644 --- a/src/API/ontologenius/clients/ActionClient.cpp +++ b/src/API/ontologenius/clients/ActionClient.cpp @@ -4,71 +4,42 @@ namespace onto { bool ActionClient::close() { - ontologenius::OntologeniusService srv; - srv.request.action = "close"; - - return callNR(srv); + return callNR("close", ""); } bool ActionClient::save(const std::string& path) { - ontologenius::OntologeniusService srv; - srv.request.action = "save"; - srv.request.param = path; - - return callNR(srv); + return callNR("save", path); } bool ActionClient::exportToXml(const std::string& path) { - ontologenius::OntologeniusService srv; - srv.request.action = "export"; - srv.request.param = path; - - return callNR(srv); + return callNR("export", path); } bool ActionClient::setLang(const std::string& lang) { - ontologenius::OntologeniusService srv; - srv.request.action = "setLang"; - srv.request.param = lang; - - return callNR(srv); + return callNR("setLang", lang); } std::string ActionClient::getLang() { - ontologenius::OntologeniusService srv; - srv.request.action = "getLang"; - - return callStr(srv); + return callStr("getLang", ""); } bool ActionClient::add(const std::string& uri) { - ontologenius::OntologeniusService srv; - srv.request.action = "add"; - srv.request.param = uri; - - return callNR(srv); + return callNR("add", uri); } bool ActionClient::fadd(const std::string& file) { - ontologenius::OntologeniusService srv; - srv.request.action = "fadd"; - srv.request.param = file; - - return callNR(srv); + return callNR("fadd", file); } bool ActionClient::reset() { - ontologenius::OntologeniusService srv; - srv.request.action = "reset"; - - return callNR(srv); + return callNR("reset", ""); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ManagerClient.cpp b/src/API/ontologenius/clients/ManagerClient.cpp index ad7ae941..fd9fc077 100644 --- a/src/API/ontologenius/clients/ManagerClient.cpp +++ b/src/API/ontologenius/clients/ManagerClient.cpp @@ -4,46 +4,28 @@ namespace onto { std::vector ManagerClient::list() { - ontologenius::OntologeniusService srv; - srv.request.action = "list"; - - return call(srv); + return call("list", ""); } bool ManagerClient::add(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "add"; - srv.request.param = name; - - return callNR(srv); + return callNR("add", name); } bool ManagerClient::copy(const std::string& dest_name, const std::string& src_name) { - ontologenius::OntologeniusService srv; - srv.request.action = "copy"; - srv.request.param = dest_name + "=" + src_name; - - return callBool(srv); + return callBool("copy", dest_name + "=" + src_name); } bool ManagerClient::del(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "delete"; - srv.request.param = name; - - return callNR(srv); + return callNR("delete", name); } std::vector ManagerClient::getDifference(const std::string& onto1, const std::string& onto2, const std::string& concept) { - ontologenius::OntologeniusService srv; - srv.request.action = "difference"; - srv.request.param = onto1 + "|" + onto2 + "|" + concept; - - return call(srv); + std::string param = onto1 + "|" + onto2 + "|" + concept; + return call("difference", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ReasonerClient.cpp b/src/API/ontologenius/clients/ReasonerClient.cpp index 985d377f..53369f95 100644 --- a/src/API/ontologenius/clients/ReasonerClient.cpp +++ b/src/API/ontologenius/clients/ReasonerClient.cpp @@ -4,45 +4,27 @@ namespace onto { std::vector ReasonerClient::list() { - ontologenius::OntologeniusService srv; - srv.request.action = "list"; - - return call(srv); + return call("list", ""); } std::vector ReasonerClient::activeList() { - ontologenius::OntologeniusService srv; - srv.request.action = "activeList"; - - return call(srv); + return call("activeList", ""); } bool ReasonerClient::activate(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "activate"; - srv.request.param = name; - - return callNR(srv); + return callNR("activate", name); } bool ReasonerClient::deactivate(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "deactivate"; - srv.request.param = name; - - return callNR(srv); + return callNR("deactivate", name); } std::string ReasonerClient::getDescription(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDescription"; - srv.request.param = name; - - return callStr(srv); + return callStr("getDescription", name); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ontologyClients/ClassClient.cpp b/src/API/ontologenius/clients/ontologyClients/ClassClient.cpp index 09fdf73a..071bc002 100644 --- a/src/API/ontologenius/clients/ontologyClients/ClassClient.cpp +++ b/src/API/ontologenius/clients/ontologyClients/ClassClient.cpp @@ -4,151 +4,115 @@ namespace onto { std::vector ClassClient::getDown(const std::string& name, int depth, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDown"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("getDown", param); } std::vector ClassClient::getDisjoint(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDisjoint"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDisjoint", param); } std::vector ClassClient::getOn(const std::string& name, const std::string& property, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getOn"; - srv.request.param = name + ":" + property; + std::string param = name + ":" + property; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("getOn", param); } std::vector ClassClient::getFrom(const std::string& property, const std::string& name, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getFrom"; - srv.request.param = name + ":" + property; + std::string param = name + ":" + property; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("getFrom", param); } std::vector ClassClient::getWith(const std::string& indiv_1, const std::string& indiv_2, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getWith"; - srv.request.param = indiv_1 + ":" + indiv_2; + std::string param = indiv_1 + ":" + indiv_2; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getWith", param); } std::vector ClassClient::getRelatedFrom(const std::string& property) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedFrom"; - srv.request.param = property; - - return call(srv); + std::string param = property; + return call("getRelatedFrom", param); } std::vector ClassClient::getRelatedOn(const std::string& property) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedOn"; - srv.request.param = property; - - return call(srv); + std::string param = property; + return call("getRelatedOn", param); } std::vector ClassClient::getRelatedWith(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedWith"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRelatedWith", param); } std::vector ClassClient::getRelationFrom(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationFrom"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRelationFrom", param); } std::vector ClassClient::getRelationOn(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationOn"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRelationOn", param); } std::vector ClassClient::getRelationWith(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationWith"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRelationWith", param); } std::vector ClassClient::getDomainOf(const std::string& name, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDomainOf"; - srv.request.param = name; - + std::string param = name; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getDomainOf", param); } std::vector ClassClient::getRangeOf(const std::string& name, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRangeOf"; - srv.request.param = name; - + std::string param = name; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRangeOf", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ontologyClients/DataPropertyClient.cpp b/src/API/ontologenius/clients/ontologyClients/DataPropertyClient.cpp index 3c0b02c2..6466bf78 100644 --- a/src/API/ontologenius/clients/ontologyClients/DataPropertyClient.cpp +++ b/src/API/ontologenius/clients/ontologyClients/DataPropertyClient.cpp @@ -4,41 +4,29 @@ namespace onto { std::vector DataPropertyClient::getDown(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDown"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getDown", param); } std::vector DataPropertyClient::getDisjoint(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDisjoint"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDisjoint", param); } std::vector DataPropertyClient::getDomain(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDomain"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDomain", param); } std::vector DataPropertyClient::getRange(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRange"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRange", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ontologyClients/IndividualClient.cpp b/src/API/ontologenius/clients/ontologyClients/IndividualClient.cpp index 11880416..67d5b485 100644 --- a/src/API/ontologenius/clients/ontologyClients/IndividualClient.cpp +++ b/src/API/ontologenius/clients/ontologyClients/IndividualClient.cpp @@ -4,155 +4,116 @@ namespace onto { std::vector IndividualClient::getOn(const std::string& name, const std::string& property, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getOn"; - srv.request.param = name + ":" + property; + std::string param = name + ":" + property; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("getOn", param); } std::vector IndividualClient::getFrom(const std::string& property, const std::string& name, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getFrom"; - srv.request.param = name + ":" + property; + std::string param = name + ":" + property; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("getFrom", param); } std::vector IndividualClient::getWith(const std::string& indiv_from, const std::string& indiv_to, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getWith"; - srv.request.param = indiv_from + ":" + indiv_to; + std::string param = indiv_from + ":" + indiv_to; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getWith", param); } std::vector IndividualClient::getRelatedFrom(const std::string& property) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedFrom"; - srv.request.param = property; - - return call(srv); + std::string param = property; + return call("getRelatedFrom", param); } std::vector IndividualClient::getRelatedOn(const std::string& property) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedOn"; - srv.request.param = property; - - return call(srv); + std::string param = property; + return call("getRelatedOn", param); } std::vector IndividualClient::getRelatedWith(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelatedWith"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRelatedWith", param); } std::vector IndividualClient::getRelationFrom(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationFrom"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRelationFrom", param); } std::vector IndividualClient::getRelationOn(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationOn"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRelationOn", param); } std::vector IndividualClient::getRelationWith(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRelationWith"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRelationWith", param); } std::vector IndividualClient::getDomainOf(const std::string& name, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDomainOf"; - srv.request.param = name; - + std::string param = name; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getDomainOf", param); } std::vector IndividualClient::getRangeOf(const std::string& name, const std::string& selector, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRangeOf"; - srv.request.param = name; - + std::string param = name; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getRangeOf", param); } std::vector IndividualClient::getType(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getType"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getType", param); } std::vector IndividualClient::getSame(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getSame"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getSame", param); } std::vector IndividualClient::getDistincts(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDistincts"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDistincts", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.cpp b/src/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.cpp index 96b9f71c..5af6dd7e 100644 --- a/src/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.cpp +++ b/src/API/ontologenius/clients/ontologyClients/ObjectPropertyClient.cpp @@ -4,50 +4,35 @@ namespace onto { std::vector ObjectPropertyClient::getDown(const std::string& name, int depth) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDown"; - srv.request.param = name; - + std::string param = name; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getDown", param); } std::vector ObjectPropertyClient::getDisjoint(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDisjoint"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDisjoint", param); } std::vector ObjectPropertyClient::getDomain(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getDomain"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getDomain", param); } std::vector ObjectPropertyClient::getRange(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getRange"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getRange", param); } std::vector ObjectPropertyClient::getInverse(const std::string& name) { - ontologenius::OntologeniusService srv; - srv.request.action = "getInverse"; - srv.request.param = name; - - return call(srv); + std::string param = name; + return call("getInverse", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clients/ontologyClients/OntologyClient.cpp b/src/API/ontologenius/clients/ontologyClients/OntologyClient.cpp index 74685179..42d0a45e 100644 --- a/src/API/ontologenius/clients/ontologyClients/OntologyClient.cpp +++ b/src/API/ontologenius/clients/ontologyClients/OntologyClient.cpp @@ -4,16 +4,14 @@ namespace onto { std::vector OntologyClient::getUp(const std::string& name, int depth, const std::string& selector) { - ontologenius::OntologeniusService srv; - srv.request.action = "getUp"; - srv.request.param = name; + std::string param = name; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return call(srv); + return call("getUp", param); } bool OntologyClient::isA(const std::string& name, const std::string& base_class) @@ -27,101 +25,79 @@ bool OntologyClient::isA(const std::string& name, const std::string& base_class) std::string OntologyClient::getName(const std::string& name, bool take_id) { - ontologenius::OntologeniusService srv; - srv.request.action = "getName"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return callStr(srv); + return callStr("getName", param); } std::vector OntologyClient::getNames(const std::string& name, bool take_id) { - ontologenius::OntologeniusService srv; - srv.request.action = "getNames"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return call(srv); + return call("getNames", param); } std::vector OntologyClient::getEveryNames(const std::string& name, bool take_id) { - ontologenius::OntologeniusService srv; - srv.request.action = "getEveryNames"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return call(srv); + return call("getEveryNames", param); } std::vector OntologyClient::find(const std::string& name, bool take_id, const std::string& selector) { - ontologenius::OntologeniusService srv; - - srv.request.action = "find"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("find", param); } std::vector OntologyClient::findSub(const std::string& name, bool take_id, const std::string& selector) { - ontologenius::OntologeniusService srv; - - srv.request.action = "findSub"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("findSub", param); } std::vector OntologyClient::findRegex(const std::string& regex, bool take_id, const std::string& selector) { - ontologenius::OntologeniusService srv; - - srv.request.action = "findRegex"; - srv.request.param = regex; + std::string param = regex; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("findRegex", param); } std::vector OntologyClient::findFuzzy(const std::string& name, double threshold, bool take_id, const std::string& selector) { - ontologenius::OntologeniusService srv; - - srv.request.action = "findFuzzy"; - srv.request.param = name + " -t " + std::to_string(threshold); + std::string param = name + " -t " + std::to_string(threshold); if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != "") - srv.request.param += " -s " + selector; + param += " -s " + selector; - return call(srv); + return call("findFuzzy", param); } bool OntologyClient::exist(const std::string& name) { - ontologenius::OntologeniusService srv; - - srv.request.action = "exist"; - srv.request.param = name; - - return (callStr(srv) != ""); + std::string param = name; + return (callStr("exist", param) != ""); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.cpp b/src/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.cpp index b211d6a5..55a7c4df 100644 --- a/src/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/ontologyClients/ClassIndexClient.cpp @@ -4,151 +4,115 @@ namespace onto { std::vector ClassIndexClient::getDown(int64_t index, int depth, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDown"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("getDown", param); } std::vector ClassIndexClient::getDisjoint(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDisjoint"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDisjoint", param); } std::vector ClassIndexClient::getOn(int64_t index, int64_t property, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getOn"; - srv.request.param = std::to_string(index) + ":" + std::to_string(property); + std::string param = std::to_string(index) + ":" + std::to_string(property); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("getOn", param); } std::vector ClassIndexClient::getFrom(int64_t property, int64_t index, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getFrom"; - srv.request.param = std::to_string(index) + ":" + std::to_string(property); + std::string param = std::to_string(index) + ":" + std::to_string(property); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("getFrom", param); } std::vector ClassIndexClient::getWith(int64_t indiv_1, int64_t indiv_2, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getWith"; - srv.request.param = std::to_string(indiv_1) + ":" + std::to_string(indiv_2); + std::string param = std::to_string(indiv_1) + ":" + std::to_string(indiv_2); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getWith", param); } std::vector ClassIndexClient::getRelatedFrom(int64_t property) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedFrom"; - srv.request.param = std::to_string(property); - - return callIndexes(srv); + std::string param = std::to_string(property); + return callIndexes("getRelatedFrom", param); } std::vector ClassIndexClient::getRelatedOn(int64_t property) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedOn"; - srv.request.param = std::to_string(property); - - return callIndexes(srv); + std::string param = std::to_string(property); + return callIndexes("getRelatedOn", param); } std::vector ClassIndexClient::getRelatedWith(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedWith"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRelatedWith", param); } std::vector ClassIndexClient::getRelationFrom(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationFrom"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRelationFrom", param); } std::vector ClassIndexClient::getRelationOn(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationOn"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRelationOn", param); } std::vector ClassIndexClient::getRelationWith(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationWith"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRelationWith", param); } std::vector ClassIndexClient::getDomainOf(int64_t index, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDomainOf"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getDomainOf", param); } std::vector ClassIndexClient::getRangeOf(int64_t index, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRangeOf"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRangeOf", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.cpp b/src/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.cpp index c307ab46..3f38317e 100644 --- a/src/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/ontologyClients/DataPropertyIndexClient.cpp @@ -4,41 +4,29 @@ namespace onto { std::vector DataPropertyIndexClient::getDown(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDown"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getDown", param); } std::vector DataPropertyIndexClient::getDisjoint(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDisjoint"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDisjoint", param); } std::vector DataPropertyIndexClient::getDomain(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDomain"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDomain", param); } std::vector DataPropertyIndexClient::getRange(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRange"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRange", param); } } // namespace onto diff --git a/src/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.cpp b/src/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.cpp index d9416f61..87a94e0f 100644 --- a/src/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/ontologyClients/IndividualIndexClient.cpp @@ -4,155 +4,116 @@ namespace onto { std::vector IndividualIndexClient::getOn(int64_t index, int64_t property, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getOn"; - srv.request.param = std::to_string(index) + ":" + std::to_string(property); + std::string param = std::to_string(index) + ":" + std::to_string(property); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("getOn", param); } std::vector IndividualIndexClient::getFrom(int64_t property, int64_t index, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getFrom"; - srv.request.param = std::to_string(index) + ":" + std::to_string(property); + std::string param = std::to_string(index) + ":" + std::to_string(property); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("getFrom", param); } std::vector IndividualIndexClient::getWith(int64_t indiv_from, int64_t indiv_to, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getWith"; - srv.request.param = std::to_string(indiv_from) + ":" + std::to_string(indiv_to); + std::string param = std::to_string(indiv_from) + ":" + std::to_string(indiv_to); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getWith", param); } std::vector IndividualIndexClient::getRelatedFrom(int64_t property) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedFrom"; - srv.request.param = std::to_string(property); - - return callIndexes(srv); + std::string param = std::to_string(property); + return callIndexes("getRelatedFrom", param); } std::vector IndividualIndexClient::getRelatedOn(int64_t property) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedOn"; - srv.request.param = std::to_string(property); - - return callIndexes(srv); + std::string param = std::to_string(property); + return callIndexes("getRelatedOn", param); } std::vector IndividualIndexClient::getRelatedWith(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelatedWith"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRelatedWith", param); } std::vector IndividualIndexClient::getRelationFrom(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationFrom"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRelationFrom", param); } std::vector IndividualIndexClient::getRelationOn(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationOn"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRelationOn", param); } std::vector IndividualIndexClient::getRelationWith(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRelationWith"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRelationWith", param); } std::vector IndividualIndexClient::getDomainOf(int64_t index, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDomainOf"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getDomainOf", param); } std::vector IndividualIndexClient::getRangeOf(int64_t index, int64_t selector, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRangeOf"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getRangeOf", param); } std::vector IndividualIndexClient::getType(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getType"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getType", param); } std::vector IndividualIndexClient::getSame(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getSame"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getSame", param); } std::vector IndividualIndexClient::getDistincts(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDistincts"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDistincts", param); } } // namespace onto \ No newline at end of file diff --git a/src/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.cpp b/src/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.cpp index de90615a..d2ee09e1 100644 --- a/src/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/ontologyClients/ObjectPropertyIndexClient.cpp @@ -4,50 +4,35 @@ namespace onto { std::vector ObjectPropertyIndexClient::getDown(int64_t index, int depth) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDown"; - srv.request.param = std::to_string(index); - + std::string param = std::to_string(index); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getDown", param); } std::vector ObjectPropertyIndexClient::getDisjoint(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDisjoint"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDisjoint", param); } std::vector ObjectPropertyIndexClient::getDomain(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getDomain"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getDomain", param); } std::vector ObjectPropertyIndexClient::getRange(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getRange"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getRange", param); } std::vector ObjectPropertyIndexClient::getInverse(int64_t index) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getInverse"; - srv.request.param = std::to_string(index); - - return callIndexes(srv); + std::string param = std::to_string(index); + return callIndexes("getInverse", param); } } // namespace onto diff --git a/src/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.cpp b/src/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.cpp index 31b72ca1..af1b0f14 100644 --- a/src/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.cpp +++ b/src/API/ontologenius/clientsIndex/ontologyClients/OntologyIndexClient.cpp @@ -4,16 +4,14 @@ namespace onto { std::vector OntologyIndexClient::getUp(int64_t index, int depth, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getUp"; - srv.request.param = std::to_string(index); + std::string param = std::to_string(index); if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); if(depth >= 0) - srv.request.param += " -d " + std::to_string(depth); + param += " -d " + std::to_string(depth); - return callIndexes(srv); + return callIndexes("getUp", param); } bool OntologyIndexClient::isA(int64_t index, int64_t base_class) @@ -27,101 +25,79 @@ bool OntologyIndexClient::isA(int64_t index, int64_t base_class) std::string OntologyIndexClient::getName(int64_t index, bool take_id) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getName"; - srv.request.param = std::to_string(index); + std::string param = std::to_string(index); if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return callStr(srv); + return callStr("getName", param); } std::vector OntologyIndexClient::getNames(int64_t index, bool take_id) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getNames"; - srv.request.param = std::to_string(index); + std::string param = std::to_string(index); if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return call(srv); + return call("getNames", param); } std::vector OntologyIndexClient::getEveryNames(int64_t index, bool take_id) { - ontologenius::OntologeniusIndexService srv; - srv.request.action = "getEveryNames"; - srv.request.param = std::to_string(index); + std::string param = std::to_string(index); if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; - return call(srv); + return call("getEveryNames", param); } std::vector OntologyIndexClient::find(const std::string& name, bool take_id, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - - srv.request.action = "find"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("find", param); } std::vector OntologyIndexClient::findSub(const std::string& name, bool take_id, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - - srv.request.action = "findSub"; - srv.request.param = name; + std::string param = name; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("findSub", param); } std::vector OntologyIndexClient::findRegex(const std::string& regex, bool take_id, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - - srv.request.action = "findRegex"; - srv.request.param = regex; + std::string param = regex; if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return callIndexes(srv); + return callIndexes("findRegex", param); } std::vector OntologyIndexClient::findFuzzy(const std::string& name, double threshold, bool take_id, int64_t selector) { - ontologenius::OntologeniusIndexService srv; - - srv.request.action = "findFuzzy"; - srv.request.param = name + " -t " + std::to_string(threshold); + std::string param = name + " -t " + std::to_string(threshold); if(take_id == false) - srv.request.param += " -i false"; + param += " -i false"; if(selector != 0) - srv.request.param += " -s " + std::to_string(selector); + param += " -s " + std::to_string(selector); - return call(srv); + return call("findFuzzy", param); } bool OntologyIndexClient::exist(int64_t index) { - ontologenius::OntologeniusIndexService srv; - - srv.request.action = "exist"; - srv.request.param = std::to_string(index); - - return (callIndex(srv) != 0); + std::string param = std::to_string(index); + return (callIndex("exist", param) != 0); } } // namespace onto From d96ed8dce56676d3104dd1f6be7f1ab5d002b19b Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Fri, 8 Dec 2023 13:06:19 +0100 Subject: [PATCH 34/37] [rospy] add error_code to ClientBase --- ontopy/ontologenius/clients/ClientBase.py | 13 +++++++++++++ .../clientsIndex/ClientBaseIndex.py | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ontopy/ontologenius/clients/ClientBase.py b/ontopy/ontologenius/clients/ClientBase.py index b4c9b4ca..9c0f4314 100644 --- a/ontopy/ontologenius/clients/ClientBase.py +++ b/ontopy/ontologenius/clients/ClientBase.py @@ -14,6 +14,7 @@ class ClientBase: def __init__(self, name): """Constructs a ROS client linked to the service name(str).""" self._name = name + self.error_code = 0 self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusService, True) def nb(self): @@ -38,6 +39,7 @@ def call(self, action, param): ClientBase._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return response.values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: @@ -45,12 +47,14 @@ def call(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBase._verbose == True: print("Restored ontologenius/" + self._name) return response.values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callStr(self, action, param): @@ -61,6 +65,7 @@ def callStr(self, action, param): ClientBase._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code if len(response.values) > 0: return response.values[0] else: @@ -71,6 +76,7 @@ def callStr(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBase._verbose == True: print("Restored ontologenius/" + self._name) if len(response.values) > 0: @@ -80,6 +86,7 @@ def callStr(self, action, param): except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callNR(self, action, param): @@ -90,6 +97,7 @@ def callNR(self, action, param): ClientBase._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return True except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: @@ -97,12 +105,14 @@ def callNR(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBase._verbose == True: print("Restored ontologenius/" + self._name) return True except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: print("Failure of service restoration") + self.error_code = -1 return False def callBool(self, action, param): @@ -114,6 +124,7 @@ def callBool(self, action, param): ClientBase._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return response.code == 0 except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: @@ -123,8 +134,10 @@ def callBool(self, action, param): response = self._client(action, param) if ClientBase._verbose == True: print("Restored ontologenius/" + self._name) + self.error_code = response.code return response.code == 0 except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBase._verbose == True: print("Failure of service restoration") + self.error_code = -1 return False diff --git a/ontopy/ontologenius/clientsIndex/ClientBaseIndex.py b/ontopy/ontologenius/clientsIndex/ClientBaseIndex.py index 62f12503..24a2c920 100644 --- a/ontopy/ontologenius/clientsIndex/ClientBaseIndex.py +++ b/ontopy/ontologenius/clientsIndex/ClientBaseIndex.py @@ -15,6 +15,7 @@ def __init__(self, name): """Constructs a ROS client linked to the service name(str).""" self._name = name self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) + self.error_code = 0 def nb(self): """Gives the total number (int) of service calls from all ClientBaseIndex instances since the last reset.""" @@ -38,6 +39,7 @@ def call(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return response.string_values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: @@ -45,12 +47,14 @@ def call(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) return response.string_values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callIndexes(self, action, param): @@ -61,6 +65,7 @@ def callIndexes(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return response.index_values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: @@ -68,12 +73,14 @@ def callIndexes(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) return response.index_values except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callStr(self, action, param): @@ -84,6 +91,7 @@ def callStr(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code if len(response.string_values) > 0: return response.string_values[0] else: @@ -94,6 +102,7 @@ def callStr(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) if len(response.string_values) > 0: @@ -103,6 +112,7 @@ def callStr(self, action, param): except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callIndex(self, action, param): @@ -113,6 +123,7 @@ def callIndex(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code if len(response.index_values) > 0: return response.index_values[0] else: @@ -123,6 +134,7 @@ def callIndex(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) if len(response.index_values) > 0: @@ -132,6 +144,7 @@ def callIndex(self, action, param): except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return None def callNR(self, action, param): @@ -142,6 +155,7 @@ def callNR(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return True except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: @@ -149,12 +163,14 @@ def callNR(self, action, param): self._client = rospy.ServiceProxy('ontologenius/' + self._name, OntologeniusIndexService, True) try: response = self._client(action, param) + self.error_code = response.code if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) return True except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return False def callBool(self, action, param): @@ -166,6 +182,7 @@ def callBool(self, action, param): ClientBaseIndex._cpt += 1 try: response = self._client(action, param) + self.error_code = response.code return response.code == 0 except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: @@ -175,8 +192,10 @@ def callBool(self, action, param): response = self._client(action, param) if ClientBaseIndex._verbose == True: print("Restored ontologenius/" + self._name) + self.error_code = response.code return response.code == 0 except (rospy.ServiceException, rospy.exceptions.TransportTerminated) as e: if ClientBaseIndex._verbose == True: print("Failure of service restoration") + self.error_code = -1 return False From 9cd262d8e77837b566ba3724da5746a158408405 Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Fri, 8 Dec 2023 13:53:48 +0100 Subject: [PATCH 35/37] [Doc] update ClientBase documentation --- docs/cpp_API/ClientBase.html | 43 ++++++++++-------------- docs/cpp_API/ClientBaseIndex.html | 55 +++++++++++++------------------ 2 files changed, 40 insertions(+), 58 deletions(-) diff --git a/docs/cpp_API/ClientBase.html b/docs/cpp_API/ClientBase.html index 04f7f22a..3f80f6ae 100644 --- a/docs/cpp_API/ClientBase.html +++ b/docs/cpp_API/ClientBase.html @@ -47,8 +47,6 @@

Ontologenius Cpp API Documentation

Contents

@@ -138,19 +136,11 @@

Public Functions

ClientBase(std::string name) size_t nb() resetNb() - - -
- - -

Protected Functions

-
- - - - - - + + + + +
std::vector<std::string> call(ontologenius::OntologeniusService& srv)
std::string callStr(ontologenius::OntologeniusService& srv)
bool callNR(ontologenius::OntologeniusService& srv)
bool callBool(ontologenius::OntologeniusService& srv)
int getErrorCode()
std::vector<std::string> call(const std::string& action, const std::string& param)
std::string callStr(const std::string& action, const std::string& param)
bool callNR(const std::string& action, const std::string& param)
bool callBool(const std::string& action, const std::string& param)
@@ -174,22 +164,23 @@

size_t ClientB

ClientBase::resetNb()

Reset Call Counter for all instances of ClientBase.

-

Protected Function Documentation

+

int ClientBase::getErrorCode()

+

Gives the error code of the last service call. Code 0 corresponds to no error. Code -1 corresponds to service call error. Code 1 corresponds to an internal error. Code 2 corresponds to unknown query. Code 3 corresponds to unclosed ontology.

-

inline std::vector<std::string> ClientBase::call(ontologenius::OntologeniusService& srv)

-

Calls the service set up in the constructor of ClientBase with the request srv

-

If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL".

+

inline std::vector<std::string> ClientBase::call(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param

+

If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.

-

inline std::string ClientBase::callStr(ontologenius::OntologeniusService& srv)

-

Calls the service set up in the constructor of ClientBase with the request srv

-

If the service call fails, the returned value is "ERR:SERVICE_FAIL".

+

inline std::string ClientBase::callStr(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param

+

If the service call fails, the returned value is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.

-

inline bool ClientBase::callNR(ontologenius::OntologeniusService& srv)

-

Calls the service set up in the constructor of ClientBase with the request srv

+

inline bool ClientBase::callNR(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param

Returns false if the service call fails.

-

inline bool ClientBase::callBool(ontologenius::OntologeniusService& srv)

-

Calls the service set up in the constructor of ClientBase with the request srv

+

inline bool ClientBase::callBool(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBase with the request composed of an action action and parameters param

Returns false if the service call fails or the result code of the service is different from SUCCESS.

diff --git a/docs/cpp_API/ClientBaseIndex.html b/docs/cpp_API/ClientBaseIndex.html index 98e8b300..775918b2 100644 --- a/docs/cpp_API/ClientBaseIndex.html +++ b/docs/cpp_API/ClientBaseIndex.html @@ -47,8 +47,6 @@

Ontologenius Cpp API Documentation

Contents

@@ -138,21 +136,13 @@

Public Functions

ClientBaseIndex(std::string name) size_t nb() resetNb() - - -
- - -

Protected Functions

-
- - - - - - - - + + + + + + +
std::vector<std::string> call(ontologenius::OntologeniusIndexService& srv)
std::vector<int64_t> callIndexes(ontologenius::OntologeniusIndexService& srv)
std::string callStr(ontologenius::OntologeniusIndexService& srv)
int64_t callIndex(ontologenius::OntologeniusIndexService& srv)
bool callNR(ontologenius::OntologeniusIndexService& srv)
bool callBool(ontologenius::OntologeniusIndexService& srv)
int getErrorCode()
std::vector<std::string> call(const std::string& action, const std::string& param)
std::vector<int64_t> callIndexes(const std::string& action, const std::string& param)
std::string callStr(const std::string& action, const std::string& param)
int64_t callIndex(const std::string& action, const std::string& param)
bool callNR(const std::string& action, const std::string& param)
bool callBool(const std::string& action, const std::string& param)
@@ -178,30 +168,31 @@

size_t ClientB

ClientBaseIndex::resetNb()

Reset Call Counter for all instances of ClientBaseIndex.

-

Protected Function Documentation

+

int ClientBaseIndex::getErrorCode()

+

Gives the error code of the last service call. Code 0 corresponds to no error. Code -1 corresponds to service call error. Code 1 corresponds to an internal error. Code 2 corresponds to unknown query. Code 3 corresponds to unclosed ontology.

-

inline std::vector<std::string> ClientBaseIndex::call(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

-

If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL".

+

inline std::vector<std::string> ClientBaseIndex::call(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

+

If the service call fails, the first element of the returned vector is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.

-

inline std::vector<int64_t> ClientBaseIndex::callIndexes(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

+

inline std::vector<int64_t> ClientBaseIndex::callIndexes(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

If the service call fails, the first element of the returned vector is 0.

-

inline std::string ClientBaseIndex::callStr(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

-

If the service call fails, the returned value is "ERR:SERVICE_FAIL".

+

inline std::string ClientBaseIndex::callStr(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

+

If the service call fails, the returned value is "ERR:SERVICE_FAIL". Error detail can be queried using getError method.

-

inline int64_t ClientBaseIndex::callIndex(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

+

inline int64_t ClientBaseIndex::callIndex(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

If the service call fails or has no response, the returned value is 0.

-

inline bool ClientBaseIndex::callNR(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

+

inline bool ClientBaseIndex::callNR(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

Returns false if the service call fails.

-

inline bool ClientBaseIndex::callBool(ontologenius::OntologeniusIndexService& srv)

-

Calls the service set up in the constructor of ClientBaseIndex with the request srv

+

inline bool ClientBaseIndex::callBool(const std::string& action, const std::string& param)

+

Calls the service set up in the constructor of ClientBaseIndex with the request composed of an action action and parameters param

Returns false if the service call fails or the result code of the service is different from SUCCESS.

From 61b68069993034cd5e57f6b4222c9c1afe3a96bf Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Fri, 8 Dec 2023 14:05:41 +0100 Subject: [PATCH 36/37] [Ontology] close methods returns false if closure fails --- docs/cpp_API/ActionClient.html | 2 +- docs/python_API/ActionClient.html | 2 +- .../API/ontologenius/clients/ActionClient.h | 2 +- include/ontologenius/core/ontoGraphs/Ontology.h | 2 +- include/ontologenius/interface/RosInterface.h | 2 +- ontopy/ontologenius/clients/ActionClient.py | 7 +++++-- src/API/ontologenius/clients/ActionClient.cpp | 5 ++++- src/core/ontoGraphs/Ontology.cpp | 8 ++++---- src/interface/RosInterface.cpp | 11 ++++++++--- 9 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/cpp_API/ActionClient.html b/docs/cpp_API/ActionClient.html index 41151fb9..6c767f20 100644 --- a/docs/cpp_API/ActionClient.html +++ b/docs/cpp_API/ActionClient.html @@ -171,7 +171,7 @@

ActionClient::bool ActionClient::close()

Links all the concepts loaded from files and the Internet. Before closing an ontology, exploration requests are not allowed.

-

Returns false if the service call fails.

+

Returns false ontology closure fails or if the service call fails. Use getErrorCode method to get the origin.

bool ActionClient::save(const std::string& path)

Saves the current ontology in the absolute path path. The path parameter must be of the form: my/path/to/ontology.owl

diff --git a/docs/python_API/ActionClient.html b/docs/python_API/ActionClient.html index 39150d17..443f1aeb 100644 --- a/docs/python_API/ActionClient.html +++ b/docs/python_API/ActionClient.html @@ -169,7 +169,7 @@

__init__<

close(self)

Link all the concepts loaded from files and the Internet. Before closing an ontology, exploration requests are not allowed.

-

Returns False if the service call fails.

+

Returns false ontology closure fails or if the service call fails. Use getErrorCode method to get the origin.

save(self, path)

Saves the current ontology in the absolute path(str) path. The path(str) parameter must be of the form: my/path/to/ontology.owl

diff --git a/include/ontologenius/API/ontologenius/clients/ActionClient.h b/include/ontologenius/API/ontologenius/clients/ActionClient.h index 99cfb081..d536efc5 100644 --- a/include/ontologenius/API/ontologenius/clients/ActionClient.h +++ b/include/ontologenius/API/ontologenius/clients/ActionClient.h @@ -20,7 +20,7 @@ class ActionClient : public ClientBase } /// @brief Link all the concepts loaded from files and the Internet. Before closing an ontology, exploration requests are not allowed. - /// @return Returns false if the service call fails. + /// @return Returns false ontology closure fails or if the service call fails. bool close(); /// @brief Saves the current ontology in an absolute path. /// @param path is the path where the ontology will be saved. It must be of the form: my/path/to/ontology.owl diff --git a/include/ontologenius/core/ontoGraphs/Ontology.h b/include/ontologenius/core/ontoGraphs/Ontology.h index 130fcfae..5aa1c6b4 100644 --- a/include/ontologenius/core/ontoGraphs/Ontology.h +++ b/include/ontologenius/core/ontoGraphs/Ontology.h @@ -18,7 +18,7 @@ class Ontology Ontology(const Ontology& other); ~Ontology(); - int close(); + bool close(); int readFromUri(const std::string& uri); int readFromFile(const std::string& file_name); diff --git a/include/ontologenius/interface/RosInterface.h b/include/ontologenius/interface/RosInterface.h index 23fd1f67..d42bbc0a 100644 --- a/include/ontologenius/interface/RosInterface.h +++ b/include/ontologenius/interface/RosInterface.h @@ -59,7 +59,7 @@ class RosInterface void stop(); /// @brief Closes the ontology to make it explorable. This is not mandatory to close it in this way. It is better to let the user do it by himself - void close(); + bool close(); /// @brief Tests if the interface is running. By running we meant that the threads and ROS subscribers are alive /// @return true is the interface is running, false otherwise diff --git a/ontopy/ontologenius/clients/ActionClient.py b/ontopy/ontologenius/clients/ActionClient.py index 1f6538ea..bb84c411 100644 --- a/ontopy/ontologenius/clients/ActionClient.py +++ b/ontopy/ontologenius/clients/ActionClient.py @@ -22,9 +22,12 @@ def __init__(self, name): def close(self): """Link all the concepts loaded from files and the Internet. Before closing an ontology, exploration requests are not allowed. - Returns False if the service call fails. + Returns false ontology closure fails or if the service call fails. """ - return self.callNR("close", "") + if self.callNR("close", "") == False: + return False + else: + return self.error_code == 0 def save(self, path): """Saves the current ontology in the absolute path(str) path. diff --git a/src/API/ontologenius/clients/ActionClient.cpp b/src/API/ontologenius/clients/ActionClient.cpp index 00f86ea2..993bc391 100644 --- a/src/API/ontologenius/clients/ActionClient.cpp +++ b/src/API/ontologenius/clients/ActionClient.cpp @@ -4,7 +4,10 @@ namespace onto { bool ActionClient::close() { - return callNR("close", ""); + if(callNR("close", "") == false) + return false; + else + return (getErrorCode() == 0); } bool ActionClient::save(const std::string& path) diff --git a/src/core/ontoGraphs/Ontology.cpp b/src/core/ontoGraphs/Ontology.cpp index 2a0cc574..53dcb9be 100644 --- a/src/core/ontoGraphs/Ontology.cpp +++ b/src/core/ontoGraphs/Ontology.cpp @@ -50,10 +50,10 @@ Ontology::~Ontology() save(); } -int Ontology::close() +bool Ontology::close() { if(is_init_ == true) - return 0; + return true; class_graph_.close(); object_property_graph_.close(); @@ -93,9 +93,9 @@ int Ontology::close() Display::info("**************************************"); if(err) - return -1; + return false; else - return 0; + return true; } int Ontology::readFromUri(const std::string& uri) diff --git a/src/interface/RosInterface.cpp b/src/interface/RosInterface.cpp index 5cdb61a2..d52f3f46 100644 --- a/src/interface/RosInterface.cpp +++ b/src/interface/RosInterface.cpp @@ -188,11 +188,13 @@ void RosInterface::release() feeder_mutex_.unlock(); } -void RosInterface::close() +bool RosInterface::close() { - onto_->close(); + if(onto_->close() == false) + return false; reasoners_.initialize(); reasoners_.runPostReasoners(); + return true; } void RosInterface::setDisplay(bool display) @@ -238,7 +240,10 @@ bool RosInterface::actionsHandle(ontologenius::OntologeniusService::Request &req else if(req.action == "export") feeder_.exportToXml(req.param); else if(req.action == "close") - close(); + { + if(close() == false) + res.code = REQUEST_ERROR; + } else if(req.action == "reset") { lock(); From db512ba732cd96c2d109053ac28fe821b109bd5c Mon Sep 17 00:00:00 2001 From: Guillaume Sarthou Date: Fri, 8 Dec 2023 14:11:29 +0100 Subject: [PATCH 37/37] set to 0.3.2 --- README.md | 2 +- docs/Download.html | 29 +++++++++++++++++-- docs/InstallOntologenius.html | 2 +- docs/Publications.html | 2 +- docs/SetUp.html | 4 +-- docs/cpp_API/ActionClient.html | 2 +- docs/cpp_API/ClassClient.html | 2 +- docs/cpp_API/ClassIndexClient.html | 2 +- docs/cpp_API/ClientBase.html | 2 +- docs/cpp_API/ClientBaseIndex.html | 2 +- docs/cpp_API/ConversionClient.html | 2 +- docs/cpp_API/CppAPI.html | 2 +- docs/cpp_API/DataPropertyClient.html | 2 +- docs/cpp_API/DataPropertyIndexClient.html | 2 +- docs/cpp_API/FeederPublisher.html | 2 +- docs/cpp_API/IndividualClient.html | 2 +- docs/cpp_API/IndividualIndexClient.html | 2 +- docs/cpp_API/ManagerClient.html | 2 +- docs/cpp_API/ObjectPropertyClient.html | 2 +- docs/cpp_API/ObjectPropertyIndexClient.html | 2 +- docs/cpp_API/OntologiesManipulator.html | 2 +- docs/cpp_API/OntologyClient.html | 2 +- docs/cpp_API/OntologyIndexClient.html | 2 +- docs/cpp_API/OntologyManipulator.html | 2 +- docs/cpp_API/OntologyManipulatorIndex.html | 2 +- docs/cpp_API/ReasonerClient.html | 2 +- docs/cpp_API/SparqlClient.html | 2 +- docs/cpp_API/SparqlIndexClient.html | 2 +- docs/cpp_Tutorials/Tutorials.html | 2 +- docs/index.html | 6 ++-- docs/overview/launchers.html | 2 +- docs/overview/ontoloGUI.html | 2 +- docs/overview/reasonersConfiguration.html | 2 +- docs/python_API/ActionClient.html | 2 +- docs/python_API/ClassClient.html | 2 +- docs/python_API/ClassIndexClient.html | 2 +- docs/python_API/ClientBase.html | 2 +- docs/python_API/ClientBaseIndex.html | 2 +- docs/python_API/ConversionClient.html | 2 +- docs/python_API/DataPropertyClient.html | 2 +- docs/python_API/DataPropertyIndexClient.html | 2 +- docs/python_API/FeederPublisher.html | 2 +- docs/python_API/IndividualClient.html | 2 +- docs/python_API/IndividualIndexClient.html | 2 +- docs/python_API/ManagerClient.html | 2 +- docs/python_API/ObjectPropertyClient.html | 2 +- .../python_API/ObjectPropertyIndexClient.html | 2 +- docs/python_API/OntologiesManipulator.html | 2 +- docs/python_API/OntologyClient.html | 2 +- docs/python_API/OntologyIndexClient.html | 2 +- docs/python_API/OntologyManipulator.html | 2 +- docs/python_API/OntologyManipulatorIndex.html | 2 +- docs/python_API/PythonAPI.html | 2 +- docs/python_API/ReasonerClient.html | 2 +- docs/python_API/SparqlClient.html | 2 +- docs/python_API/SparqlIndexClient.html | 2 +- docs/python_Tutorials/Tutorials.html | 2 +- package.xml | 2 +- 58 files changed, 87 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 831dce93..015c441d 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,4 @@ On this launcher file, you will find an argument indicating the path to the onto You can add your own ontology files in the argument if you want them to be loaded at the beginning of the program. [Release-Url]: https://sarthou.github.io/ontologenius/ -[Release-image]: http://img.shields.io/badge/release-v0.3.1-1eb0fc.svg +[Release-image]: http://img.shields.io/badge/release-v0.3.2-1eb0fc.svg diff --git a/docs/Download.html b/docs/Download.html index f58faac9..71e36138 100644 --- a/docs/Download.html +++ b/docs/Download.html @@ -1,7 +1,7 @@ - Download | Ontologenius 0.3.1 + Download | Ontologenius 0.3.2 @@ -90,8 +90,33 @@

Download

You have below the archives of the major versions of Ontologenius:

+

V0.3.2

+

8 / 12 / 2023

+ + +

V0.3.1

-

XX / XX / 2023

+

12 / 09 / 2023

  • diff --git a/docs/InstallOntologenius.html b/docs/InstallOntologenius.html index b689916c..76425356 100644 --- a/docs/InstallOntologenius.html +++ b/docs/InstallOntologenius.html @@ -1,7 +1,7 @@ - Install | Ontologenius 0.3.1 + Install | Ontologenius 0.3.2 diff --git a/docs/Publications.html b/docs/Publications.html index 2df55f35..e277ac8e 100644 --- a/docs/Publications.html +++ b/docs/Publications.html @@ -1,7 +1,7 @@ - Publications | Ontologenius 0.3.1 + Publications | Ontologenius 0.3.2 diff --git a/docs/SetUp.html b/docs/SetUp.html index a98026c4..39668e6f 100644 --- a/docs/SetUp.html +++ b/docs/SetUp.html @@ -1,7 +1,7 @@ - Set up | Ontologenius 0.3.1 + Set up | Ontologenius 0.3.2 @@ -132,7 +132,7 @@

    Set Up Your Environnement

The package.xml does not need to be modified. For the CMakeLists.txt, we will require a minimal version (optional) and include ontologenius API.

-
find_package(ontologenius 0.3.1 REQUIRED)
+
find_package(ontologenius 0.3.2 REQUIRED)
...
catkin_package(
# INCLUDE_DIRS include
diff --git a/docs/cpp_API/ActionClient.html b/docs/cpp_API/ActionClient.html index 6c767f20..3b8260fb 100644 --- a/docs/cpp_API/ActionClient.html +++ b/docs/cpp_API/ActionClient.html @@ -1,7 +1,7 @@ - ActionClient Class (cpp) | Ontologenius 0.3.1 + ActionClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ClassClient.html b/docs/cpp_API/ClassClient.html index 4384b850..65a898df 100644 --- a/docs/cpp_API/ClassClient.html +++ b/docs/cpp_API/ClassClient.html @@ -1,7 +1,7 @@ - ClassClient Class (cpp) | Ontologenius 0.3.1 + ClassClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ClassIndexClient.html b/docs/cpp_API/ClassIndexClient.html index 163cb3c4..947ab7b5 100644 --- a/docs/cpp_API/ClassIndexClient.html +++ b/docs/cpp_API/ClassIndexClient.html @@ -1,7 +1,7 @@ - ClassIndexClient Class (cpp) | Ontologenius 0.3.1 + ClassIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ClientBase.html b/docs/cpp_API/ClientBase.html index 3f80f6ae..87ba94f6 100644 --- a/docs/cpp_API/ClientBase.html +++ b/docs/cpp_API/ClientBase.html @@ -1,7 +1,7 @@ - ClientBase Class (cpp) | Ontologenius 0.3.1 + ClientBase Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ClientBaseIndex.html b/docs/cpp_API/ClientBaseIndex.html index 775918b2..35644153 100644 --- a/docs/cpp_API/ClientBaseIndex.html +++ b/docs/cpp_API/ClientBaseIndex.html @@ -1,7 +1,7 @@ - ClientBaseIndex Class (cpp) | Ontologenius 0.3.1 + ClientBaseIndex Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ConversionClient.html b/docs/cpp_API/ConversionClient.html index c6bdb7ff..f00906ad 100644 --- a/docs/cpp_API/ConversionClient.html +++ b/docs/cpp_API/ConversionClient.html @@ -1,7 +1,7 @@ - ConversionClient Class (cpp) | Ontologenius 0.3.1 + ConversionClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/CppAPI.html b/docs/cpp_API/CppAPI.html index 9d198097..af009330 100644 --- a/docs/cpp_API/CppAPI.html +++ b/docs/cpp_API/CppAPI.html @@ -1,7 +1,7 @@ - C++ API (cpp) | Ontologenius 0.3.1 + C++ API (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/DataPropertyClient.html b/docs/cpp_API/DataPropertyClient.html index 0a671d8f..2a84b4c3 100644 --- a/docs/cpp_API/DataPropertyClient.html +++ b/docs/cpp_API/DataPropertyClient.html @@ -1,7 +1,7 @@ - DataPropertyClient Class (cpp) | Ontologenius 0.3.1 + DataPropertyClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/DataPropertyIndexClient.html b/docs/cpp_API/DataPropertyIndexClient.html index 534bb47a..cb24d4d1 100644 --- a/docs/cpp_API/DataPropertyIndexClient.html +++ b/docs/cpp_API/DataPropertyIndexClient.html @@ -1,7 +1,7 @@ - DataPropertyIndexClient Class (cpp) | Ontologenius 0.3.1 + DataPropertyIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/FeederPublisher.html b/docs/cpp_API/FeederPublisher.html index 5779bee5..c4a0896a 100644 --- a/docs/cpp_API/FeederPublisher.html +++ b/docs/cpp_API/FeederPublisher.html @@ -1,7 +1,7 @@ - FeederPublisher Class (cpp) | Ontologenius 0.3.1 + FeederPublisher Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/IndividualClient.html b/docs/cpp_API/IndividualClient.html index ada67a9c..9843cfe5 100644 --- a/docs/cpp_API/IndividualClient.html +++ b/docs/cpp_API/IndividualClient.html @@ -1,7 +1,7 @@ - IndividualClient Class (cpp) | Ontologenius 0.3.1 + IndividualClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/IndividualIndexClient.html b/docs/cpp_API/IndividualIndexClient.html index 96e3fc75..559d4fce 100644 --- a/docs/cpp_API/IndividualIndexClient.html +++ b/docs/cpp_API/IndividualIndexClient.html @@ -1,7 +1,7 @@ - IndividualIndexClient Class (cpp) | Ontologenius 0.3.1 + IndividualIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ManagerClient.html b/docs/cpp_API/ManagerClient.html index b677b1e7..6e5f3ee7 100644 --- a/docs/cpp_API/ManagerClient.html +++ b/docs/cpp_API/ManagerClient.html @@ -1,7 +1,7 @@ - ManagerClient Class (cpp) | Ontologenius 0.3.1 + ManagerClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ObjectPropertyClient.html b/docs/cpp_API/ObjectPropertyClient.html index 85e4e023..c1116a02 100644 --- a/docs/cpp_API/ObjectPropertyClient.html +++ b/docs/cpp_API/ObjectPropertyClient.html @@ -1,7 +1,7 @@ - ObjectPropertyClient Class (cpp) | Ontologenius 0.3.1 + ObjectPropertyClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ObjectPropertyIndexClient.html b/docs/cpp_API/ObjectPropertyIndexClient.html index e15bdb28..c638486e 100644 --- a/docs/cpp_API/ObjectPropertyIndexClient.html +++ b/docs/cpp_API/ObjectPropertyIndexClient.html @@ -1,7 +1,7 @@ - ObjectPropertyIndexClient Class (cpp) | Ontologenius 0.3.1 + ObjectPropertyIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/OntologiesManipulator.html b/docs/cpp_API/OntologiesManipulator.html index bc59ee1b..0d82c77f 100644 --- a/docs/cpp_API/OntologiesManipulator.html +++ b/docs/cpp_API/OntologiesManipulator.html @@ -1,7 +1,7 @@ - OntologiesManipulator Class (cpp) | Ontologenius 0.3.1 + OntologiesManipulator Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/OntologyClient.html b/docs/cpp_API/OntologyClient.html index 90b63f38..d2a4150d 100644 --- a/docs/cpp_API/OntologyClient.html +++ b/docs/cpp_API/OntologyClient.html @@ -1,7 +1,7 @@ - OntologyClient Class (cpp) | Ontologenius 0.3.1 + OntologyClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/OntologyIndexClient.html b/docs/cpp_API/OntologyIndexClient.html index 0a5b44aa..0c1caf0d 100644 --- a/docs/cpp_API/OntologyIndexClient.html +++ b/docs/cpp_API/OntologyIndexClient.html @@ -1,7 +1,7 @@ - OntologyIndexClient Class (cpp) | Ontologenius 0.3.1 + OntologyIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/OntologyManipulator.html b/docs/cpp_API/OntologyManipulator.html index 237f8f03..dc0ff0a3 100644 --- a/docs/cpp_API/OntologyManipulator.html +++ b/docs/cpp_API/OntologyManipulator.html @@ -1,7 +1,7 @@ - OntologyManipulator Class (cpp) | Ontologenius 0.3.1 + OntologyManipulator Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/OntologyManipulatorIndex.html b/docs/cpp_API/OntologyManipulatorIndex.html index 7b4894d9..56991d90 100644 --- a/docs/cpp_API/OntologyManipulatorIndex.html +++ b/docs/cpp_API/OntologyManipulatorIndex.html @@ -1,7 +1,7 @@ - OntologyManipulatorIndex Class (cpp) | Ontologenius 0.3.1 + OntologyManipulatorIndex Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/ReasonerClient.html b/docs/cpp_API/ReasonerClient.html index b1659316..64cfea67 100644 --- a/docs/cpp_API/ReasonerClient.html +++ b/docs/cpp_API/ReasonerClient.html @@ -1,7 +1,7 @@ - ReasonerClient Class (cpp) | Ontologenius 0.3.1 + ReasonerClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/SparqlClient.html b/docs/cpp_API/SparqlClient.html index 9f931d8d..b6d9fdca 100644 --- a/docs/cpp_API/SparqlClient.html +++ b/docs/cpp_API/SparqlClient.html @@ -1,7 +1,7 @@ - SparqlClient Class (cpp) | Ontologenius 0.3.1 + SparqlClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_API/SparqlIndexClient.html b/docs/cpp_API/SparqlIndexClient.html index d642bc91..f04255b0 100644 --- a/docs/cpp_API/SparqlIndexClient.html +++ b/docs/cpp_API/SparqlIndexClient.html @@ -1,7 +1,7 @@ - SparqlIndexClient Class (cpp) | Ontologenius 0.3.1 + SparqlIndexClient Class (cpp) | Ontologenius 0.3.2 diff --git a/docs/cpp_Tutorials/Tutorials.html b/docs/cpp_Tutorials/Tutorials.html index e5c28724..da9edb25 100644 --- a/docs/cpp_Tutorials/Tutorials.html +++ b/docs/cpp_Tutorials/Tutorials.html @@ -1,7 +1,7 @@ - Cpp Tutorials | Ontologenius 0.3.1 + Cpp Tutorials | Ontologenius 0.3.2 diff --git a/docs/index.html b/docs/index.html index 90d6a842..37528429 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,7 +1,7 @@ - Ontologenius 0.3.1 + Ontologenius 0.3.2 @@ -101,7 +101,7 @@

A long-term semantic memory for robotic agents

@@ -158,7 +158,7 @@

What's New

-

Ontologenius 0.3.1 !

+

Ontologenius 0.3.2 !

Here is a great step, Ontologenius comes in its third major release! diff --git a/docs/overview/launchers.html b/docs/overview/launchers.html index a1775d0a..8508c96b 100644 --- a/docs/overview/launchers.html +++ b/docs/overview/launchers.html @@ -1,7 +1,7 @@ - Launchers | Ontologenius 0.3.1 + Launchers | Ontologenius 0.3.2 diff --git a/docs/overview/ontoloGUI.html b/docs/overview/ontoloGUI.html index fa166f14..cef5f129 100644 --- a/docs/overview/ontoloGUI.html +++ b/docs/overview/ontoloGUI.html @@ -1,7 +1,7 @@ - OntoloGUI | Ontologenius 0.3.1 + OntoloGUI | Ontologenius 0.3.2 diff --git a/docs/overview/reasonersConfiguration.html b/docs/overview/reasonersConfiguration.html index d024b730..0368f59d 100644 --- a/docs/overview/reasonersConfiguration.html +++ b/docs/overview/reasonersConfiguration.html @@ -1,7 +1,7 @@ - Reasoners configuration | Ontologenius 0.3.1 + Reasoners configuration | Ontologenius 0.3.2 diff --git a/docs/python_API/ActionClient.html b/docs/python_API/ActionClient.html index 443f1aeb..2d55e363 100644 --- a/docs/python_API/ActionClient.html +++ b/docs/python_API/ActionClient.html @@ -1,7 +1,7 @@ - ActionClient Class (python) | Ontologenius 0.3.1 + ActionClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ClassClient.html b/docs/python_API/ClassClient.html index ba97321e..faad5bde 100644 --- a/docs/python_API/ClassClient.html +++ b/docs/python_API/ClassClient.html @@ -1,7 +1,7 @@ - ClassClient Class (python) | Ontologenius 0.3.1 + ClassClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ClassIndexClient.html b/docs/python_API/ClassIndexClient.html index 7a7cd385..c8249272 100644 --- a/docs/python_API/ClassIndexClient.html +++ b/docs/python_API/ClassIndexClient.html @@ -1,7 +1,7 @@ - ClassIndexClient Class (python) | Ontologenius 0.3.1 + ClassIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ClientBase.html b/docs/python_API/ClientBase.html index 10213621..0374aaba 100644 --- a/docs/python_API/ClientBase.html +++ b/docs/python_API/ClientBase.html @@ -1,7 +1,7 @@ - ClientBase Class (python) | Ontologenius 0.3.1 + ClientBase Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ClientBaseIndex.html b/docs/python_API/ClientBaseIndex.html index dc111209..bd974810 100644 --- a/docs/python_API/ClientBaseIndex.html +++ b/docs/python_API/ClientBaseIndex.html @@ -1,7 +1,7 @@ - ClientBaseIndex Class (python) | Ontologenius 0.3.1 + ClientBaseIndex Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ConversionClient.html b/docs/python_API/ConversionClient.html index 19d04ddb..77fafb75 100644 --- a/docs/python_API/ConversionClient.html +++ b/docs/python_API/ConversionClient.html @@ -1,7 +1,7 @@ - ConversionClient Class (python) | Ontologenius 0.3.1 + ConversionClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/DataPropertyClient.html b/docs/python_API/DataPropertyClient.html index badb291d..0fb265aa 100644 --- a/docs/python_API/DataPropertyClient.html +++ b/docs/python_API/DataPropertyClient.html @@ -1,7 +1,7 @@ - DataPropertyClient Class (python) | Ontologenius 0.3.1 + DataPropertyClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/DataPropertyIndexClient.html b/docs/python_API/DataPropertyIndexClient.html index 3dffe37f..16c60e58 100644 --- a/docs/python_API/DataPropertyIndexClient.html +++ b/docs/python_API/DataPropertyIndexClient.html @@ -1,7 +1,7 @@ - DataPropertyIndexClient Class (python) | Ontologenius 0.3.1 + DataPropertyIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/FeederPublisher.html b/docs/python_API/FeederPublisher.html index 1f0a91b6..1b63dabd 100644 --- a/docs/python_API/FeederPublisher.html +++ b/docs/python_API/FeederPublisher.html @@ -1,7 +1,7 @@ - FeederPublisher Class (python) | Ontologenius 0.3.1 + FeederPublisher Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/IndividualClient.html b/docs/python_API/IndividualClient.html index f9bfd7c1..4d583fa2 100644 --- a/docs/python_API/IndividualClient.html +++ b/docs/python_API/IndividualClient.html @@ -1,7 +1,7 @@ - IndividualClient Class (python) | Ontologenius 0.3.1 + IndividualClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/IndividualIndexClient.html b/docs/python_API/IndividualIndexClient.html index de43fd7e..9ebf9f68 100644 --- a/docs/python_API/IndividualIndexClient.html +++ b/docs/python_API/IndividualIndexClient.html @@ -1,7 +1,7 @@ - IndividualIndexClient Class (python) | Ontologenius 0.3.1 + IndividualIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ManagerClient.html b/docs/python_API/ManagerClient.html index 592b9f56..99baffeb 100644 --- a/docs/python_API/ManagerClient.html +++ b/docs/python_API/ManagerClient.html @@ -1,7 +1,7 @@ - ManagerClient Class (python) | Ontologenius 0.3.1 + ManagerClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ObjectPropertyClient.html b/docs/python_API/ObjectPropertyClient.html index 108643b7..0430f01b 100644 --- a/docs/python_API/ObjectPropertyClient.html +++ b/docs/python_API/ObjectPropertyClient.html @@ -1,7 +1,7 @@ - ObjectPropertyClient Class (python) | Ontologenius 0.3.1 + ObjectPropertyClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ObjectPropertyIndexClient.html b/docs/python_API/ObjectPropertyIndexClient.html index 7b522011..cb129d74 100644 --- a/docs/python_API/ObjectPropertyIndexClient.html +++ b/docs/python_API/ObjectPropertyIndexClient.html @@ -1,7 +1,7 @@ - ObjectPropertyIndexClient Class (python) | Ontologenius 0.3.1 + ObjectPropertyIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/OntologiesManipulator.html b/docs/python_API/OntologiesManipulator.html index 6bd478ea..8442eb23 100644 --- a/docs/python_API/OntologiesManipulator.html +++ b/docs/python_API/OntologiesManipulator.html @@ -1,7 +1,7 @@ - OntologiesManipulator Class (python) | Ontologenius 0.3.1 + OntologiesManipulator Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/OntologyClient.html b/docs/python_API/OntologyClient.html index 50321074..c7ae2f60 100644 --- a/docs/python_API/OntologyClient.html +++ b/docs/python_API/OntologyClient.html @@ -1,7 +1,7 @@ - OntologyClient Class (python) | Ontologenius 0.3.1 + OntologyClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/OntologyIndexClient.html b/docs/python_API/OntologyIndexClient.html index b35e0252..717cdd7a 100644 --- a/docs/python_API/OntologyIndexClient.html +++ b/docs/python_API/OntologyIndexClient.html @@ -1,7 +1,7 @@ - OntologyIndexClient Class (python) | Ontologenius 0.3.1 + OntologyIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/OntologyManipulator.html b/docs/python_API/OntologyManipulator.html index e2ab7127..574f845e 100644 --- a/docs/python_API/OntologyManipulator.html +++ b/docs/python_API/OntologyManipulator.html @@ -1,7 +1,7 @@ - OntologyManipulator Class (python) | Ontologenius 0.3.1 + OntologyManipulator Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/OntologyManipulatorIndex.html b/docs/python_API/OntologyManipulatorIndex.html index 6a8f41a0..3ecf5b2c 100644 --- a/docs/python_API/OntologyManipulatorIndex.html +++ b/docs/python_API/OntologyManipulatorIndex.html @@ -1,7 +1,7 @@ - OntologyManipulatorIndex Class (python) | Ontologenius 0.3.1 + OntologyManipulatorIndex Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/PythonAPI.html b/docs/python_API/PythonAPI.html index bef1425c..2c91f8d9 100644 --- a/docs/python_API/PythonAPI.html +++ b/docs/python_API/PythonAPI.html @@ -1,7 +1,7 @@ - Python API (python) | Ontologenius 0.3.1 + Python API (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/ReasonerClient.html b/docs/python_API/ReasonerClient.html index 01468782..1bc668cf 100644 --- a/docs/python_API/ReasonerClient.html +++ b/docs/python_API/ReasonerClient.html @@ -1,7 +1,7 @@ - ReasonerClient Class (python) | Ontologenius 0.3.1 + ReasonerClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/SparqlClient.html b/docs/python_API/SparqlClient.html index dbe0772b..f7572f3d 100644 --- a/docs/python_API/SparqlClient.html +++ b/docs/python_API/SparqlClient.html @@ -1,7 +1,7 @@ - SparqlClient Class (python) | Ontologenius 0.3.1 + SparqlClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_API/SparqlIndexClient.html b/docs/python_API/SparqlIndexClient.html index 304ed64e..7d2b6d27 100644 --- a/docs/python_API/SparqlIndexClient.html +++ b/docs/python_API/SparqlIndexClient.html @@ -1,7 +1,7 @@ - SparqlIndexClient Class (python) | Ontologenius 0.3.1 + SparqlIndexClient Class (python) | Ontologenius 0.3.2 diff --git a/docs/python_Tutorials/Tutorials.html b/docs/python_Tutorials/Tutorials.html index ea78055d..6a53428d 100644 --- a/docs/python_Tutorials/Tutorials.html +++ b/docs/python_Tutorials/Tutorials.html @@ -1,7 +1,7 @@ - Python Tutorials | Ontologenius 0.3.1 + Python Tutorials | Ontologenius 0.3.2 diff --git a/package.xml b/package.xml index 04b087ad..798a0d1e 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ ontologenius - 0.3.1 + 0.3.2 The ontologenius package srth