Imported possibleUriOfResource for Browsable Resource implementation.
Browsable Variable uses the same uri implementation for both uriOf and
possibleUriOf since Variables always have a URI.
Also added yet another utility function possiblePredicateByNameFromType
to Simantics/DB.
refs #7512
Change-Id: I2363aed7ed67ba84bd992847187fe8ac6c7b6bce
+
+ public static Resource getPossiblePredicateByNameFromType(ReadGraph graph, Resource type, String name) throws DatabaseException {
+ Map<String,Resource> domain = getDomainOf(graph, type);
+ return domain.get(name);
+ }
public static Resource getPossiblePredicateByName(ReadGraph graph, Resource instance, String predicateName) throws DatabaseException {
for(Resource type : graph.getPrincipalTypes(instance)) {
public static Resource getPossiblePredicateByName(ReadGraph graph, Resource instance, String predicateName) throws DatabaseException {
for(Resource type : graph.getPrincipalTypes(instance)) {
@private
@JavaName getURI
uriOfResource :: Resource -> <ReadGraph> String
@private
@JavaName getURI
uriOfResource :: Resource -> <ReadGraph> String
+
+ @private
+ @JavaName getPossibleURI
+ possibleUriOfResource :: Resource -> <ReadGraph> Maybe String
@JavaName getObjects
objects_ :: Resource -> Resource -> <ReadGraph> Collection Resource
@JavaName getObjects
objects_ :: Resource -> Resource -> <ReadGraph> Collection Resource
"Returns the URI of the given value."
uriOf :: a -> <ReadGraph> String
"Returns the URI of the given value."
uriOf :: a -> <ReadGraph> String
+
+ "Returns the URI of the given value if it exists or Nothing."
+ possibleUriOf :: a -> <ReadGraph> Maybe String
+
"Reads the name of the value."
nameOf :: a -> <ReadGraph> String
possibleNameOf :: a -> <ReadGraph> Maybe String
"Reads the name of the value."
nameOf :: a -> <ReadGraph> String
possibleNameOf :: a -> <ReadGraph> Maybe String
instance Browsable Resource where
fromUri = resource
uriOf = uriOfResource
instance Browsable Resource where
fromUri = resource
uriOf = uriOfResource
+ possibleUriOf = possibleUriOfResource
nameOf r = relatedValue r L0.HasName
possibleNameOf r = possibleRelatedValue r L0.HasName
@inline
nameOf r = relatedValue r L0.HasName
possibleNameOf r = possibleRelatedValue r L0.HasName
@inline
copyTo_ :: Resource -> Resource -> <WriteGraph> Collection Resource
@JavaName getPossiblePredicateByName
possiblePredicateByName :: Resource -> String -> <ReadGraph> Maybe Resource
copyTo_ :: Resource -> Resource -> <WriteGraph> Collection Resource
@JavaName getPossiblePredicateByName
possiblePredicateByName :: Resource -> String -> <ReadGraph> Maybe Resource
+ @JavaName getPossiblePredicateByNameFromType
+ possiblePredicateByNameFromType :: Resource -> String -> <ReadGraph> Maybe Resource
copyTo :: Resource -> Resource -> <WriteGraph> Resource
copyTo targetContainer source = do
copyTo :: Resource -> Resource -> <WriteGraph> Resource
copyTo targetContainer source = do
instance Browsable Variable where
fromUri = variable
uriOf = uri
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)
nameOf = name
possibleNameOf v = Just (name v)
children v = collectionToList (children_ v)