Examples of Graph


Examples of org.apache.airavata.xbaya.graph.Graph

    }

    private void resetAll() {
        List<GraphCanvas> graphCanvases = this.engine.getGUI().getGraphCanvases();
        for (GraphCanvas graphCanvas : graphCanvases) {
            Graph graph = graphCanvas.getGraph();
            for (Node node : graph.getNodes()) {
                resetNode(node);
            }
        }
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.Graph

        //      because an equals check will not work with BNodes.
        Set<UriRef> graphNames = new HashSet<UriRef>();
        for( Iterator<Triple> iterator = graphNameIndex.getMGraph().iterator(); iterator.hasNext(); ) {
            Triple triple = iterator.next();
            UriRef graphName = new UriRef(triple.getSubject().toString());
            Graph currentGraph = getModelGraph(graphName, false, false).getGraph();
            if(graph.equals(currentGraph)){
                graphNames.add(graphName);
            }
        }
        return graphNames;
View Full Code Here

Examples of org.apache.geronimo.monitoring.console.data.Graph

        try {
            userTransaction.begin();
            try {
                String graphIdString = request.getParameter("graph_id");
                int graphId = Integer.parseInt(graphIdString);
                Graph graph = (Graph) entityManager.createNamedQuery("graphById").setParameter("id", graphId).getSingleResult();
                StatsGraph statsGraph = new GraphsBuilder().getStatsGraph(graph);
                request.setAttribute("statsGraph", statsGraph);
            } finally {
                userTransaction.commit();
            }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.plan.api.Graph

    }
  }

  public static void setWorkflowAdjacencies(Configuration conf, QueryPlan plan) {
    try {
      Graph stageGraph = plan.getQueryPlan().getStageGraph();
      if (stageGraph == null) {
        return;
      }
      List<Adjacency> adjList = stageGraph.getAdjacencyList();
      if (adjList == null) {
        return;
      }
      for (Adjacency adj : adjList) {
        List<String> children = adj.getChildren();
View Full Code Here

Examples of org.apache.hadoop.yarn.util.Graph

   * @param name graph name
   * @return Graph object generated
   */
  public Graph generateStateGraph(String name) {
    maybeMakeStateMachineTable();
    Graph g = new Graph(name);
    for (STATE startState : stateMachineTable.keySet()) {
      Map<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>> transitions
          = stateMachineTable.get(startState);
      for (Entry<EVENTTYPE, Transition<OPERAND, STATE, EVENTTYPE, EVENT>> entry :
         transitions.entrySet()) {
        Transition<OPERAND, STATE, EVENTTYPE, EVENT> transition = entry.getValue();
        if (transition instanceof StateMachineFactory.SingleInternalArc) {
          StateMachineFactory.SingleInternalArc sa
              = (StateMachineFactory.SingleInternalArc) transition;
          Graph.Node fromNode = g.getNode(startState.toString());
          Graph.Node toNode = g.getNode(sa.postState.toString());
          fromNode.addEdge(toNode, entry.getKey().toString());
        } else if (transition instanceof StateMachineFactory.MultipleInternalArc) {
          StateMachineFactory.MultipleInternalArc ma
              = (StateMachineFactory.MultipleInternalArc) transition;
          Iterator<STATE> iter = ma.validPostStates.iterator();
          while (iter.hasNext()) {
            Graph.Node fromNode = g.getNode(startState.toString());
            Graph.Node toNode = g.getNode(iter.next().toString());
            fromNode.addEdge(toNode, entry.getKey().toString());
          }
        }
      }
    }
View Full Code Here

Examples of org.apache.oodt.cas.workflow.structs.Graph

                      + "[" + inst.getId() + "]");
          instance.setState(condWorkflowState);
          instance.setPriority(inst.getPriority());
          WorkflowTask conditionTask = toConditionTask(cond);
          instance.setCurrentTaskId(conditionTask.getTaskId());
          Graph condGraph = new Graph();
          condGraph.setExecutionType("condition");
          condGraph.setCond(cond);
          condGraph.setTask(conditionTask);
          ParentChildWorkflow workflow = new ParentChildWorkflow(condGraph);
          workflow.setId("pre-cond-workflow-"
              + inst.getParentChildWorkflow().getId());
          workflow.setName("Pre Condition Workflow-" + cond.getConditionName());
          workflow.getTasks().add(conditionTask);
          instance.setParentChildWorkflow(workflow);
          this.addToModelRepo(workflow);
          persist(instance);
          WorkflowProcessor subProcessor = fromWorkflowInstance(instance);
          processor.getSubProcessors().add(subProcessor);
          synchronized (processorCache) {
            processorCache.put(instance.getId(), subProcessor);
          }
        }

        // handle its tasks
        for (WorkflowTask task : inst.getParentChildWorkflow().getTasks()) {
          WorkflowInstance instance = new WorkflowInstance();
          WorkflowState taskWorkflowState = lifecycle.getDefaultLifecycle()
              .createState(
                  "Null",
                  "initial",
                  "Sub Task Workflow created by Workflow Processor Queue for workflow instance: "
                      + "[" + inst.getId() + "]");
          instance.setState(taskWorkflowState);
          instance.setPriority(inst.getPriority());
          instance.setCurrentTaskId(task.getTaskId());
          Graph taskGraph = new Graph();
          taskGraph.setExecutionType("task");
          taskGraph.setTask(task);
          ParentChildWorkflow workflow = new ParentChildWorkflow(taskGraph);
          workflow.setId("task-workflow-"
              + inst.getParentChildWorkflow().getId());
          workflow.setName("Task Workflow-" + task.getTaskName());
          workflow.getTasks().add(task);
          workflow.getGraph().setTask(task);
          instance.setParentChildWorkflow(workflow);
          this.addToModelRepo(workflow);
          persist(instance);
          WorkflowProcessor subProcessor = fromWorkflowInstance(instance);
          processor.getSubProcessors().add(subProcessor);
          synchronized (processorCache) {
            processorCache.put(instance.getId(), subProcessor);
          }
        }

        // handle its post conditions
        for (WorkflowCondition cond : inst.getParentChildWorkflow()
            .getPostConditions()) {
          WorkflowInstance instance = new WorkflowInstance();
          WorkflowState condWorkflowState = lifecycle
              .getDefaultLifecycle()
              .createState(
                  "Null",
                  "initial",
                  "Sub Post Condition Workflow created by Workflow Processor Queue for workflow instance: "
                      + "[" + inst.getId() + "]");
          instance.setState(condWorkflowState);
          instance.setPriority(inst.getPriority());
          WorkflowTask conditionTask = toConditionTask(cond);
          instance.setCurrentTaskId(conditionTask.getTaskId());
          Graph condGraph = new Graph();
          condGraph.setExecutionType("condition");
          condGraph.setCond(cond);
          condGraph.setTask(conditionTask);
          ParentChildWorkflow workflow = new ParentChildWorkflow(condGraph);
          workflow.setId("post-cond-workflow-"
              + inst.getParentChildWorkflow().getId());
          workflow
              .setName("Post Condition Workflow-" + cond.getConditionName());
          workflow.getTasks().add(conditionTask);
          instance.setParentChildWorkflow(workflow);
          this.addToModelRepo(workflow);
          persist(instance);
          WorkflowProcessor subProcessor = fromWorkflowInstance(instance);
          processor.getSubProcessors().add(subProcessor);
          synchronized (processorCache) {
            processorCache.put(instance.getId(), subProcessor);
          }
        }

      } else {
        // it's not a composite workflow, and it's either just a task processor
        // or a condition processor
        if (inst.getParentChildWorkflow().getGraph().getExecutionType()
            .equals("task")) {
          processor = new TaskProcessor(lifecycle, inst);
          WorkflowState taskProcessorState = getLifecycle(
              inst.getParentChildWorkflow()).createState(
              "Loaded",
              "initial",
              "Task Workflow instance with id: [" + inst.getId()
                  + "] loaded by processor queue.");
          inst.setState(taskProcessorState);

          // handle its pre-conditions
          for (WorkflowCondition cond : inst.getParentChildWorkflow()
              .getGraph().getTask().getPreConditions()) {
            WorkflowInstance instance = new WorkflowInstance();
            WorkflowState condWorkflowState = lifecycle
                .getDefaultLifecycle()
                .createState(
                    "Null",
                    "initial",
                    "Sub Pre Condition Workflow for Task created by Workflow Processor Queue for workflow instance: "
                        + "[" + inst.getId() + "]");
            instance.setState(condWorkflowState);
            instance.setPriority(inst.getPriority());
            WorkflowTask conditionTask = toConditionTask(cond);
            instance.setCurrentTaskId(conditionTask.getTaskId());
            Graph condGraph = new Graph();
            condGraph.setExecutionType("condition");
            condGraph.setCond(cond);
            condGraph.setTask(conditionTask);
            ParentChildWorkflow workflow = new ParentChildWorkflow(condGraph);
            workflow.setId("pre-cond-workflow-"
                + inst.getParentChildWorkflow().getGraph().getTask()
                    .getTaskId());
            workflow.setName("Task Pre Condition Workflow-"
                + cond.getConditionName());
            workflow.getTasks().add(conditionTask);
            instance.setParentChildWorkflow(workflow);
            this.addToModelRepo(workflow);
            persist(instance);
            WorkflowProcessor subProcessor = fromWorkflowInstance(instance);
            processor.getSubProcessors().add(subProcessor);
            synchronized (processorCache) {
              processorCache.put(instance.getId(), subProcessor);
            }
          }

          // handle its post-conditions
          for (WorkflowCondition cond : inst.getParentChildWorkflow()
              .getGraph().getTask().getPostConditions()) {
            WorkflowInstance instance = new WorkflowInstance();
            WorkflowState condWorkflowState = lifecycle
                .getDefaultLifecycle()
                .createState(
                    "Null",
                    "initial",
                    "Sub Post Condition Workflow for Task created by Workflow Processor Queue for workflow instance: "
                        + "[" + inst.getId() + "]");
            instance.setState(condWorkflowState);
            instance.setPriority(inst.getPriority());
            WorkflowTask conditionTask = toConditionTask(cond);
            instance.setCurrentTaskId(conditionTask.getTaskId());
            Graph condGraph = new Graph();
            condGraph.setExecutionType("condition");
            condGraph.setCond(cond);
            condGraph.setTask(conditionTask);
            ParentChildWorkflow workflow = new ParentChildWorkflow(condGraph);
            workflow.setId("post-cond-workflow-"
                + inst.getParentChildWorkflow().getGraph().getTask()
                    .getTaskId());
            workflow.setName("Task Post Condition Workflow-"
View Full Code Here

Examples of org.apache.openjpa.lib.graph.Graph

     */
    private Graph addEdge(Graph graph, PrimaryRow row1, PrimaryRow row2,
        Object fk) {
        // delay creation of the graph
        if (graph == null)
            graph = new Graph();

        row1.setDependent(true);
        row2.setDependent(true);
        graph.addNode(row1);
        graph.addNode(row2);
View Full Code Here

Examples of org.apache.struts2.sitegraph.model.Graph

    public DOTRenderer(Writer writer) {
        this.writer = writer;
    }

    public void render(String ns) {
        Graph graph = new Graph();

        TreeMap viewMap = new TreeMap(new Comparator() {
            public int compare(Object o1, Object o2) {
                ViewNode v1 = (ViewNode) o1;
                ViewNode v2 = (ViewNode) o2;

                return v1.getFullName().compareTo(v2.getFullName());
            }
        });

        Set namespaces = StrutsConfigRetriever.getNamespaces();
        for (Iterator iter = namespaces.iterator(); iter.hasNext();) {
            String namespace = (String) iter.next();

            if (!namespace.startsWith(ns)) {
                continue;
            }

            SubGraph subGraph = graph.create(namespace);

            Set actionNames = StrutsConfigRetriever.getActionNames(namespace);
            for (Iterator iterator = actionNames.iterator(); iterator.hasNext();) {
                String actionName = (String) iterator.next();
                ActionConfig actionConfig = StrutsConfigRetriever.getActionConfig(namespace,
                        actionName);

                ActionNode action = new ActionNode(actionName);
                subGraph.addNode(action);

                Set resultNames = actionConfig.getResults().keySet();
                for (Iterator iterator2 = resultNames.iterator(); iterator2.hasNext();) {
                    String resultName = (String) iterator2.next();
                    ResultConfig resultConfig = ((ResultConfig) actionConfig.getResults().get(resultName));
                    String resultClassName = resultConfig.getClassName();

                    if (resultClassName.equals(ActionChainResult.class.getName())) {

                    } else if (resultClassName.indexOf("Dispatcher") != -1
                            || resultClassName.indexOf("Velocity") != -1
                            || resultClassName.indexOf("Freemarker") != -1) {
                        if (resultConfig.getParams().get("location") == null) {
                            continue;
                        }

                        String location = getViewLocation((String) resultConfig.getParams().get("location"), namespace);
                        //  FIXME: work with new configuration style                       
                        if (location.endsWith("action")) {
                            addTempLink(action, location, Link.TYPE_RESULT, resultConfig.getName());
                        } else {
                            ViewNode view = new ViewNode(stripLocation(location));
                            subGraph.addNode(view);

                            addTempLink(action, location, Link.TYPE_RESULT, resultConfig.getName());

                            View viewFile = getView(namespace, actionName, resultName, location);
                            if (viewFile != null) {
                                viewMap.put(view, viewFile);
                            }
                        }
                    } else if (resultClassName.indexOf("Jasper") != -1) {

                    } else if (resultClassName.indexOf("XSLT") != -1) {

                    } else if (resultClassName.indexOf("Redirect") != -1) {
                        // check if the redirect is to an action -- if so, link it
                        String location = getViewLocation((String) resultConfig.getParams().get("location"), namespace);
                        //  FIXME: work with new configuration style
                        if (location.endsWith("action")) {
                            addTempLink(action, location, Link.TYPE_REDIRECT, resultConfig.getName());
                        } else {
                            ViewNode view = new ViewNode(stripLocation(location));
                            subGraph.addNode(view);

                            addTempLink(action, location, Link.TYPE_REDIRECT, resultConfig.getName());

                            View viewFile = getView(namespace, actionName, resultName, location);
                            if (viewFile != null) {
                                viewMap.put(view, viewFile);
                            }
                        }
                    }
                }
            }
        }

        // now look for links in the view
        for (Iterator iterator = viewMap.entrySet().iterator(); iterator.hasNext();) {
            Map.Entry entry = (Map.Entry) iterator.next();
            ViewNode view = (ViewNode) entry.getKey();
            View viewFile = (View) entry.getValue();
            Set targets = viewFile.getTargets();
            for (Iterator iterator1 = targets.iterator(); iterator1.hasNext();) {
                Target target = (Target) iterator1.next();
                String viewTarget = target.getTarget();
                addTempLink(view, viewTarget, target.getType(), "");
            }
        }

        // finally, let's match up these links as real Link objects
        for (Iterator iterator = links.iterator(); iterator.hasNext();) {
            TempLink temp = (TempLink) iterator.next();
            String location = temp.location;
           
            // FIXME: work with new configuration style
            if (location.endsWith("action")) {
                location = location.substring(0, location.indexOf("action") - 1);

                if (location.indexOf('!') != -1) {
                    temp.label = temp.label + "\\n(" + location.substring(location.indexOf('!')) + ")";
                    location = location.substring(0, location.indexOf('!'));
                }
            }
            SiteGraphNode to = graph.findNode(location, temp.node);
            if (to != null) {
                graph.addLink(new Link(temp.node, to, temp.typeResult, temp.label));
            }
        }

        try {
            //writer.write(graph.to_s(true));
            graph.render(new IndentWriter(writer));
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.apache.tez.dag.utils.Graph

    Matcher m = sanitizeLabelPattern.matcher(label);
    return m.replaceAll("_");
  }

  private void generateDAGVizFile(TezDAGID dagId, DAGPlan dagPB) {
    Graph graph = new Graph(sanitizeLabelForViz(dagPB.getName()));

    for (VertexPlan v : dagPB.getVertexList()) {
      String nodeLabel = sanitizeLabelForViz(v.getName())
          + "[" + getShortClassName(v.getProcessorDescriptor().getClassName() + "]");
      Graph.Node n = graph.newNode(sanitizeLabelForViz(v.getName()), nodeLabel);
      for (DAGProtos.RootInputLeafOutputProto input : v.getInputsList()) {
        Graph.Node inputNode = graph.getNode(sanitizeLabelForViz(v.getName())
            + "_" + sanitizeLabelForViz(input.getName()));
        inputNode.setLabel(sanitizeLabelForViz(v.getName())
            + "[" + sanitizeLabelForViz(input.getName()) + "]");
        inputNode.setShape("box");
        inputNode.addEdge(n, "Input"
            + " [inputClass=" + getShortClassName(input.getIODescriptor().getClassName())
            + ", initializer=" + getShortClassName(input.getControllerDescriptor().getClassName()) + "]");
      }
      for (DAGProtos.RootInputLeafOutputProto output : v.getOutputsList()) {
        Graph.Node outputNode = graph.getNode(sanitizeLabelForViz(v.getName())
            + "_" + sanitizeLabelForViz(output.getName()));
        outputNode.setLabel(sanitizeLabelForViz(v.getName())
            + "[" + sanitizeLabelForViz(output.getName()) + "]");
        outputNode.setShape("box");
        n.addEdge(outputNode, "Output"
            + " [outputClass=" + getShortClassName(output.getIODescriptor().getClassName())
            + ", initializer=" + getShortClassName(output.getControllerDescriptor().getClassName()) + "]");
      }
    }

    for (DAGProtos.EdgePlan e : dagPB.getEdgeList()) {

      Graph.Node n = graph.getNode(sanitizeLabelForViz(e.getInputVertexName()));
      n.addEdge(graph.getNode(sanitizeLabelForViz(e.getOutputVertexName())),
          "["
          + "input=" + getShortClassName(e.getEdgeSource().getClassName())
          + ", output=" + getShortClassName(e.getEdgeDestination().getClassName())
          + ", dataMovement=" + e.getDataMovementType().name().trim()
          + ", schedulingType=" + e.getSchedulingType().name().trim() + "]");
    }

    String logDirs = System.getenv(Environment.LOG_DIRS.name());
    String outputFile = "";
    if (logDirs != null && !logDirs.isEmpty()) {
      int pos = logDirs.indexOf(",");
      if (pos != -1) {
        outputFile += logDirs.substring(0, pos);
      } else {
        outputFile += logDirs;
      }
      outputFile += File.separator;
    }
    outputFile += dagId.toString() + ".dot";

    try {
      LOG.info("Generating DAG graphviz file"
          + ", dagId=" + dagId.toString()
          + ", filePath=" + outputFile);
      graph.save(outputFile);
    } catch (Exception e) {
      LOG.warn("Error occurred when trying to save graph structure"
          + " for dag " + dagId.toString(), e);
    }
  }
View Full Code Here

Examples of org.archive.wayback.util.graph.Graph

   * @param width pixel width of resulting graph
   * @param height pixel height of resulting graph
   * @return String argument which will generate a graph for the results
   */
  public String computeGraphString(String formatKey, int width, int height) {
    Graph graph = PartitionsToGraph.partsOfPartsToGraph(yearPartitions,
        fmt,formatKey,width,height);
    return GraphEncoder.encode(graph);

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.