package org.simantics.graph.compiler.internal.procedures; import org.simantics.graph.query.IGraph; import org.simantics.graph.query.Paths; import org.simantics.graph.query.Res; import org.simantics.graph.store.GraphStore; import org.simantics.graph.store.StatementStore; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.TIntIntHashMap; public class CreateInverseRelations implements Runnable { IGraph graph; GraphStore store; public CreateInverseRelations(IGraph graph, GraphStore store) { this.graph = graph; this.store = store; } @Override public void run() { Paths paths = graph.getPaths(); int subrelationOf = store.identities.pathToId(paths.SubrelationOf); if(subrelationOf < 0) return; int inverseOf = store.identities.createPathToId(paths.InverseOf); int resourceCount = store.identities.getResourceCount(); TIntIntHashMap inverseMap = new TIntIntHashMap(); StatementStore statements = store.statements; for(int id = 0;id= 0) { invSuperrelations.set(i, invSuperrelations.get(invSuperrelations.size()-1)); invSuperrelations.removeAt(invSuperrelations.size()-1); } } } for(int invSuperrelation : invSuperrelations.toArray()) store.statements.add(inverse, subrelationOf, invSuperrelation); } } } } }