X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.db%2Fscl%2FSimantics%2FDB.scl;h=b24df17f8639c40cb2a020f130a911e8bf547912;hp=3d71ae5143a577bf7ec7aeafa3f863b4b978260b;hb=82a87b8535628d47d9c381e1a3a2296fb67c7fd0;hpb=47800b949fbb8cc2e260ede0a05c5cbb1a717c66 diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl index 3d71ae514..b24df17f8 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl +++ b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl @@ -1,5 +1,6 @@ import "JavaBuiltin" as Java include "http://www.simantics.org/Layer0-1.1" as L0 +import "Map" as Map infixl 5 (#) @@ -42,6 +43,8 @@ importJava "org.simantics.db.Statement" where @JavaName getObject objectOf :: Statement -> Resource + isAsserted :: Statement -> Resource -> 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 @@ -84,6 +87,9 @@ importJava "org.simantics.db.ReadGraph" where @JavaName getSingleStatement singleStatement :: Resource -> Resource -> Statement + @JavaName getPossibleStatement + possibleStatement :: Resource -> Resource -> Maybe Statement + @JavaName getRelatedVariantValue relatedVariantValue :: Resource -> Resource -> Variant @@ -134,6 +140,9 @@ importJava "org.simantics.db.ReadGraph" where isInheritedFrom :: Resource -> Resource -> Boolean getRootLibrary :: () -> Resource + + @JavaName getPredicates + predicatesOf :: Resource -> [Resource] importJava "org.simantics.db.layer0.util.ExtendedUris" where "Converts an absolute URI to a resource" @@ -259,6 +268,9 @@ importJava "org.simantics.db.common.utils.ListUtils" where @JavaName create createList :: [Resource] -> Resource + + @JavaName create + createListWithType :: Resource -> [Resource] -> Resource @javaName insertBack insertBack :: Resource -> [Resource] -> () @@ -322,6 +334,8 @@ importJava "org.simantics.scl.db.SCLFunctions" where subquery :: ( a) -> a "Makes a new read request with given procedure for calculating the result. The request is always cached." subqueryC :: ( a) -> a + "Tries to convert the given Dynamic value to a value with the inferred type" + possibleFromDynamic :: Typeable a => String -> Dynamic -> Maybe a importJava "org.simantics.db.layer0.util.Layer0Utils" where undo :: () -> String @@ -335,6 +349,7 @@ importJava "org.simantics.db.layer0.util.Layer0Utils" where listOntologies :: () -> [Resource] emptyTrashBin :: () -> () purgeDatabase :: () -> () + prettyPrintResource :: Resource -> Boolean -> String @private @JavaName copyTo @@ -413,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 :: Maybe Resource +possibleCurrentModel = activeModel (currentProject ()) + startUndoPoint :: String -> () startUndoPoint string = do markUndoPoint () @@ -465,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