diff options
author | David Robillard <d@drobilla.net> | 2008-11-16 21:49:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-11-16 21:49:33 +0000 |
commit | 481df972552977a1331f9eb70bb6dce55429475c (patch) | |
tree | 63eb6155345919d8378f89c116cb08b32b35b5c3 | |
parent | f30290370005de12e5061716c5508fc3e552a0ce (diff) | |
download | ingen-481df972552977a1331f9eb70bb6dce55429475c.tar.gz ingen-481df972552977a1331f9eb70bb6dce55429475c.tar.bz2 ingen-481df972552977a1331f9eb70bb6dce55429475c.zip |
Fix loading errors.
Partially separate 'update' from parsing from object (i.e. patch file loading) parsing.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1736 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/client/HTTPClientReceiver.cpp | 2 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 42 | ||||
-rw-r--r-- | src/serialisation/Parser.hpp | 10 |
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: |