summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/HTTPClientReceiver.cpp2
-rw-r--r--src/serialisation/Parser.cpp42
-rw-r--r--src/serialisation/Parser.hpp10
3 files changed, 38 insertions, 16 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index dcb105b0..cee7eac4 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -97,7 +97,7 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::
void
HTTPClientReceiver::update(const std::string& str)
{
- cout << _parser->parse_string(_world, _target.get(), str, "/", "/");
+ cout << _parser->parse_update(_world, _target.get(), str, "/", "/");
}
void
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 0591e0f8..9d5007e4 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -109,25 +109,20 @@ Parser::parse_string(
bool
-Parser::parse(
+Parser::parse_update(
Ingen::Shared::World* world,
- Ingen::Shared::CommonInterface* target,
- Redland::Model& model,
- Glib::ustring base_uri,
+ Shared::CommonInterface* target,
+ const Glib::ustring& str,
+ const Glib::ustring& base_uri,
Glib::ustring engine_base,
boost::optional<Glib::ustring> object_uri,
boost::optional<Raul::Symbol> symbol,
boost::optional<GraphObject::Variables> data)
{
- const Redland::Node::Type res = Redland::Node::RESOURCE;
- Glib::ustring query_str;
- if (object_uri && object_uri.get()[0] == '/')
- object_uri = object_uri.get().substr(1);
-
- /* **** First query out global information (top-level info) **** */
-
+ Redland::Model model(*world->rdf_world, str.c_str(), str.length(), base_uri);
+
// Delete anything explicitly declared to not exist
- query_str = Glib::ustring("SELECT DISTINCT ?o WHERE { ?o a owl:Nothing }");
+ Glib::ustring query_str = Glib::ustring("SELECT DISTINCT ?o WHERE { ?o a owl:Nothing }");
Redland::Query query(*world->rdf_world, query_str);
Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri);
@@ -173,16 +168,33 @@ Parser::parse(
}
world->rdf_world->mutex().unlock();
+ return parse(world, target, model, base_uri, engine_base, object_uri, symbol, data);
+}
+
- /* **** Now query out objects **** */
+bool
+Parser::parse(
+ Ingen::Shared::World* world,
+ Ingen::Shared::CommonInterface* target,
+ Redland::Model& model,
+ Glib::ustring base_uri,
+ Glib::ustring engine_base,
+ boost::optional<Glib::ustring> object_uri,
+ boost::optional<Raul::Symbol> symbol,
+ boost::optional<GraphObject::Variables> data)
+{
+ const Redland::Node::Type res = Redland::Node::RESOURCE;
+ Glib::ustring query_str;
+ if (object_uri && object_uri.get()[0] == '/')
+ object_uri = object_uri.get().substr(1);
if (object_uri)
query_str = Glib::ustring("SELECT DISTINCT ?class WHERE { <") + object_uri.get() + "> a ?class . }";
else
query_str = Glib::ustring("SELECT DISTINCT ?subject ?class WHERE { ?subject a ?class . }");
- query = Redland::Query(*world->rdf_world, query_str);
- results = Redland::Query::Results(query.run(*world->rdf_world, model, base_uri));
+ Redland::Query query(*world->rdf_world, query_str);
+ Redland::Query::Results results(query.run(*world->rdf_world, model, base_uri));
const Redland::Node patch_class(*world->rdf_world, res, NS_INGEN "Patch");
const Redland::Node node_class(*world->rdf_world, res, NS_INGEN "Node");
diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp
index d20e4345..0210a4bb 100644
--- a/src/serialisation/Parser.hpp
+++ b/src/serialisation/Parser.hpp
@@ -58,6 +58,16 @@ public:
boost::optional<Glib::ustring> object_uri=boost::optional<Glib::ustring>(),
boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
+
+ virtual bool parse_update(
+ Ingen::Shared::World* world,
+ Shared::CommonInterface* target,
+ const Glib::ustring& str,
+ const Glib::ustring& base_uri,
+ Glib::ustring engine_base,
+ boost::optional<Glib::ustring> object_uri=boost::optional<Glib::ustring>(),
+ boost::optional<Raul::Symbol> symbol=boost::optional<Raul::Symbol>(),
+ boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>());
private: