summaryrefslogtreecommitdiffstats
path: root/src/shared/ResourceImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/ResourceImpl.cpp')
-rw-r--r--src/shared/ResourceImpl.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp
index d315b8f0..14227ccf 100644
--- a/src/shared/ResourceImpl.cpp
+++ b/src/shared/ResourceImpl.cpp
@@ -40,10 +40,20 @@ ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value)
}
Raul::Atom&
-ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value)
+ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value,
+ Resource::Graph ctx)
{
- _properties.erase(uri);
- return _properties.insert(make_pair(uri, value))->second;
+ // Erase existing property in this context
+ for (Properties::iterator i = _properties.find(uri);
+ (i != _properties.end()) && (i->first == uri);
+ ++i) {
+ if (i->second.context() == ctx && i->second == value) {
+ _properties.erase(i);
+ }
+ }
+
+ // Insert new property
+ return _properties.insert(make_pair(uri, Property(value, ctx)))->second;
}
void