diff --git a/src/ROSInterface.cpp b/src/ROSInterface.cpp index a5591aa..992efa1 100644 --- a/src/ROSInterface.cpp +++ b/src/ROSInterface.cpp @@ -41,6 +41,8 @@ ROSInterface::ROSInterface(const boost::property_tree::ptree &config) this, _1), false), tell_action_server_(nh_, "knowrob/tell", boost::bind(&ROSInterface::executeTellCB, this, _1), false), kb_(KnowledgeBase::create(config)) { + + // Start all action servers askall_action_server_.start(); askone_action_server_.start(); @@ -349,7 +351,17 @@ void ROSInterface::executeTellCB(const TellGoalConstPtr &goal) { bool ROSInterface::executeExportCB(ExportTriples::Request &req, ExportTriples::Response &res) { - kb_->exportTo(req.path); + // If req.format is empty or rdfxml + if (req.format == "rdfxml") { + kb_->exportTo(req.path, semweb::RDF_XML); + } else if (req.format == "turtle") { + kb_->exportTo(req.path, semweb::TURTLE); + } else { + // If the format is not supported, return false + ROS_ERROR("Export format not supported: %s", req.format.c_str()); + res.success = false; + return false; + } res.success = true; return true; } @@ -358,9 +370,16 @@ int main(int argc, char **argv) { InitKnowRob(argc, argv); // Load settings files + boost::property_tree::ptree config = InterfaceUtils::loadSettings(); + // configure logging + auto log_config = config.get_child_optional("logging"); + if (log_config) { + Logger::loadConfiguration(log_config.value()); + } + try { ros::init(argc, argv, "knowrob_node"); - ROSInterface ros_interface(InterfaceUtils::loadSettings()); + ROSInterface ros_interface(config); KB_INFO("[KnowRob] ROS node started."); ros::spin(); } diff --git a/srv/ExportTriples.srv b/srv/ExportTriples.srv index 081c2c1..3425361 100644 --- a/srv/ExportTriples.srv +++ b/srv/ExportTriples.srv @@ -1,4 +1,5 @@ string path +string format # 'turtle' or 'rdfxml' --- # The result of the query bool success \ No newline at end of file