knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
PrologEngine.cpp File Reference
#include <SWI-Prolog.h>
#include <filesystem>
#include <clocale>
#include <cstdlib>
#include "knowrob/Logger.h"
#include "knowrob/integration/prolog/PrologEngine.h"
#include "knowrob/knowrob.h"
#include "knowrob/queries/QueryError.h"
#include "knowrob/integration/prolog/logging.h"
#include "knowrob/integration/prolog/ext/algebra.h"
#include "knowrob/semweb/PrefixRegistry.h"
#include "knowrob/URI.h"
#include "knowrob/reasoner/prolog/semweb.h"
Include dependency graph for PrologEngine.cpp:

Go to the source code of this file.

Functions

foreign_t pl_rdf_register_namespace2 (term_t prefix_term, term_t uri_term)
 
foreign_t url_resolve2 (term_t t_url, term_t t_resolved)
 

Function Documentation

◆ pl_rdf_register_namespace2()

foreign_t pl_rdf_register_namespace2 ( term_t  prefix_term,
term_t  uri_term 
)

Definition at line 55 of file PrologEngine.cpp.

55  {
56  char *prefix, *uri;
57  if (PL_get_atom_chars(prefix_term, &prefix) && PL_get_atom_chars(uri_term, &uri)) {
58  PrefixRegistry::registerPrefix(prefix, uri);
59  }
60  return TRUE;
61 }
constexpr std::string_view prefix
Definition: owl.h:14

◆ url_resolve2()

foreign_t url_resolve2 ( term_t  t_url,
term_t  t_resolved 
)

Definition at line 63 of file PrologEngine.cpp.

63  {
64  char *url;
65  if (PL_get_atom_chars(t_url, &url)) {
66  auto resolved = URI::resolve(url);
67  return PL_unify_atom_chars(t_resolved, resolved.c_str());
68  }
69  return false;
70 }