#include <SWI-cpp.h>
#include "knowrob/reasoner/prolog/semweb.h"
#include "knowrob/reasoner/prolog/PrologReasoner.h"
#include "knowrob/reasoner/ReasonerManager.h"
#include "knowrob/semweb/ImportHierarchy.h"
#include "knowrob/semweb/OntologyFile.h"
#include "knowrob/URI.h"
Go to the source code of this file.
|
foreign_t | sw_current_graph3 (term_t t_manager, term_t t_reasoner, term_t t_graph) |
|
foreign_t | sw_set_current_graph3 (term_t t_manager, term_t t_reasoner, term_t t_graph) |
|
foreign_t | sw_unset_current_graph3 (term_t t_manager, term_t t_reasoner, term_t t_origin) |
|
foreign_t | sw_graph_add_direct_import4 (term_t t_manager, term_t t_reasoner, term_t t_importer, term_t t_imported) |
|
foreign_t | sw_graph_get_imports4 (term_t t_manager, term_t t_reasoner, term_t t_importer, term_t t_importedList) |
|
foreign_t | sw_set_default_graph3 (term_t t_manager, term_t t_reasoner, term_t t_graph) |
|
foreign_t | sw_default_graph3 (term_t t_manager, term_t t_reasoner, term_t t_graph) |
|
foreign_t | sw_origin_any1 (term_t t_origin) |
|
foreign_t | sw_origin_system1 (term_t t_origin) |
|
foreign_t | sw_origin_session1 (term_t t_origin) |
|
foreign_t | sw_origin_user1 (term_t t_origin) |
|
foreign_t | sw_origin_reasoner1 (term_t t_origin) |
|
foreign_t | sw_origin_test1 (term_t t_origin) |
|
foreign_t | sw_url_graph2 (term_t t_url, term_t t_graph) |
|
foreign_t | sw_url_version2 (term_t t_url, term_t t_version) |
|
foreign_t | sw_load_rdf_xml4 (term_t t_manager, term_t t_reasoner, term_t t_url, term_t t_parentGraph) |
|
◆ PL_SAFE_ARG_MACROS
#define PL_SAFE_ARG_MACROS |
◆ sw_current_graph3()
foreign_t sw_current_graph3 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_graph |
|
) |
| |
Definition at line 36 of file semweb.cpp.
37 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
40 if (hierarchy && PL_get_atom_chars(t_graph, &graph)) {
41 return hierarchy->isCurrentGraph(graph);
◆ sw_default_graph3()
foreign_t sw_default_graph3 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_graph |
|
) |
| |
Definition at line 109 of file semweb.cpp.
110 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
111 return hierarchy && PL_unify_atom_chars(t_graph, hierarchy->defaultGraph().c_str());
◆ sw_graph_add_direct_import4()
foreign_t sw_graph_add_direct_import4 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_importer, |
|
|
term_t |
t_imported |
|
) |
| |
Definition at line 71 of file semweb.cpp.
72 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
74 char *importer, *imported;
76 PL_get_atom_chars(t_importer, &importer) &&
77 PL_get_atom_chars(t_imported, &imported)) {
78 hierarchy->addDirectImport(importer, imported);
◆ sw_graph_get_imports4()
foreign_t sw_graph_get_imports4 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_importer, |
|
|
term_t |
t_importedList |
|
) |
| |
Definition at line 85 of file semweb.cpp.
86 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
88 if (hierarchy && PL_get_atom_chars(t_importer, &importer)) {
89 PlTail l(t_importedList);
90 for (
auto &x: hierarchy->getImports(importer))
91 l.append(x->name().c_str());
◆ sw_load_rdf_xml4()
foreign_t sw_load_rdf_xml4 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_url, |
|
|
term_t |
t_parentGraph |
|
) |
| |
Definition at line 156 of file semweb.cpp.
157 auto kb = getKnowledgeBase(t_manager, t_reasoner);
158 char *url, *parentGraph;
159 if (kb && PL_get_atom_chars(t_url, &url) && PL_get_atom_chars(t_parentGraph, &parentGraph)) {
160 URI ontologyURI(url);
161 auto ontologyFile = std::make_shared<OntologyFile>(kb->vocabulary(), ontologyURI,
"rdf-xml");
162 ontologyFile->setParentOrigin(parentGraph);
163 if (kb->loadDataSource(ontologyFile)) {
◆ sw_origin_any1()
foreign_t sw_origin_any1 |
( |
term_t |
t_origin | ) |
|
Definition at line 114 of file semweb.cpp.
115 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_ANY.data());
◆ sw_origin_reasoner1()
foreign_t sw_origin_reasoner1 |
( |
term_t |
t_origin | ) |
|
Definition at line 130 of file semweb.cpp.
131 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_REASONER.data());
◆ sw_origin_session1()
foreign_t sw_origin_session1 |
( |
term_t |
t_origin | ) |
|
Definition at line 122 of file semweb.cpp.
123 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_SESSION.data());
◆ sw_origin_system1()
foreign_t sw_origin_system1 |
( |
term_t |
t_origin | ) |
|
Definition at line 118 of file semweb.cpp.
119 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_SYSTEM.data());
◆ sw_origin_test1()
foreign_t sw_origin_test1 |
( |
term_t |
t_origin | ) |
|
Definition at line 134 of file semweb.cpp.
135 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_TEST.data());
◆ sw_origin_user1()
foreign_t sw_origin_user1 |
( |
term_t |
t_origin | ) |
|
Definition at line 126 of file semweb.cpp.
127 return PL_unify_atom_chars(t_origin, ImportHierarchy::ORIGIN_USER.data());
◆ sw_set_current_graph3()
foreign_t sw_set_current_graph3 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_graph |
|
) |
| |
Definition at line 47 of file semweb.cpp.
48 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
51 if (hierarchy && PL_get_atom_chars(t_graph, &graph)) {
52 hierarchy->addCurrentGraph(graph);
◆ sw_set_default_graph3()
foreign_t sw_set_default_graph3 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_graph |
|
) |
| |
Definition at line 98 of file semweb.cpp.
99 auto hierarchy = getImportHierarchy(t_manager, t_reasoner);
101 if (hierarchy && PL_get_atom_chars(t_graph, &graph)) {
102 hierarchy->setDefaultGraph(graph);
◆ sw_unset_current_graph3()
foreign_t sw_unset_current_graph3 |
( |
term_t |
t_manager, |
|
|
term_t |
t_reasoner, |
|
|
term_t |
t_origin |
|
) |
| |
Definition at line 59 of file semweb.cpp.
60 auto kb = getKnowledgeBase(t_manager, t_reasoner);
64 if (PL_get_atom_chars(t_origin, &origin)) {
65 return kb->removeAllWithOrigin(origin);
◆ sw_url_graph2()
foreign_t sw_url_graph2 |
( |
term_t |
t_url, |
|
|
term_t |
t_graph |
|
) |
| |
Definition at line 138 of file semweb.cpp.
140 if (PL_get_atom_chars(t_url, &url)) {
141 auto name = DataSource::getNameFromURI(url);
142 return PL_unify_atom_chars(t_graph, name.c_str());
◆ sw_url_version2()
foreign_t sw_url_version2 |
( |
term_t |
t_url, |
|
|
term_t |
t_version |
|
) |
| |
Definition at line 147 of file semweb.cpp.
149 if (PL_get_atom_chars(t_url, &url)) {
150 auto version = DataSource::getVersionFromURI(url);
151 return PL_unify_atom_chars(t_version, version.c_str());