package org.simantics.scenegraph.loader; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.StandardGraphChildVariable; import org.simantics.db.layer0.variable.StandardGraphPropertyVariable; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.VariableBuilder; import org.simantics.db.layer0.variable.VariableNode; public class SceneGraphVariableBuilder implements VariableBuilder { @Override public Variable buildChild(ReadGraph graph, Variable parent, VariableNode node, Resource child) throws DatabaseException { SceneGraphContext vc = ScenegraphLoaderUtils.getContext(graph, parent); if(vc != null) return new ScenegraphVariable(parent, child, null, null); else return new StandardGraphChildVariable(parent, null, child); } @Override public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode node, Resource subject, Resource predicate) throws DatabaseException { return new StandardGraphPropertyVariable(graph, parent, null, subject, predicate); } }