예제 #1
0
  public static Graph getGraph() {

    Graph g = Factory.createGraphMem();

    g.add(
        new Triple(
            NodeFactory.createURI("http://example.com/subject"),
            NodeFactory.createURI("http://example.com/predicate"),
            NodeFactory.createURI("http://example.com/object")));

    g.add(
        new Triple(
            NodeFactory.createBlankNode(BlankNodeId.create("a")),
            NodeFactory.createURI("http://example.com/p1"),
            NodeFactory.createBlankNode(BlankNodeId.create("b"))));

    g.add(
        new Triple(
            NodeFactory.createBlankNode(BlankNodeId.create("b")),
            NodeFactory.createURI("http://example.com/p2"),
            NodeFactory.createLiteral("foo")));

    g.add(
        new Triple(
            NodeFactory.createURI("http://example.com/ns/e"),
            NodeFactory.createURI("http://example.com/ns/p5"),
            NodeFactory.createLiteral("verify base works")));

    return g;
  }
예제 #2
0
 public Graph copy() {
   WeightedArcSet list = new WeightedArcSet();
   Constructor[] cons = WeightedArc.class.getDeclaredConstructors();
   for (int i = 0; i < cons.length; i++) cons[i].setAccessible(true);
   ArcLabelledNodeIterator it = graph.nodeIterator();
   while (it.hasNext()) {
     Integer aux1 = it.nextInt();
     Integer aux2 = null;
     ArcLabelledNodeIterator.LabelledArcIterator suc = it.successors();
     while ((aux2 = suc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         if (commit++ % COMMIT_SIZE == 0) {
           list.commit();
         }
         WeightedArc arc = (WeightedArc) cons[0].newInstance(aux2, aux1, suc.label().getFloat());
         list.add(arc);
       } catch (Exception ex) {
         throw new Error(ex);
       }
   }
   Graph result = new Graph(list.toArray(new WeightedArc[0]));
   result.nodes.clear();
   result.nodesReverse.clear();
   for (Integer n : this.nodes.keySet()) {
     if (commit++ % COMMIT_SIZE == 0) {
       result.commit();
     }
     result.nodesReverse.put(this.nodes.get(n), n);
     result.nodes.put(n, this.nodes.get(n));
   }
   return result;
 }
예제 #3
0
  /**
   * Constructs a new JGraph model adapter for the specified JGraphT graph.
   *
   * @param jGraphTGraph the JGraphT graph for which JGraph model adapter to be created. <code>null
   *     </code> is NOT permitted.
   * @param defaultVertexAttributes a default map of JGraph attributes to format vertices. <code>
   *     null</code> is NOT permitted.
   * @param defaultEdgeAttributes a default map of JGraph attributes to format edges. <code>null
   *     </code> is NOT permitted.
   * @param cellFactory a {@link CellFactory} to be used to create the JGraph cells. <code>null
   *     </code> is NOT permitted.
   * @throws IllegalArgumentException
   */
  public JGraphModelAdapter(
      Graph<V, E> jGraphTGraph,
      AttributeMap defaultVertexAttributes,
      AttributeMap defaultEdgeAttributes,
      CellFactory<V, E> cellFactory) {
    super();

    if ((jGraphTGraph == null)
        || (defaultVertexAttributes == null)
        || (defaultEdgeAttributes == null)
        || (cellFactory == null)) {
      throw new IllegalArgumentException("null is NOT permitted");
    }

    jtGraph = new ShieldedGraph(jGraphTGraph);
    setDefaultVertexAttributes(defaultVertexAttributes);
    setDefaultEdgeAttributes(defaultEdgeAttributes);
    this.cellFactory = cellFactory;

    if (jGraphTGraph instanceof ListenableGraph<?, ?>) {
      ListenableGraph<V, E> g = (ListenableGraph<V, E>) jGraphTGraph;
      g.addGraphListener(new JGraphTListener());
    }

    for (Iterator<V> i = jGraphTGraph.vertexSet().iterator(); i.hasNext(); ) {
      handleJGraphTAddedVertex(i.next());
    }

    for (Iterator<E> i = jGraphTGraph.edgeSet().iterator(); i.hasNext(); ) {
      handleJGraphTAddedEdge(i.next());
    }

    this.addGraphModelListener(new JGraphListener());
  }
  /**
   * M&eacute;todo para hacer el c&oacute;digo a partir del contenido de los v&eacute;rtices en el
   * grafo.
   */
  public boolean make() {

    boolean codeGenerated = false;

    for (int i = 0; i < graphs.size(); i++) {
      g = graphs.get(i);

      if (i == 0) {
        addGlobalVariables(g);
      }

      vertices = g.getVertices();
      edges = g.getEdges();
      head = g.getHead();

      if (head == null) {
        continue;
      }

      if (g.getNumVertices() > 0) {
        recurse(head);
        codeGenerated = true;
      } else {
        codeGenerated = false;
      }
    }

    return codeGenerated;
  }
  /**
   * Generates AdjacencyListGraph based on the values in the input file.
   *
   * @requires twitterStream is properly initialized
   * @param twitterStream initialized input stream for reading twitter file
   * @return generated graph based on input file
   */
  private static Graph readTwitterFile(FileInputStream twitterStream) {
    final int U1_INDEX = 0;
    final int U2_INDEX = 1;
    try {
      Graph g = new AdjacencyListGraph();
      BufferedReader twitterReader = new BufferedReader(new InputStreamReader(twitterStream));
      String line;
      while ((line = twitterReader.readLine()) != null) {

        // eliminate any unnecessary whitespace
        String[] columns = line.trim().replaceAll("\\s+", "").split("->");

        // first column is user 1
        // second column is user 2
        Vertex u1 = new Vertex(columns[U1_INDEX]);
        Vertex u2 = new Vertex(columns[U2_INDEX]);
        // System.out.println(columns[0]+","+columns[1]);
        g.addVertex(u1);
        g.addVertex(u2);
        g.addEdge(u1, u2);
        // System.out.println(line);
      }
      twitterReader.close();
      return g;
    } catch (Exception e) { // if something somehow goes wrong
      throw new RuntimeException(e);
    }
  }
  private Set<String> getDownstream(String mut) {
    Set<String> tfs = new HashSet<String>();
    tfs.add(mut);

    if (depth > 1) tfs.addAll(travSt.getDownstream(tfs, depth - 1));

    return travExp.getDownstream(tfs);
  }
예제 #7
0
 private void populateLists(List<Vertex> verticies, List<Edge> edges) {
   for (Vertex v : graph.getVertices()) {
     verticies.add(v);
   }
   for (Edge e : graph.getEdges()) {
     edges.add(e);
   }
 }
예제 #8
0
    E addEdge(V jtSource, V jtTarget) {
      E jtEdge = graph.getEdgeFactory().createEdge(jtSource, jtTarget);
      jtElementsBeingAdded.add(jtEdge);

      boolean added = graph.addEdge(jtSource, jtTarget, jtEdge);
      jtElementsBeingAdded.remove(jtEdge);

      return added ? jtEdge : null;
    }
예제 #9
0
 public Graph transpose() {
   Graph g = copy();
   try {
     g.graph = Transform.transposeOffline(g.graph, 1000);
     g.reverse = Transform.transposeOffline(g.reverse, 1000);
   } catch (IOException ex) {
     throw new Error(ex);
   }
   return g;
 }
예제 #10
0
 static String[] getOrderedEdgeLabels(Graph g) {
   Set labelSet = new HashSet();
   for (Iterator i = g.getNodeIterator(); i.hasNext(); ) {
     GraphId id = (GraphId) i.next();
     labelSet.addAll(g.getEdgeLabels(id));
   }
   log.debug(labelSet.size() + " labels in labelset.");
   String[] result = (String[]) labelSet.toArray(new String[labelSet.size()]);
   Arrays.sort(result);
   return result;
 }
예제 #11
0
 public static void main(String[] args) throws FileNotFoundException {
   Scanner in;
   if (args.length > 0) {
     File inputFile = new File(args[0]);
     in = new Scanner(inputFile);
   } else {
     in = new Scanner(System.in);
   }
   Graph g = readGraph(in);
   g.printGraph();
 }
  /**
   * M&eacute;todo que obtiene un arreglo de las tablas Hash de las variables Locales
   *
   * @param g Grafo <code>Vertex<StructV></code>
   */
  private ArrayList<Hashtable> getLocalVariables(Graph g) {

    ArrayList<Hashtable> localVariables = new ArrayList<Hashtable>();

    for (int i = 0; i < g.getNumVertices(); i++) {
      Sprite tempSprite = ((StructV) g.getVertexAt(i).getValue()).getSprite();
      Hashtable tempTable = (Hashtable) ((StructV) g.getVertexAt(i).getValue()).getValue();
      if (tempSprite instanceof SpriteVar) localVariables.add(tempTable);
    }
    return localVariables;
  }
예제 #13
0
  @SubscribeEvent
  public void tick(TickEvent.ServerTickEvent tick) {
    if (tick.phase != TickEvent.Phase.END) return;

    // Disable Task, if it is running and the server owner decided
    // to opt-out
    if (isOptOut()) {
      // Tell all plotters to stop gathering information.
      for (Graph graph : graphs) {
        graph.onOptOut();
      }

      FMLCommonHandler.instance().bus().unregister(this);
      return;
    }

    tickCount++;

    if (tickCount % (firstPost ? 100 : PING_INTERVAL * 1200) != 0) return;

    tickCount = 0;

    if (thrd == null) {
      thrd =
          new Thread(
              new Runnable() {
                public void run() {
                  try {
                    // We use the inverse of firstPost because if it
                    // is the first time we are posting,
                    // it is not a interval ping, so it evaluates to
                    // FALSE
                    // Each time thereafter it will evaluate to
                    // TRUE, i.e PING!
                    postPlugin(!firstPost);
                    // After the first post we set firstPost to
                    // false
                    // Each post thereafter will be a ping
                    firstPost = false;
                  } catch (IOException e) {
                    if (debug) {
                      FMLLog.info("[Metrics] Exception - %s", e.getMessage());
                    }
                  } finally {
                    thrd = null;
                  }
                }
              });
      thrd.start();
    }
  }
예제 #14
0
  static Graph readGraph(Scanner in) {
    // read the graph related parameters
    int n = in.nextInt(); // number of vertices in the graph
    int m = in.nextInt(); // number of edges in the graph

    // create a graph instance
    Graph g = new Graph(n);
    for (int i = 0; i < m; i++) {
      int u = in.nextInt();
      int v = in.nextInt();
      int w = in.nextInt();
      g.addEdge(u, v, w);
    }
    in.close();
    return g;
  }
예제 #15
0
  /**
   * Used to write Resources for a Subject. Literals will by-pass this method and use "Literal"
   * method.
   *
   * @param predicate PredicateNode
   * @param object ObjectNode
   * @param writer PrintWriter
   * @throws GraphException
   */
  protected void writeStatement(
      Graph graph,
      SubjectNode subject,
      PredicateNode predicate,
      ObjectNode object,
      PrintWriter writer)
      throws GraphException {

    // Literals are written differently
    if (object instanceof Literal) {

      this.writeStatement(graph, subject, predicate, (Literal) object, writer);
    } else if (object instanceof BlankNode) {

      // write as:  <predicateURI> *blank node as subject* </predicateURI>
      writer.println("    <" + this.getURI(predicate) + ">");

      // write blank node as a "subject"
      this.writeSubject(graph, (BlankNode) object, writer);

      writer.println("    </" + this.getURI(predicate) + ">");
    } else if (subject instanceof BlankNode) {

      // predicatNode representing RDF Type
      PredicateNode rdfTypeNode = null;

      try {

        rdfTypeNode = graph.getElementFactory().createResource(RDF.TYPE);
      } catch (GraphElementFactoryException factoryException) {

        throw new GraphException("Could not create RDF Type node.", factoryException);
      }

      // do not write the RDF Type element
      if (!rdfTypeNode.equals(predicate)) {

        // write as:  <predicateURI rdf:resource="resourceURI"/>
        writer.println(
            "    <"
                + this.getURI(predicate)
                + " "
                + RDF_PREFIX
                + ":resource=\""
                + this.getNodeString(object)
                + "\"/>");
      }
    } else {

      // write as:  <predicateURI rdf:resource="resourceURI"/>
      writer.println(
          "    <"
              + this.getURI(predicate)
              + " "
              + RDF_PREFIX
              + ":resource=\""
              + this.getNodeString(object)
              + "\"/>");
    }
  }
예제 #16
0
  public static void mixture() {
    Graph g = new Graph();

    int cnt = 5;

    for (int i = 0; i < cnt; i++) {
      GXYTNode gn = new GXYTNode();
      gn.init = new double[] {i, 0, 0};
      gn.state = LinAlg.copy(gn.init);
      gn.truth = new double[3];
      g.nodes.add(gn);

      if (i > 0) {
        double sig = 0.06;

        // wheel slippage mode
        GXYTEdge ge1 = new GXYTEdge();
        ge1.z = new double[] {0, 0, 0};
        ge1.P = LinAlg.diag(new double[] {sig, sig, sig});
        ge1.nodes = new int[] {i - 1, i};

        // nominal odometry
        GXYTEdge ge2 = new GXYTEdge();
        ge2.z = new double[] {1, 0, 0};
        ge2.P = LinAlg.diag(new double[] {sig, sig, sig});
        ge2.nodes = new int[] {i - 1, i};

        GEdgeMixture ge = new GEdgeMixture(new GEdge[] {ge1, ge2}, new double[] {0.05, 0.95});
        g.edges.add(ge);
      }
    }

    if (true) {
      GXYTEdge ge = new GXYTEdge();
      ge.z = new double[] {cnt, 0, 0};
      ge.P = LinAlg.diag(new double[] {0.1, 0.1, 0.1});
      ge.nodes = new int[] {0, g.nodes.size() - 1};
      g.edges.add(ge);
    }

    try {
      g.write("mixture.graph");
    } catch (IOException ex) {
      System.out.println("ex: " + ex);
    }
  }
  public static void main(String[] args) throws IOException {
    Graph graphSt;
    Graph graphExp;
    GiovannisAnalysis finder;
    Dataset1 dataset = Dataset1.THCA;
    int depth = 3;
    double fdrThr = 0.01;

    graphSt = PathwayCommons.getGraph(SIFEnum.CONTROLS_STATE_CHANGE_OF);
    graphExp = PathwayCommons.getGraph(SIFEnum.CONTROLS_EXPRESSION_OF);
    graphExp.merge(MSigDBTFT.getGraph());
    finder = new GiovannisAnalysis(graphSt, graphExp, dataset, depth, fdrThr);

    checkZeros(finder.expMan);

    finder.find();
  }
예제 #18
0
  protected void fileOpen() {
    JFileChooser chooser = null;
    if (currentFile == null) {
      chooser = new JFileChooser(startDirectory);
    } else {
      chooser = new JFileChooser(currentFile);
    }

    int returnVal = chooser.showOpenDialog(gw);
    if (returnVal == JFileChooser.APPROVE_OPTION) {

      graph.clear();
      currentFile = chooser.getSelectedFile();
      graph.loadAll(currentFile);
      gp.update(gp.getGraphics());
    }
  }
예제 #19
0
파일: Main.java 프로젝트: mohitpunjabi/spoj
  public static void main(String args[]) throws Exception {
    StringTokenizer tokenizer = new StringTokenizer(in.readLine());
    int n = Integer.parseInt(tokenizer.nextToken()), m = Integer.parseInt(tokenizer.nextToken());

    Graph graph = new Graph(n, m);
    for (long i = 0; i < m; i++) {
      tokenizer = new StringTokenizer(in.readLine());
      int from = Integer.parseInt(tokenizer.nextToken()),
          to = Integer.parseInt(tokenizer.nextToken());

      graph.connect(from, to);
    }

    output(graph, n);
    out.println();
    out.flush();
  }
예제 #20
0
 protected void fileNew() {
   if (currentFile != null) {
     if (!currentFile.isDirectory()) {
       currentFile = currentFile.getParentFile();
     }
   }
   graph.clear();
   gp.update(gp.getGraphics());
 }
예제 #21
0
  /**
   * Finds the RDF Type for a given subject.
   *
   * @param graph Graph
   * @param subject SubjectNode
   * @throws GraphException
   * @return ObjectNode
   */
  protected ObjectNode getSubjectType(Graph graph, SubjectNode subject) throws GraphException {

    // value to be returned
    ObjectNode type = null;

    // validate graph
    if ((graph == null)) {
      throw new IllegalArgumentException("Graph argument must not be null.");
    }

    // predicatNode representing RDF Type
    PredicateNode rdfType = null;

    try {
      rdfType = graph.getElementFactory().createResource(RDF.TYPE);
    } catch (GraphElementFactoryException factoryException) {

      throw new GraphException("Could not create RDF Type node.", factoryException);
    }

    // get the Subject's RDF type
    ClosableIterator<Triple> typeIter = graph.find(subject, rdfType, null);

    if (typeIter != null) {

      // validate "first" triple and extract it's object (rdf type)
      if (typeIter.hasNext()) {

        Triple typeTriple = typeIter.next();

        if (typeTriple != null) {
          type = ((Triple) typeTriple).getObject();
        } else {
          throw new GraphException(
              "Could not find RDF type for Subject: " + subject + " . Invalid Triple returned.");
        }
      }

      // close the Iterator
      typeIter.close();
    }

    return type;
  }
예제 #22
0
 static GraphId[] getOrderedIds(Graph g) {
   List idList = new ArrayList();
   for (Iterator i = g.getNodeIterator(); i.hasNext(); ) {
     GraphId id = (GraphId) i.next();
     idList.add(id.toString());
   }
   GraphId[] result = (GraphId[]) idList.toArray(new GraphId[idList.size()]);
   Arrays.sort(result);
   return result;
 }
예제 #23
0
 private static boolean checkConstraints(int nodes, int n) {
   int neighbours[] = g.getNeighbours(n);
   for (int j = 0; j < neighbours.length; j++) {
     if (neighbours[j] == 1) {
       if (colorOfNode[n] == colorOfNode[j]) return false;
     }
   }
   pruneTheDomain(nodes);
   return true;
 }
예제 #24
0
  public static void main(String[] args) {

    if (args.length != 1) {
      System.out.println("Usage: java Msp <filename>");
      System.exit(2);
    }
    Graph g = new Graph();
    loadFile(g, args[0]);

    // Calculate locations of nodes
    g.prepareNodes();
    // Perform kruskal algorithm
    g.kruskal();

    // Show results in JFrame
    MainWindow f = new MainWindow(g);
    f.setSize(800, 600);
    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
예제 #25
0
파일: Graph.java 프로젝트: karthikrk1/IADSA
  /**
   * Method the read the input from Scanner and create a Graph
   *
   * @param in : Scanner object to read the input from
   * @param directed : Boolean flag - when set to true, graph is a directed graph.
   * @return : Returns a graph.
   */
  public static Graph<Vertex> readGraph(Scanner in, boolean directed) {
    // read the graph related parameters
    // System.out.println("Enter number of vertices:");
    int n = in.nextInt(); // number of vertices in the graph
    // System.out.println("Enter number of edges: ");
    int m = in.nextInt(); // number of edges in the graph

    // create a graph instance
    Graph<Vertex> g = new Graph<>(n);
    for (int i = 0; i < m; i++) {
      // System.out.println("Enter the nodes connected by edge "+(i+1)+" followed by cost of edge
      // ");
      int u = in.nextInt();
      int v = in.nextInt();
      int w = in.nextInt();
      g.addEdge(u, v, w);
    }

    return g;
  }
예제 #26
0
파일: Graph.java 프로젝트: safdariqbal/frex
  /* Processing assignments of actuals to formals at a call
  site. The first parameter is the call instruction. The second
  is the formal parameter. The last two represent the variable or
  the field being passed.

  For return values, the second parameter is the formal return
  variable in the callee, and the last two parameters are the
  variable/field that the call is assigned to. */
  public void assignParams(Call call, Var p, Var x, Field f, boolean isBasic) {

    if (!isBasic) {
      Method callee = call.getCallee();
      Graph gcallee = PointsToAnalysis.v().getGraph(callee);

      Node nodeL = gcallee.getNode(p, null);
      Node nodeR = this.getNode(x, f);
      if (Options.mergeGraphs.value && this == gcallee) {
        if (p.isReturn()) w.addFirst(new UnifyConstraint(nodeR, nodeL));
        else w.addFirst(new UnifyConstraint(nodeL, nodeR));
      }
      callsites.add(call);
      callees.add(callee);
      gcallee.callers.add(method);
      gcallee.w.add(new CallConstraint(nodeR, nodeL, call));
    }

    if (f != null) setTouched(x);
  }
예제 #27
0
 protected void fileSave() {
   if (currentFile == null) {
     fileSaveAs();
   } else {
     if (currentFile.isDirectory()) {
       fileSaveAs();
     } else {
       graph.saveAll(currentFile);
       gp.update(gp.getGraphics());
     }
   }
 }
예제 #28
0
 public static void loadFile(Graph g, String fileName) {
   System.out.println("Reading date from " + fileName);
   try {
     BufferedReader input = new BufferedReader(new FileReader(fileName));
     try {
       String line = null;
       int index = 0;
       System.out.println("Graph...");
       while ((line = input.readLine()) != null) {
         if (line.trim().equals("#EDGES")) break;
         String[] arr = line.split(" ");
         System.out.println("Graph Line " + index + ":  " + line);
         Vertex n = null;
         Vertex node = null;
         for (int j = 0; j < arr.length; j++) {
           n = new Vertex(arr[j]);
           node = g.findNode(n);
           if (node == null) g.addNode(n, index);
         }
         index++;
       }
       System.out.println("Edges...");
       while ((line = input.readLine()) != null) {
         String[] arr = line.split(" ");
         System.out.println("[" + arr[0] + " - " + arr[1] + "] - Cost: " + arr[2]);
         Vertex n = new Vertex(arr[0]);
         Vertex left = g.findNode(n);
         n = new Vertex(arr[1]);
         Vertex right = g.findNode(n);
         g.addEdge(left, right, Integer.parseInt(arr[2]));
       }
     } finally {
       input.close();
     }
   } catch (Exception e) {
   }
 }
예제 #29
0
  public static void nomixture() {
    Graph g = new Graph();

    int cnt = 5;

    double u = 0.95;
    double sig = 0.1075;

    for (int i = 0; i < cnt; i++) {
      GXYTNode gn = new GXYTNode();
      gn.init = new double[] {i, 0, 0};
      gn.state = LinAlg.copy(gn.init);
      g.nodes.add(gn);

      if (i > 0) {
        GXYTEdge ge = new GXYTEdge();
        ge.z = new double[] {0.95, 0, 0};
        ge.P = LinAlg.diag(new double[] {sig, sig, sig});
        ge.nodes = new int[] {i - 1, i};
        g.edges.add(ge);
      }
    }

    if (true) {
      GXYTEdge ge = new GXYTEdge();
      ge.z = new double[] {0, 0, 0};
      ge.P = LinAlg.diag(new double[] {0.1, 0.1, 0.1});
      ge.nodes = new int[] {0, g.nodes.size() - 1};
      g.edges.add(ge);
    }

    try {
      g.write("nomixture.graph");
    } catch (IOException ex) {
      System.out.println("ex: " + ex);
    }
  }
예제 #30
0
  /**
   * Populates the namespaces map with default namespaces and namespaces used by the graph.
   *
   * @param graph Graph
   * @throws GraphException
   */
  protected void populateNamespaces(Graph graph) throws GraphException {

    // default namespaces
    namespaces = new HashMap<String, String>();
    namespaces.put(RDF_PREFIX, RDF.BASE_URI.toString());
    namespaces.put(RDFS_PREFIX, RDFS.BASE_URI.toString());
    namespaces.put("owl", "http://www.w3.org/2002/07/owl#");
    namespaces.put("dc", "http://purl.org/dc/elements/1.1/");

    // validate graph before reading
    if (graph == null) {
      throw new IllegalArgumentException("Graph argument is null.");
    }

    // get all statements
    ClosableIterator<Triple> tripleIter = graph.find(null, null, null);

    if (tripleIter != null) {

      while (tripleIter.hasNext()) {

        // get the next triple
        Triple triple = tripleIter.next();

        if (triple != null) {

          // evaluate subject
          SubjectNode subject = triple.getSubject();
          if (subject instanceof URIReference) {
            addNamespaceURI(((URIReference) subject).getURI());
          }

          // evaluate predicate (must be URIReference)
          PredicateNode predicate = triple.getPredicate();
          addNamespaceURI(((URIReference) predicate).getURI());

          // evaluate object
          ObjectNode object = triple.getObject();
          if (object instanceof URIReference) {
            addNamespaceURI(((URIReference) object).getURI());
          }
        }
      }

      // close the Iterator
      tripleIter.close();
    }
  }