From dfc8a81f3aa70e2248b40867e1e897b197492210 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 15 Feb 2011 23:00:35 +0000 Subject: Trim more redlandmm API. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2952 a436a847-0d15-0410-975c-d299462d15a1 --- src/serialisation/Parser.cpp | 27 ++++++++++++--------------- src/serialisation/Serialiser.cpp | 7 ++----- 2 files changed, 14 insertions(+), 20 deletions(-) (limited to 'src/serialisation') diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 016d1804..d67f94f7 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -24,7 +24,6 @@ #include "raul/log.hpp" #include "redlandmm/Model.hpp" #include "redlandmm/Node.hpp" -#include "redlandmm/Query.hpp" #include "raul/TableImpl.hpp" #include "raul/Atom.hpp" #include "raul/AtomRDF.hpp" @@ -85,7 +84,9 @@ Parser::find_patches( Ingen::Shared::World* world, const Glib::ustring& manifest_uri) { - Redland::Model model(*world->rdf_world(), manifest_uri, manifest_uri); + //Redland::Model model(*world->rdf_world(), manifest_uri, manifest_uri); + Redland::Model model(*world->rdf_world(), manifest_uri); + model.load_file(manifest_uri); Redland::Resource rdf_type(*world->rdf_world(), NS_RDF "type"); Redland::Resource rdfs_seeAlso(*world->rdf_world(), NS_RDFS "seeAlso"); @@ -138,7 +139,8 @@ Parser::parse_document( document_uri += basename + INGEN_PATCH_FILE_EXT; } - Redland::Model model(*world->rdf_world(), document_uri, document_uri); + Redland::Model model(*world->rdf_world(), document_uri); + model.load_file(document_uri); LOG(info) << "Parsing " << document_uri << endl; if (data_path) @@ -173,7 +175,8 @@ Parser::parse_string( boost::optional symbol, boost::optional data) { - Redland::Model model(*world->rdf_world(), str.c_str(), str.length(), base_uri); + Redland::Model model(*world->rdf_world(), base_uri); + model.load_string(str.c_str(), str.length(), base_uri); LOG(info) << "Parsing " << (data_path ? data_path->str() : "*") << " from string"; if (!base_uri.empty()) @@ -310,8 +313,6 @@ Parser::parse( || (rdf_class == in_port_class) || (rdf_class == out_port_class); - const Glib::ustring subject_uri_tok = Glib::ustring("<").append(subject).append(">"); - if (is_object) { if (path_str.empty() || path_str[0] != '/') path_str = "/" + path_str; @@ -350,7 +351,7 @@ Parser::parse( } else if (is_plugin) { string subject_str = subject.to_string(); if (URI::is_valid(subject_str)) { - if (subject == document_uri) + if (subject_str == document_uri) subject_str = Path::root().str(); parse_properties(world, target, model, subject, subject_str); } @@ -374,8 +375,6 @@ Parser::parse_patch( { const LV2URIMap& uris = *world->uris().get(); - typedef Redland::QueryResults Results; - Redland::Resource ingen_polyphony(*world->rdf_world(), NS_INGEN "polyphony"); Redland::Resource lv2_port(*world->rdf_world(), NS_LV2 "port"); Redland::Resource lv2_symbol(*world->rdf_world(), NS_LV2 "symbol"); @@ -442,8 +441,6 @@ Parser::parse_patch( typedef map Objects; typedef map Types; - SharedPtr results; - Objects patch_nodes; Objects plugin_nodes; Resources resources; @@ -462,7 +459,7 @@ Parser::parse_patch( const Redland::Node& object = np.get_object(); if (!skip_property(predicate)) { node_properties.insert( - make_pair(predicate, + make_pair(predicate.to_string(), AtomRDF::node_to_atom(model, object))); } } @@ -483,7 +480,7 @@ Parser::parse_patch( const Redland::Node& object = pp.get_object(); if (!skip_property(predicate)) { port_properties.insert( - make_pair(predicate, + make_pair(predicate.to_string(), AtomRDF::node_to_atom(model, object))); } } @@ -512,7 +509,7 @@ Parser::parse_patch( const Redland::Node& object = pp.get_object(); if (!skip_property(predicate)) { port_properties.insert( - make_pair(predicate, + make_pair(predicate.to_string(), AtomRDF::node_to_atom(model, object))); } } @@ -660,7 +657,7 @@ Parser::parse_properties( const Redland::Node& key = i.get_predicate(); const Redland::Node& val = i.get_object(); if (!skip_property(key)) { - properties.insert(make_pair(string(key), + properties.insert(make_pair(key.to_string(), AtomRDF::node_to_atom(model, val))); } } diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index bc6b317a..b3541bd3 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -106,7 +106,6 @@ Serialiser::write_manifest(const std::string& bundle_uri, const string bundle_path(Glib::filename_from_uri(bundle_uri)); const string filename(Glib::build_filename(bundle_path, "manifest.ttl")); start_to_filename(filename); - _model->set_base_uri(bundle_uri); for (Records::const_iterator i = records.begin(); i != records.end(); ++i) { SharedPtr patch = PtrCast(i->object); if (patch) { @@ -187,8 +186,7 @@ Serialiser::start_to_filename(const string& filename) _base_uri = "file://" + filename; else _base_uri = filename; - _model = new Redland::Model(*_world.rdf_world()); - _model->set_base_uri(_base_uri); + _model = new Redland::Model(*_world.rdf_world(), _base_uri); _mode = TO_FILE; } @@ -210,8 +208,7 @@ Serialiser::start_to_string(const Raul::Path& root, const string& base_uri) _root_path = root; _base_uri = base_uri; - _model = new Redland::Model(*_world.rdf_world()); - _model->set_base_uri(base_uri); + _model = new Redland::Model(*_world.rdf_world(), base_uri); _mode = TO_STRING; } -- cgit v1.2.1