]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.db/scl/Simantics/DB.scl
Use the same implementation to claim assertions in SCL and in Java
[simantics/platform.git] / bundles / org.simantics.scl.db / scl / Simantics / DB.scl
index adc72bb943e1cd0a788eaa4369be8deb10b36861..b69119eae0e345b65f153961cb289f85c752d63a 100644 (file)
@@ -250,13 +250,6 @@ importJava "org.simantics.db.WriteGraph" where
     @JavaName denyValue
     denyValue :: Resource -> <WriteGraph> ()
 
-claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()
-claimAssertion type_ predicate object = do
-    ass = newResource ()
-    claim ass L0.HasPredicate predicate
-    claim ass L0.HasObject object
-    claim type_ L0.Asserts ass
-
 "Sets the value of the literal that is an object with the given subject and predicate."
 @inline
 claimRelatedValue :: Serializable a => Resource -> Resource -> a -> <WriteGraph> ()
@@ -305,26 +298,35 @@ importJava "org.simantics.db.common.utils.OrderedSetUtils" where
     elementsOfOrderedSet :: Resource -> <ReadGraph> [Resource]
     
 importJava "org.simantics.db.common.utils.ListUtils" where
+    "`elementsOfList l` returns elements of list `l`"
     @JavaName toList
     elementsOfList :: Resource -> <ReadGraph> [Resource]
     
+    "`createList [e]` creates a new list containing elements `[e]`"
     @JavaName create
     createList :: [Resource] -> <WriteGraph> Resource
 
+    "`createListWithType t [e]` creates a new list with type `t` containing elements `[e]`"
     @JavaName create
     createListWithType :: Resource -> [Resource] -> <WriteGraph> Resource
     
-    @javaName insertBack
-    insertBack :: Resource -> [Resource] -> <WriteGraph> ()
+    "`insertListBack l [e]` inserts elements `[e]` back to the list `l`"
+    @JavaName insertBack
+    insertListBack :: Resource -> [Resource] -> <WriteGraph> ()
+    
+    "`insertListFront l [e]` inserts elements `[e]` front of the list `l`"
+    @JavaName insertFront
+    insertListFront :: Resource -> [Resource] -> <WriteGraph> ()
     
-    @javaName removeElement
-    removeElement :: Resource -> Resource -> <WriteGraph> Boolean
+    "`removeListElement l e` removes a element `e` from the list `l`"
+    @JavaName removeElement
+    removeListElement :: Resource -> Resource -> <WriteGraph> Boolean
     
-    @javaName swapWithPrevious
-    swapWithPrevious :: Resource -> Resource -> <WriteGraph> Boolean
+    @JavaName swapWithPrevious
+    swapListElementWithPrevious :: Resource -> Resource -> <WriteGraph> Boolean
 
-    @javaName swapWithNext
-    swapWithNext :: Resource -> Resource -> <WriteGraph> Boolean
+    @JavaName swapWithNext
+    swapListElementWithNext :: Resource -> Resource -> <WriteGraph> Boolean
 
 
 importJava "org.simantics.db.common.utils.CommonDBUtils" where
@@ -406,6 +408,9 @@ importJava "org.simantics.db.layer0.util.Layer0Utils" where
     addMetadataListener :: ChangeListener -> <Proc> ()
     removeMetadataListener :: ChangeListener -> <Proc> ()
 
+    @JavaName assert_
+    claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()
+
 copyTo :: Resource -> Resource -> <WriteGraph> Resource
 copyTo targetContainer source = do
     (collectionToList $ copyTo_ targetContainer source)!0