8 #include "knowrob/semweb/OntologyFile.h"
9 #include "knowrob/Logger.h"
10 #include "knowrob/semweb/OntologyParser.h"
16 vocabulary_(std::move(vocabulary)),
27 auto external_path = std::filesystem::path(
"owl") /
"external" /
28 std::filesystem::path(resolved).filename();
29 auto knowrob_path = std::filesystem::path(
"owl") /
30 std::filesystem::path(resolved).filename();
31 auto external_p = std::filesystem::path(
URI::resolve(external_path.u8string()));
32 auto knowrob_p = std::filesystem::path(
URI::resolve(knowrob_path.u8string()));
34 if (exists(external_p)) {
35 KB_DEBUG(
"Using downloaded ontology at '{}'.", external_p.u8string());
36 importURI = &external_p.native();
37 }
else if (exists(knowrob_p)) {
38 KB_DEBUG(
"Using built-in ontology at '{}'.", knowrob_p.u8string());
39 importURI = &knowrob_p.native();
41 importURI = &resolved;
44 KB_INFO(
"Loading ontology at '{}' with version "
45 "\"{}\" and origin \"{}\".", *importURI, newVersion,
origin_);
60 KB_WARN(
"Failed to parse ontology {} ({})", *importURI,
uri());
static std::string getVersionFromURI(const std::string &uriString)
OntologyFile(VocabularyPtr vocabulary, const URI &uri, std::string_view format)
semweb::TripleFormat tripleFormat() const
VocabularyPtr vocabulary_
bool load(const TripleHandler &callback) override
bool run(const TripleHandler &callback)
void setFrame(const GraphSelectorPtr &frame)
void setOrigin(std::string_view origin)
void setBlankPrefix(const std::string_view &blankPrefix)
void setFilter(const TripleFilter &filter)
const auto & frame() const
void setImports(const std::vector< std::string > &imports)
virtual std::string_view predicate() const =0
static std::string resolve(const std::string_view &uriString)
TripleFormat tripleFormatFromString(std::string_view format)
std::shared_ptr< TripleContainer > TripleContainerPtr
std::function< void(const TripleContainerPtr &)> TripleHandler
std::shared_ptr< Vocabulary > VocabularyPtr