Defined component types don't support writing wikidoc documentation
Encountered a wikidoc documentation problem with Apros whose roots lie in the platform:
org.simantics.db.layer0.exception.MissingVariableException: http://Projects/Development%20Project/Model/Configuration/Correlations/Six-Equation_Model/GAS_INTERFACIAL_HEAT_TRANSFER_CORRELATION/GIHTCORR01/Documentation/Scenegraph null
at org.simantics.db.layer0.variable.VariableRepository.get(VariableRepository.java:39)
at org.simantics.db.layer0.variable.Variables.getVariable(Variables.java:206)
at org.simantics.db.layer0.variable.Variables.getVariable(Variables.java:199)
at org.simantics.db.layer0.request.ResourceVariable.perform(ResourceVariable.java:30)
at org.simantics.db.layer0.request.ResourceVariable.perform(ResourceVariable.java:1)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:697)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1961)
at org.simantics.db.common.request.ResourceReadBase.request(ResourceReadBase.java:62)
at org.simantics.db.impl.graph.ReadGraphImpl.sync(ReadGraphImpl.java:2509)
at org.simantics.scenegraph.loader.ScenegraphLoaderProcess$1.perform(ScenegraphLoaderProcess.java:100)
at org.simantics.scenegraph.loader.ScenegraphLoaderProcess$1.perform(ScenegraphLoaderProcess.java:1)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:697)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1961)
at org.simantics.db.common.request.GenericReadBase2.request(GenericReadBase2.java:60)
at org.simantics.db.impl.graph.ReadGraphImpl.sync(ReadGraphImpl.java:2509)
at org.simantics.scenegraph.loader.ScenegraphLoaderProcess.getVariable(ScenegraphLoaderProcess.java:96)
at org.simantics.scenegraph.loader.ScenegraphLoaderProcess.load(ScenegraphLoaderProcess.java:83)
at org.simantics.document.function.All.documentationText(All.java:47)
at jdk.internal.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.simantics.scl.reflection.functions.ClassMethodFunction3.apply(ClassMethodFunction3.java:22)
at org.simantics.db.impl.graph.ReadGraphImpl.getValue2(ReadGraphImpl.java:6058)
at org.simantics.db.layer0.function.All.standardGetValue1(All.java:153)
at org.simantics.db.layer0.function.All$1.getValue(All.java:428)
at org.simantics.db.layer0.variable.StandardGraphPropertyVariable.getValue(StandardGraphPropertyVariable.java:142)
at org.simantics.db.layer0.variable.AbstractVariable.getPropertyValue(AbstractVariable.java:416)
at org.simantics.scenegraph.loader.ScenegraphLoaderUtils$4.perform(ScenegraphLoaderUtils.java:255)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:697)
at fi.vtt.simantics.procore.internal.SessionImplSocket$6.run0(SessionImplSocket.java:1511)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:234)
at fi.vtt.simantics.procore.internal.SessionRequestManager$1.run0(SessionRequestManager.java:127)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:234)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:238)
The .../Documentation/scenegraph
variable can't be found from the shown component and results in not being able to write wikidoc for such component instances.
This happens because the structural component type in question has been modeled as a STR.DefinedComponentType
which causes Variable.getChildren
to function as follows:
public class StructuralUtils {
public static enum StructuralComponentClass {
PRIMITIVE,REPLACEABLE,DEFINED,PROCEDURAL;
public static StructuralComponentClass get(ReadGraph graph, Resource componentType) throws DatabaseException {
StructuralResource2 STR = StructuralResource2.getInstance(graph);
Set<Resource> types = graph.getTypes(componentType);
if(types.contains(STR.ProceduralComponentType))
return StructuralComponentClass.PROCEDURAL;
else if(graph.hasStatement(componentType, STR.IsDefinedBy))
return StructuralComponentClass.DEFINED; <---
else if(types.contains(STR.ReplaceableDefinedComponentType))
return StructuralComponentClass.REPLACEABLE;
else
return StructuralComponentClass.PRIMITIVE;
}
}
----
package org.simantics.structural2;
public class Functions {
@Override
public Map<String, Variable> getVariables(ReadGraph graph, Variable context, Map<String, Variable> map) throws DatabaseException {
StructuralResource2 STR = StructuralResource2.getInstance(graph);
Resource type = context.getPossibleType(graph, STR.Component);
if(type == null) return null;
StructuralComponentClass clazz = StructuralComponentClass.get(graph, type);
if(StructuralComponentClass.PROCEDURAL.equals(clazz)) {
Map<String,Variable> mapPrime = graph.syncRequest(new ProceduralSubstructureRequest(context),
TransientCacheListener.<Map<String,Variable>>instance());
if(mapPrime != null) {
if(map != null) {
map.putAll(mapPrime);
return map;
}
else
return mapPrime;
}
return map;
} else if (StructuralComponentClass.DEFINED.equals(clazz)) {
Resource def = graph.getSingleObject(type, STR.IsDefinedBy);
Map<String, Resource> children = graph.syncRequest(new UnescapedChildMapOfResource(def), TransientCacheListener.instance()); <<<----
return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, children, map);
This means that for DEFINED component types the Variable implementation will look for defined component type instance children only through the definition of the component type itself. It will not include anything that the actual component type instance consists of in the Variable address space as children.
I don't have any good ideas what should be done about this but it is clear that this prevents defined component type instance-specific documentation from being written.