knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
OntologyLanguage.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #include <unordered_map>
7 #include "knowrob/semweb/OntologyLanguage.h"
8 
9 static const std::unordered_map<std::string_view, knowrob::semweb::OntologyLanguage> stringToMap = {
14 };
15 
16 namespace knowrob::semweb {
17  bool isOntologyLanguageString(std::string_view format) {
18  auto it = stringToMap.find(format);
19  return (it != stringToMap.end());
20  }
21 
22  OntologyLanguage ontologyLanguageFromString(std::string_view format) {
23  auto it = stringToMap.find(format);
24  if (it != stringToMap.end()) {
25  return it->second;
26  }
27  return OntologyLanguage::OWL;
28  }
29 
30  std::string_view ontologyLanguageToString(OntologyLanguage format) {
31  switch (format) {
33  return "RDFS";
35  return "OWL";
36  }
37  return "OWL";
38  }
39 }
std::string_view ontologyLanguageToString(OntologyLanguage format)
bool isOntologyLanguageString(std::string_view format)
OntologyLanguage ontologyLanguageFromString(std::string_view format)