]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.db/scl/Simantics/DB.scl
New type class MonadE and corresponding monad syntax with edo keyword
[simantics/platform.git] / bundles / org.simantics.scl.db / scl / Simantics / DB.scl
index 54696a83d12a0936d5fa7300c98c5d963f6231f4..b24df17f8639c40cb2a020f130a911e8bf547912 100644 (file)
@@ -43,6 +43,8 @@ importJava "org.simantics.db.Statement" where
     @JavaName getObject
     objectOf :: Statement -> Resource
     
+    isAsserted :: Statement -> Resource -> <ReadGraph> Boolean
+    
 importJava "org.simantics.db.ReadGraph" where
     "Converts an absolute URI to a resource or returns `Nothing` if there is no such resource."
     @JavaName getPossibleResource
@@ -85,6 +87,9 @@ importJava "org.simantics.db.ReadGraph" where
     @JavaName getSingleStatement
     singleStatement :: Resource -> Resource -> <ReadGraph> Statement
 
+    @JavaName getPossibleStatement
+    possibleStatement :: Resource -> Resource -> <ReadGraph> Maybe Statement
+
     @JavaName getRelatedVariantValue
     relatedVariantValue :: Resource -> Resource -> <ReadGraph> Variant
 
@@ -135,6 +140,9 @@ importJava "org.simantics.db.ReadGraph" where
     isInheritedFrom :: Resource -> Resource -> <ReadGraph> Boolean
     
     getRootLibrary :: () -> <ReadGraph> Resource
+    
+    @JavaName getPredicates
+    predicatesOf :: Resource -> <ReadGraph> [Resource]
 
 importJava "org.simantics.db.layer0.util.ExtendedUris" where
     "Converts an absolute URI to a resource"
@@ -260,6 +268,9 @@ importJava "org.simantics.db.common.utils.ListUtils" where
     
     @JavaName create
     createList :: [Resource] -> <WriteGraph> Resource
+
+    @JavaName create
+    createListWithType :: Resource -> [Resource] -> <WriteGraph> Resource
     
     @javaName insertBack
     insertBack :: Resource -> [Resource] -> <WriteGraph> ()
@@ -338,6 +349,7 @@ importJava "org.simantics.db.layer0.util.Layer0Utils" where
     listOntologies :: () -> <ReadGraph> [Resource]
     emptyTrashBin :: () -> <Proc> ()
     purgeDatabase :: () -> <Proc> ()
+    prettyPrintResource :: Resource -> Boolean -> <ReadGraph> String
 
     @private
     @JavaName copyTo
@@ -416,6 +428,10 @@ currentModel = match activeModel (currentProject ()) with
     Just model -> model
     Nothing -> fail "No active model."
 
+"Gives the current active model if it exists or Nothing otherwise."
+possibleCurrentModel :: <ReadGraph> Maybe Resource
+possibleCurrentModel = activeModel (currentProject ())
+    
 startUndoPoint :: String -> <WriteGraph> ()
 startUndoPoint string = do
     markUndoPoint ()
@@ -468,4 +484,4 @@ possibleChildWithPath parent path =
               Just c -> possibleChild c name
               Nothing -> Nothing 
           ) 
-          (Just parent) path
+          (Just parent) path
\ No newline at end of file