summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp42
-rw-r--r--src/serialisation/Parser.hpp10
2 files changed, 37 insertions, 15 deletions
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: