diff options
author | David Robillard <d@drobilla.net> | 2010-12-22 02:16:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-22 02:16:39 +0000 |
commit | 731274226c322192ccec35fb893f594e9bd69a88 (patch) | |
tree | 044e35fd4897fd6a0f7987a71c9fbe3adc3bc00e /src/engine/Edge.cpp | |
parent | 3d68bae339ee6f1285fc66d8192ea704708847f7 (diff) | |
download | machina-731274226c322192ccec35fb893f594e9bd69a88.tar.gz machina-731274226c322192ccec35fb893f594e9bd69a88.tar.bz2 machina-731274226c322192ccec35fb893f594e9bd69a88.zip |
Assign all objects a numeric ID at creation time.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@2778 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/Edge.cpp')
-rw-r--r-- | src/engine/Edge.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp index d8f64d6..d2c628f 100644 --- a/src/engine/Edge.cpp +++ b/src/engine/Edge.cpp @@ -30,12 +30,12 @@ Edge::write_state(Redland::Model& model) { using namespace Raul; - if (!_id.is_valid()) - set_id(Redland::Node::blank_id(model.world())); - - model.add_statement(_id, - "rdf:type", - Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Edge")); + const Redland::Node& rdf_id = id(model.world()); + + model.add_statement( + rdf_id, + "rdf:type", + Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:Edge")); SharedPtr<Node> tail = _tail.lock(); SharedPtr<Node> head = _head; @@ -43,19 +43,20 @@ Edge::write_state(Redland::Model& model) if (!tail || !head) return; - assert(tail->id() && head->id()); + assert(tail->id(model.world()) && head->id(model.world())); - model.add_statement(_id, - "machina:tail", - tail->id()); + model.add_statement(rdf_id, + "machina:tail", + tail->id(model.world())); - model.add_statement(_id, - "machina:head", - head->id()); + model.add_statement(rdf_id, + "machina:head", + head->id(model.world())); - model.add_statement(_id, - "machina:probability", - AtomRDF::atom_to_node(model, Atom(_probability.get()))); + model.add_statement( + rdf_id, + "machina:probability", + AtomRDF::atom_to_node(model, Atom(_probability.get()))); } |