aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/Node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/Node.cpp')
-rw-r--r--src/engine/Node.cpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index 3d13df4..8ee92e7 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -70,7 +70,7 @@ Node::random_edge()
// FIXME: O(n) worst case :(
for (Edges::const_iterator e = _edges.begin(); e != _edges.end(); ++e,
- --i) {
+ --i) {
if (i == 0) {
ret = *e;
break;
@@ -222,36 +222,31 @@ Node::write_state(Sord::Model& model)
if (_is_selector)
model.add_statement(
- rdf_id,
- Sord::Curie(model.world(), "rdf:type"),
- Sord::Curie(model.world(), "machina:SelectorNode"));
+ rdf_id,
+ Sord::URI(model.world(), MACHINA_URI_RDF "type"),
+ Sord::URI(model.world(), MACHINA_NS_SelectorNode));
else
model.add_statement(
- rdf_id,
- Sord::Curie(model.world(), "rdf:type"),
- Sord::Curie(model.world(), "machina:Node"));
-
- std::cerr << "ATOMRDF" << std::endl;
- /*
- model.add_statement(
- rdf_id,
- Sord::Curie(model.world(), "machina:duration"),
- AtomRDF::atom_to_node(model, Atom((float)_duration.to_double())));
- */
+ rdf_id,
+ Sord::URI(model.world(), MACHINA_URI_RDF "type"),
+ Sord::URI(model.world(), MACHINA_NS_Node));
- if (_enter_action) {
- _enter_action->write_state(model);
+ model.add_statement(
+ rdf_id,
+ Sord::URI(model.world(), MACHINA_NS_duration),
+ Sord::Literal::decimal(model.world(), _duration.to_double(), 7));
- model.add_statement(rdf_id,
- Sord::Curie(model.world(), "machina:enterAction"),
- _enter_action->rdf_id(model.world()));
+ if (_enter_action) {
+ _enter_action->write_state(model);
+ model.add_statement(rdf_id,
+ Sord::URI(model.world(), MACHINA_NS_onEnter),
+ _enter_action->rdf_id(model.world()));
}
if (_exit_action) {
_exit_action->write_state(model);
-
model.add_statement(rdf_id,
- Sord::Curie(model.world(), "machina:exitAction"),
+ Sord::URI(model.world(), MACHINA_NS_onExit),
_exit_action->rdf_id(model.world()));
}
}