]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Allow copying enumerated properties. 31/4631/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 17 Dec 2020 15:01:40 +0000 (17:01 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 17 Dec 2020 15:01:40 +0000 (17:01 +0200)
gitlab #25

Change-Id: I7b662d2146211f25205177bcc3c067c1e98d4c91

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

index 3f4b6bfdad3dc95464e496aff1b7d4b9326b9428..a5058647379f65c182f7a97272a1bd27e3ad1ac4 100644 (file)
@@ -87,7 +87,13 @@ public abstract class AddDeleteUpdateOp extends UpdateOp {
                                g.claim(destination, s.getPredicate(), valueResource);
                                copyProperties(g, s.getObject(), valueResource);
                        } else {
-                               throw new DatabaseException("Expected to copy property resource " + s.getObject());
+                               Resource type = g.getPossibleType(s.getObject(), l0.Value);
+                               if (type != null && g.hasStatement(type, l0.Enumeration, type)) {
+                                       g.deny(destination, s.getPredicate());
+                                       g.claim(destination, s.getPredicate(), s.getObject());
+                               } else {
+                                       throw new DatabaseException("Expected to copy property resource " + s.getObject());
+                               }
                        }
                }
        }