]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardGraphChildVariable.java
Possible variable browse without URI
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / StandardGraphChildVariable.java
index cffd74727c8000ed8e84cb15dfc582480702c106..b784754bfa69ce8187999cb78af598506552c45d 100644 (file)
@@ -12,8 +12,8 @@ import org.simantics.db.Resource;
 import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
 import org.simantics.db.exception.AssumptionException;
 import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.VariableException;
 import org.simantics.db.layer0.exception.InvalidVariableException;
-import org.simantics.db.layer0.exception.VariableException;
 import org.simantics.db.layer0.function.All;
 import org.simantics.db.layer0.request.ClassificationsRequest;
 import org.simantics.db.layer0.request.VariableURI;
@@ -107,7 +107,7 @@ public class StandardGraphChildVariable extends AbstractChildVariable {
                return node.support.manager.getName(node.node);
            }
                String unescapedName = graph.getPossibleRelatedValue(resource, graph.getService(Layer0.class).HasName, Bindings.STRING);
-               if(unescapedName == null) return "r" + resource.getResourceId();
+               if(unescapedName == null) return VariableUtils.unnamedResourceName(resource);
                return unescapedName;
        }
 
@@ -150,7 +150,7 @@ public class StandardGraphChildVariable extends AbstractChildVariable {
        @Override
        final public Resource getRepresents(ReadGraph graph) throws DatabaseException {
            if(resource == null)
-               throw new VariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");
+               throw new InvalidVariableException("Variable is not represented by any resource (URI=" + getPossibleURI(graph) + ").");
            return resource;
 //             Layer0X L0X = Layer0X.getInstance(graph);
 //             Resource represents = graph.getPossibleObject(resource, L0X.Represents);