public void fileTest4() {
for (int i = 0; i < 1; i++) {
Model origM = ModelFactory.createDefaultModel();
origM.read(getClass().getResource("test4.rdf").toString());
Graph graph = new AnonymizedGraph(JenaUtil.getGraphFromModel(origM,
true));
ReferenceGroundedDecomposition ref = new ReferenceGroundedDecompositionImpl(
graph);
Set<FunctionallyGroundedNode> fgNodes = ref
.getFunctionallyGroundedNodes();
//Map<Object, FunctionallyGroundedNode> map = map(fgNodes);
boolean firtsRound = true;
Graph lastReconstructedGraph = null;
for (int j = 0; j < 10; j++) {
Map<Object, FunctionallyGroundedNode> map = map(fgNodes);
Map<Object, FunctionallyGroundedNode> mergedMap = FgNodeMerger.mergeFgNodes(map);
final Set<FunctionallyGroundedNode> mergedFGnodes = new HashSet<FunctionallyGroundedNode>(mergedMap.values());
if (!firtsRound) {
assertEquals(fgNodes, mergedFGnodes);
}
fgNodes = mergedFGnodes;
ReferenceGroundedDecomposition referenceGroundedDecomposition = new ReferenceGroundedDecomposition() {
public Set<MaximumContextualMolecule> getContextualMolecules() {
return new HashSet<MaximumContextualMolecule>();
}
public Set<FunctionallyGroundedNode> getFunctionallyGroundedNodes() {
return new HashSet<FunctionallyGroundedNode>(new ArrayList<FunctionallyGroundedNode>(mergedFGnodes));
}
public Set<TerminalMolecule> getTerminalMolecules() {
return new HashSet<TerminalMolecule>();
}
};
Graph reconstructedGraph = ReferenceGroundedUtil.reconstructGraph(referenceGroundedDecomposition);
Graph reconstructedGraph2 = ReferenceGroundedUtil.reconstructGraph(referenceGroundedDecomposition);
assertEquals(reconstructedGraph, reconstructedGraph2);
reconstructedGraph = new DeAnonymizedGraph(reconstructedGraph);
assertEquals(reconstructedGraph, new DeAnonymizedGraph(reconstructedGraph2));
if (!firtsRound) {
assertEquals(lastReconstructedGraph, reconstructedGraph);