/* This file is part of Machina. * Copyright 2007-2011 David Robillard * * Machina is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Machina is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Machina. If not, see . */ #include "raul/Atom.hpp" #include "raul/AtomRDF.hpp" #include "sord/sordmm.hpp" #include "Edge.hpp" #include "Node.hpp" namespace Machina { void Edge::set(URIInt key, const Raul::Atom& value) { std::cout << "EDGE SET " << key << " = " << value << std::endl; } void Edge::write_state(Sord::Model& model) { using namespace Raul; const Sord::Node& rdf_id = this->rdf_id(model.world()); model.add_statement( rdf_id, Sord::Curie(model.world(), "rdf:type"), Sord::Curie(model.world(), "machina:Edge")); SharedPtr tail = _tail.lock(); SharedPtr head = _head; if (!tail || !head) return; assert(tail->rdf_id(model.world()).is_valid() && head->rdf_id(model.world()).is_valid()); model.add_statement(rdf_id, Sord::Curie(model.world(), "machina:tail"), tail->rdf_id(model.world())); model.add_statement(rdf_id, Sord::Curie(model.world(), "machina:head"), head->rdf_id(model.world())); model.add_statement( rdf_id, Sord::Curie(model.world(), "machina:probability"), AtomRDF::atom_to_node(model, Atom(_probability.get()))); } } // namespace Machina