import org.simantics.db.Resource;
import org.simantics.db.common.procedure.adapter.TransientCacheListener;
import org.simantics.db.common.request.IndexRoot;
+import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.variable.Variable;
import org.simantics.layer0.Layer0;
sclContext.put("graph", graph);
return exp.apply(context);
} catch (Throwable t) {
- throw new DatabaseException("Compiling structural value request for component=" + request.component + ", literal=" + request.literal + " and relation " + request.relation + " failed!", t);
+ String componentName = NameUtils.getSafeName(graph, request.component);
+ String literalName = NameUtils.getSafeName(graph, request.literal);
+ String relationName = NameUtils.getSafeName(graph, request.relation);
+ StringBuilder sb = new StringBuilder("Compiling structural value request for component ")
+ .append(componentName).append(" ").append(request.component).append(" , literal ")
+ .append(literalName).append(" ").append(request.literal).append(" and relation ")
+ .append(relationName).append(" ").append(request.relation).append(" failed!");
+ throw new DatabaseException(sb.toString(), t);
} finally {
sclContext.put("graph", oldGraph);
}
public int hashCode() {
final int prime = 31;
int result = 1;
+ result = prime * result + ((relation == null) ? 0 : relation.hashCode());
result = prime * result + ((component == null) ? 0 : component.hashCode());
result = prime * result + ((literal == null) ? 0 : literal.hashCode());
return result;
if (getClass() != obj.getClass())
return false;
CompileStructuralValueRequest other = (CompileStructuralValueRequest) obj;
+ if (relation == null) {
+ if (other.relation != null)
+ return false;
+ } else if (!relation.equals(other.relation))
+ return false;
if (component == null) {
if (other.component != null)
return false;
return true;
}
+ @Override
+ protected String getContextDescription(ReadGraph graph) throws DatabaseException {
+ if(component != null) {
+ String uri = graph.getPossibleURI(component);
+ if(uri != null) {
+ String propertyName = NameUtils.getSafeName(graph, relation);
+ return uri + "#" + propertyName;
+ }
+ }
+ return super.getContextDescription(graph);
+ }
+
}