Skip to content
Snippets Groups Projects
Commit d3e5f9fb authored by Sören Henning's avatar Sören Henning
Browse files

some nested graph testing and examples

parent 68211e79
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
......@@ -9,6 +9,9 @@ import java.util.List;
import com.tinkerpop.blueprints.Graph;
import kieker.analysis.dev.nestedgraph.NestedGraph;
import kieker.analysis.dev.nestedgraphstages.NestedGraphFactory;
import kieker.analysis.dev.nestedgraphstages.NestedGraphPrinterStage;
import kieker.analysis.stage.tracediagnosis.AllowedRecordsFilter;
import kieker.analysis.stage.tracediagnosis.BeginEndOfMonitoringDetector;
import kieker.analysis.stage.tracediagnosis.OperationCallHandlerComposite;
......@@ -29,6 +32,7 @@ import kieker.common.record.misc.KiekerMetadataRecord;
import teetime.framework.Configuration;
import teetime.stage.CollectorSink;
import teetime.stage.MultipleInstanceOfFilter;
import teetime.stage.ObjectProducer;
import teetime.stage.basic.distributor.Distributor;
import teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy;
......@@ -104,15 +108,11 @@ public class TraceAnalysisConfiguration extends Configuration {
// TODO Temp Some examples for nested graphs
/*
* final NestedGraphFactory nestedGraphFactory = new NestedGraphFactory();
* final ObjectProducer<PartitionGraph<Graph>> nestedGraphProducerStage = new ObjectProducer<>(1, nestedGraphFactory);
* // final NestedGraphMLWriter nestedGraphMLWriter = new NestedGraphMLWriter("example/temp/output");
* final NestedGraphPrinterStage nestedGraphPrinterStage = new NestedGraphPrinterStage();
*
* super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphPrinterStage.getInputPort());
* // super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphMLWriter.getInputPort());
*/
final NestedGraphFactory nestedGraphFactory = new NestedGraphFactory();
final ObjectProducer<NestedGraph<Graph>> nestedGraphProducerStage = new ObjectProducer<>(1, nestedGraphFactory);
final NestedGraphPrinterStage nestedGraphPrinterStage = new NestedGraphPrinterStage();
super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphPrinterStage.getInputPort());
}
......
package kieker.analysis.dev.nestedgraphstages;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
import kieker.analysis.dev.nestedgraph.NestedGraph;
import kieker.analysis.dev.nestedgraph.NestedGraphPartition;
import teetime.util.ConstructorClosure;
public class NestedGraphFactory implements ConstructorClosure<NestedGraph<Graph>> {
@Override
public NestedGraph<Graph> create() {
NestedGraph<Graph> graph = new NestedGraph<Graph>(new TinkerGraph());
Vertex entry = graph.addVertex("Entry");
NestedGraphPartition partitionBookstore = new NestedGraphPartition("Bookstore");
graph.addPartition(partitionBookstore);
Vertex searchBook = graph.addVertexToPartition("searchBook()", partitionBookstore);
NestedGraphPartition partitionCRM = new NestedGraphPartition("CRM");
graph.addPartition(partitionCRM);
Vertex getOffers = graph.addVertexToPartition("getOffers()", partitionCRM);
Vertex customMethod = graph.addVertexToPartition("customMethod()", partitionCRM);
NestedGraphPartition partitionCatalog = new NestedGraphPartition("Catalog");
graph.addPartition(partitionCatalog);
Vertex getBook = graph.addVertexToPartition("getBook()", partitionCatalog);
graph.addEdge(null, entry, searchBook, "100");
graph.addEdge(null, searchBook, getBook, "100");
graph.addEdge(null, searchBook, getOffers, "100");
graph.addEdge(null, getOffers, getBook, "96");
graph.addEdge(null, getOffers, customMethod, "0");
return graph;
}
}
package kieker.analysis.dev.nestedgraphstages;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import kieker.analysis.dev.nestedgraph.NestedGraph;
import kieker.analysis.dev.nestedgraph.NestedGraphPartition;
import teetime.framework.AbstractConsumerStage;
public class NestedGraphPrinterStage extends AbstractConsumerStage<NestedGraph<Graph>> {
@Override
protected void execute(final NestedGraph<Graph> graph) {
System.out.println("TOP LEVEL:");
for (Vertex vertex : graph.getVertices()) {
System.out.println(vertex);
}
for (Edge edge : graph.getEdges()) {
System.out.println(edge);
}
for (NestedGraphPartition partition : graph.getPartitions()) {
System.out.println("PARTITION: " + partition.getName());
for (Vertex vertex : graph.getVerticesForPartition(partition)) {
System.out.println(vertex);
}
for (Edge edge : graph.getEdgesForPartition(partition)) {
System.out.println(edge);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment