]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.db/scl/Simantics/Variables.scl
Property following functions value and possibleValue to ontology modules
[simantics/platform.git] / bundles / org.simantics.scl.db / scl / Simantics / Variables.scl
index 9a6ffde8c17267717a3113d3ecfded655e262942..436e0a17357f32072ec80c2cea18f8f97d3bb734 100644 (file)
@@ -21,6 +21,9 @@ Example:
     """
     variable :: String -> <ReadGraph> Variable
     
+    @JavaName getPossibleVariable
+    possibleResourceVariable :: Resource -> <ReadGraph> Maybe Variable
+
     @JavaName getPossibleVariable
     possibleVariable :: String -> <ReadGraph> Maybe Variable
 
@@ -93,6 +96,9 @@ importJava "org.simantics.db.layer0.function.All" where
 importJava "org.simantics.db.layer0.variable.VariableMap" where
     data VariableMap
 
+importJava "org.simantics.db.layer0.variable.StructuredProperty" where
+    data StructuredProperty
+
 importJava "org.simantics.db.layer0.variable.ResourceCollectionVariableMap" where
     @JavaName "<init>"
     createVariableMap :: [Resource] -> VariableMap
@@ -405,6 +411,7 @@ instance Show Variable where
 instance Browsable Variable where
     fromUri = variable
     uriOf = uri
+    possibleUriOf v = Just (uri v)
     nameOf = name
     possibleNameOf v = Just (name v)
     children v = collectionToList (children_ v)
@@ -414,6 +421,9 @@ instance Browsable Variable where
     variantValueOf v = createVariant (datatype v) (untypedValue v :: Dynamic)
     child = child_
     possibleChild = possibleChild_
+    
+    genericRelatedValue v rel = untypedPropertyValue v (nameOf rel)
+    genericPossibleRelatedValue v rel = untypedPossiblePropertyValue v (nameOf rel)
 
 propertiesClassified :: Variable -> Resource -> <ReadGraph> [Variable]
 propertiesClassified parent classified = do