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=d7c1dde060eb923949520f96a52da6785164c465;hp=32019768b2f08e7c6bb930a014fa8d656413ba0b;hb=3d8c21802176627ba3ff724980bf7606bcbb5100;hpb=6f11a60dee43d620d500c0cf5af34a1d91c80a8b diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl index 32019768b..d7c1dde06 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl +++ b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl @@ -20,6 +20,8 @@ importJava "org.simantics.db.Resource" where @JavaName getResourceId resourceId :: Resource -> Long + isPersistent :: Resource -> Boolean + importJava "org.simantics.db.ReadGraph" where data ReadGraphX @@ -58,6 +60,10 @@ importJava "org.simantics.db.ReadGraph" where @private @JavaName getURI uriOfResource :: Resource -> String + + @private + @JavaName getPossibleURI + possibleUriOfResource :: Resource -> Maybe String @JavaName getObjects objects_ :: Resource -> Resource -> Collection Resource @@ -127,6 +133,8 @@ importJava "org.simantics.db.ReadGraph" where @JavaName getInverse inverseOf :: Resource -> Resource + @JavaName getPossibleInverse + possibleInverseOf :: Resource -> Maybe Resource @JavaName getSingleType singleTypeOf :: Resource -> Resource -> Resource @@ -140,6 +148,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" @@ -164,7 +175,10 @@ class Browsable a where "Returns the URI of the given value." uriOf :: a -> String - + + "Returns the URI of the given value if it exists or Nothing." + possibleUriOf :: a -> Maybe String + "Reads the name of the value." nameOf :: a -> String possibleNameOf :: a -> Maybe String @@ -183,6 +197,7 @@ class Browsable a where instance Browsable Resource where fromUri = resource uriOf = uriOfResource + possibleUriOf = possibleUriOfResource nameOf r = relatedValue r L0.HasName possibleNameOf r = possibleRelatedValue r L0.HasName @inline @@ -204,6 +219,8 @@ importJava "org.simantics.db.WriteGraph" where newResource :: () -> Resource "Adds a statement to the semantic graph." claim :: Resource -> Resource -> Resource -> () + @JavaName claim + claimWithInverse :: Resource -> Resource -> Maybe Resource -> Resource -> () @JavaName claimLiteral claimRelatedValue_ :: Resource -> Resource -> a -> Binding a -> () @JavaName claimLiteral @@ -267,7 +284,7 @@ importJava "org.simantics.db.common.utils.ListUtils" where createList :: [Resource] -> Resource @JavaName create - createList :: Resource -> [Resource] -> Resource + createListWithType :: Resource -> [Resource] -> Resource @javaName insertBack insertBack :: Resource -> [Resource] -> () @@ -331,6 +348,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 + "Makes a new read asynchronous request with function to handle the request result. The last `isDisposed` function parameter is used to determine if the listener is still alive or not." + subqueryL :: ( a) -> (a -> ()) -> (Throwable -> ()) -> ( Boolean) -> () "Tries to convert the given Dynamic value to a value with the inferred type" possibleFromDynamic :: Typeable a => String -> Dynamic -> Maybe a @@ -353,6 +372,11 @@ importJava "org.simantics.db.layer0.util.Layer0Utils" where copyTo_ :: Resource -> Resource -> Collection Resource @JavaName getPossiblePredicateByName possiblePredicateByName :: Resource -> String -> Maybe Resource + @JavaName getPossiblePredicateByNameFromType + possiblePredicateByNameFromType :: Resource -> String -> Maybe Resource + + addMetadataListener :: ChangeListener -> () + removeMetadataListener :: ChangeListener -> () copyTo :: Resource -> Resource -> Resource copyTo targetContainer source = do @@ -425,6 +449,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 () @@ -478,3 +506,12 @@ possibleChildWithPath parent path = Nothing -> Nothing ) (Just parent) path + +importJava "org.simantics.db.MetadataI" where + data MetadataI + +importJava "org.simantics.db.event.ChangeListener" where + data ChangeListener + +importJava "org.simantics.db.layer0.genericrelation.DependencyChanges" where + data DependencyChanges