]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.db/scl/Simantics/DB.scl
Property following functions value and possibleValue to ontology modules
[simantics/platform.git] / bundles / org.simantics.scl.db / scl / Simantics / DB.scl
index a400659ee0c940b18b129fadf0f9a572e1ff643d..b8dd21bb21f4cb9f0cf95de02180d95e95769ecd 100644 (file)
@@ -108,6 +108,9 @@ importJava "org.simantics.db.ReadGraph" where
     @JavaName getRelatedValue2
     relatedValue2 :: Resource -> Resource -> <ReadGraph> a
 
+    @JavaName getPossibleRelatedValue2
+    possibleRelatedValue2 :: Resource -> Resource -> <ReadGraph> Maybe a
+
     @JavaName getRelatedVariantValue2
     relatedVariantValue2 :: Resource -> Resource -> <ReadGraph> Variant
     
@@ -187,6 +190,9 @@ class Browsable a where
     
     valueOf :: Serializable v => a -> <ReadGraph> v
     
+    genericRelatedValue :: a -> Resource -> <ReadGraph> t
+    genericPossibleRelatedValue :: a -> Resource -> <ReadGraph> Maybe t
+    
     variantValueOf :: a -> <ReadGraph> Variant 
     
     children :: a -> <ReadGraph> [a]
@@ -206,6 +212,9 @@ instance Browsable Resource where
     valueOf r = valueOf_ r binding
     variantValueOf = variantValueOf_
     
+    genericRelatedValue = relatedValue2
+    genericPossibleRelatedValue = possibleRelatedValue2
+    
     children r = r # L0.ConsistsOf
     parent r = singleObject r L0.PartOf
     possibleParent r = possibleObject r L0.PartOf
@@ -279,26 +288,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