]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Use known literal type when applying value changes 28/4628/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 16 Dec 2020 11:36:14 +0000 (13:36 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 16 Dec 2020 11:36:14 +0000 (13:36 +0200)
gitlab #29

Change-Id: Ica832ca495f46286b83e34c372731c8a1d6d2864

org.simantics.interop.update/src/org/simantics/interop/update/model/PropertyChange.java

index be6e5e0bbda38498fd22388d6dc6e2ed31dd4b45..d1a64afb9843a71bd5cba32edcbc815ac16ead21 100644 (file)
@@ -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);
                        }