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;fp=bundles%2Forg.simantics.scl.db%2Fscl%2FSimantics%2FDB.scl;h=a35092bd9612651f16af7502df165a34a79e6e7b;hp=b24df17f8639c40cb2a020f130a911e8bf547912;hb=5887fe12f827ef474590d61c86d0de32fca8550e;hpb=093b802d3fb679be21c11cda8816ac5f6da55b2d diff --git a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl index b24df17f8..a35092bd9 100644 --- a/bundles/org.simantics.scl.db/scl/Simantics/DB.scl +++ b/bundles/org.simantics.scl.db/scl/Simantics/DB.scl @@ -58,6 +58,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 @@ -167,7 +171,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 @@ -186,6 +193,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 @@ -356,6 +364,8 @@ 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 copyTo :: Resource -> Resource -> Resource copyTo targetContainer source = do