From: Marko Luukkainen Date: Wed, 16 Dec 2020 11:36:14 +0000 (+0200) Subject: Use known literal type when applying value changes X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=28413fd27e56ea8b5018ce5a11b1fd132d5425d7;p=simantics%2Finterop.git Use known literal type when applying value changes gitlab #29 Change-Id: Ica832ca495f46286b83e34c372731c8a1d6d2864 --- diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java index be6e5e0..d1a64af 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java @@ -103,18 +103,24 @@ public class PropertyChange { Resource s = leftSubject; if (graph.isInstanceOf(pair.second.getObject(), L0.Literal)) { Object value = null; + Resource type = null; if (customValue != null) value = customValue; else if (graph.hasValue(pair.second.getObject())) { value = graph.getValue(pair.second.getObject()); } + type = graph.getPossibleType(pair.second.getObject(), L0.Literal); Resource pred = pair.second.getPredicate(); if (getChanges().getComparable().containsRight(pred)) pred = getChanges().getComparable().getLeft(pred); if (value != null) { graph.deny(s, pred); - graph.claimLiteral(s, pred, value); + if (type != null) { + graph.claimLiteral(s, pred, type, value); + } else { + graph.claimLiteral(s, pred, value); + } } else { graph.deny(s,pred); }