Esempio n. 1
0
 @Test
 public void testMapThd() {
   @SuppressWarnings("unchecked")
   Triple<Integer, Integer, Integer>[] triples =
       new Triple[] {triple(1, 3, 10), triple(2, 6, 9), triple(3, 9, 8)};
   Integer[] fsts = new Integer[] {10, 9, 8};
   assertArrayEquals(fsts, Triple.mapThd(triples));
   assertEquals(Arrays.asList(fsts), Triple.mapThd(Arrays.asList(triples)));
 }
Esempio n. 2
0
 public void extractInto(Node root) {
   active.add(root);
   Iterator<Triple> it = extractFrom.find(root, Node.ANY, Node.ANY);
   while (it.hasNext()) {
     Triple t = it.next();
     Node subRoot = t.getObject();
     toUpdate.add(t);
     if (!(active.contains(subRoot) || b.stopAt(t))) extractInto(subRoot);
   }
 }
Esempio n. 3
0
 public void testKevinCaseB() {
   Graph G = getGraph();
   Node X = node("x"), Y = node("y");
   Node a = node("a"), b = node("b"), c = node("c");
   G.add(Triple.create(X, RDF.Nodes.subject, Y));
   try {
     ReifierStd.reifyAs(G, X, Triple.create(a, b, c));
     fail("X already has subject Y: cannot make it a");
   } catch (CannotReifyException e) {
     pass();
   }
 }
Esempio n. 4
0
 // Output in .rc form
 public String toString() {
   StringBuilder rc = new StringBuilder();
   for (String key : keySet()) {
     List<Triple> list = getTriples(key);
     for (Triple triple : list) {
       String line = triple.toString();
       rc.append(line);
       rc.append("\n");
     }
   }
   return rc.toString();
 }
 ReificationStatementMask(Triple t) {
   mask = HasNada;
   Node p = t.getPredicate();
   if (p != null) {
     if (p.equals(RDF.Nodes.subject)) mask = HasSubj;
     else if (p.equals(RDF.Nodes.predicate)) mask = HasPred;
     else if (p.equals(RDF.Nodes.object)) mask = HasObj;
     else if (p.equals(RDF.Nodes.type)) {
       Node o = t.getObject();
       if (o.equals(RDF.Nodes.Statement)) mask = HasType;
     }
   }
 }
Esempio n. 6
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();
    }
  }
Esempio n. 7
0
  @Test
  public void testTriple() {
    Triple<String, String, String> o1 = new Triple<String, String, String>();

    o1.setFirst("first");
    o1.setMiddle("middle");
    o1.setLast("last");

    Triple<String, String, String> o2 =
        new Triple<String, String, String>("first", "middle", "last");

    Assert.assertEquals(o1, o2);
    Assert.assertEquals(o1.hashCode(), o2.hashCode());
    Assert.assertEquals(o1.toString(), o2.toString());
  }
Esempio n. 8
0
  private void addColliders(
      Graph graph, final SepsetProducer sepsetProducer, IKnowledge knowledge) {
    final Map<Triple, Double> collidersPs =
        findCollidersUsingSepsets(sepsetProducer, graph, verbose, knowledge);

    List<Triple> colliders = new ArrayList<>(collidersPs.keySet());

    Collections.shuffle(colliders);

    Collections.sort(
        colliders,
        new Comparator<Triple>() {
          public int compare(Triple o1, Triple o2) {
            return -Double.compare(collidersPs.get(o1), collidersPs.get(o2));
          }
        });

    if (trueDag != null) {
      for (Triple collider : colliders) {
        Node a = collider.getX();
        Node b = collider.getY();
        Node c = collider.getZ();

        List<Node> sep = trueDag.getSepset(a, c);

        System.out.println(
            "JJJ "
                + collider
                + " collider = "
                + (sep != null && !sep.contains(b))
                + " p = "
                + collidersPs.get(collider));
      }
    }

    for (Triple collider : colliders) {
      Node a = collider.getX();
      Node b = collider.getY();
      Node c = collider.getZ();

      if (!(isArrowpointAllowed(a, b, knowledge) && isArrowpointAllowed(c, b, knowledge))) {
        continue;
      }

      if (!graph.getEdge(a, b).pointsTowards(a) && !graph.getEdge(b, c).pointsTowards(c)) {
        graph.setEndpoint(a, b, Endpoint.ARROW);
        graph.setEndpoint(c, b, Endpoint.ARROW);
      }
    }
  }
Esempio n. 9
0
 public void addAll(final NestedMap2<K1, K2, V> nestedMap) {
   for (final Triple<K1, K2, V> triple : nestedMap.entrySet()) {
     this.put(triple.getFirst(), triple.getSecond(), triple.getThird());
   }
 }
  /**
   * The core implementation of the search.
   *
   * @param root The root word to search from. Traditionally, this is the root of the sentence.
   * @param candidateFragments The callback for the resulting sentence fragments. This is a
   *     predicate of a triple of values. The return value of the predicate determines whether we
   *     should continue searching. The triple is a triple of
   *     <ol>
   *       <li>The log probability of the sentence fragment, according to the featurizer and the
   *           weights
   *       <li>The features along the path to this fragment. The last element of this is the
   *           features from the most recent step.
   *       <li>The sentence fragment. Because it is relatively expensive to compute the resulting
   *           tree, this is returned as a lazy {@link Supplier}.
   *     </ol>
   *
   * @param classifier The classifier for whether an arc should be on the path to a clause split, a
   *     clause split itself, or neither.
   * @param featurizer The featurizer to use. Make sure this matches the weights!
   * @param actionSpace The action space we are allowed to take. Each action defines a means of
   *     splitting a clause on a dependency boundary.
   */
  protected void search(
      // The root to search from
      IndexedWord root,
      // The output specs
      final Predicate<Triple<Double, List<Counter<String>>, Supplier<SentenceFragment>>>
          candidateFragments,
      // The learning specs
      final Classifier<ClauseSplitter.ClauseClassifierLabel, String> classifier,
      Map<String, ? extends List<String>> hardCodedSplits,
      final Function<Triple<State, Action, State>, Counter<String>> featurizer,
      final Collection<Action> actionSpace,
      final int maxTicks) {
    // (the fringe)
    PriorityQueue<Pair<State, List<Counter<String>>>> fringe = new FixedPrioritiesPriorityQueue<>();
    // (avoid duplicate work)
    Set<IndexedWord> seenWords = new HashSet<>();

    State firstState =
        new State(null, null, -9000, null, x -> {}, true); // First state is implicitly "done"
    fringe.add(Pair.makePair(firstState, new ArrayList<>(0)), -0.0);
    int ticks = 0;

    while (!fringe.isEmpty()) {
      if (++ticks > maxTicks) {
        //        System.err.println("WARNING! Timed out on search with " + ticks + " ticks");
        return;
      }
      // Useful variables
      double logProbSoFar = fringe.getPriority();
      assert logProbSoFar <= 0.0;
      Pair<State, List<Counter<String>>> lastStatePair = fringe.removeFirst();
      State lastState = lastStatePair.first;
      List<Counter<String>> featuresSoFar = lastStatePair.second;
      IndexedWord rootWord = lastState.edge == null ? root : lastState.edge.getDependent();

      // Register thunk
      if (lastState.isDone) {
        if (!candidateFragments.test(
            Triple.makeTriple(
                logProbSoFar,
                featuresSoFar,
                () -> {
                  SemanticGraph copy = new SemanticGraph(tree);
                  lastState
                      .thunk
                      .andThen(
                          x -> {
                            // Add the extra edges back in, if they don't break the tree-ness of the
                            // extraction
                            for (IndexedWord newTreeRoot : x.getRoots()) {
                              if (newTreeRoot != null) { // what a strange thing to have happen...
                                for (SemanticGraphEdge extraEdge :
                                    extraEdgesByGovernor.get(newTreeRoot)) {
                                  assert Util.isTree(x);
                                  //noinspection unchecked
                                  addSubtree(
                                      x,
                                      newTreeRoot,
                                      extraEdge.getRelation().toString(),
                                      tree,
                                      extraEdge.getDependent(),
                                      tree.getIncomingEdgesSorted(newTreeRoot));
                                  assert Util.isTree(x);
                                }
                              }
                            }
                          })
                      .accept(copy);
                  return new SentenceFragment(copy, assumedTruth, false);
                }))) {
          break;
        }
      }

      // Find relevant auxilliary terms
      SemanticGraphEdge subjOrNull = null;
      SemanticGraphEdge objOrNull = null;
      for (SemanticGraphEdge auxEdge : tree.outgoingEdgeIterable(rootWord)) {
        String relString = auxEdge.getRelation().toString();
        if (relString.contains("obj")) {
          objOrNull = auxEdge;
        } else if (relString.contains("subj")) {
          subjOrNull = auxEdge;
        }
      }

      // Iterate over children
      // For each outgoing edge...
      for (SemanticGraphEdge outgoingEdge : tree.outgoingEdgeIterable(rootWord)) {
        // Prohibit indirect speech verbs from splitting off clauses
        // (e.g., 'said', 'think')
        // This fires if the governor is an indirect speech verb, and the outgoing edge is a ccomp
        if (outgoingEdge.getRelation().toString().equals("ccomp")
            && ((outgoingEdge.getGovernor().lemma() != null
                    && INDIRECT_SPEECH_LEMMAS.contains(outgoingEdge.getGovernor().lemma()))
                || INDIRECT_SPEECH_LEMMAS.contains(outgoingEdge.getGovernor().word()))) {
          continue;
        }
        // Get some variables
        String outgoingEdgeRelation = outgoingEdge.getRelation().toString();
        List<String> forcedArcOrder = hardCodedSplits.get(outgoingEdgeRelation);
        if (forcedArcOrder == null && outgoingEdgeRelation.contains(":")) {
          forcedArcOrder =
              hardCodedSplits.get(
                  outgoingEdgeRelation.substring(0, outgoingEdgeRelation.indexOf(":")) + ":*");
        }
        boolean doneForcedArc = false;
        // For each action...
        for (Action action :
            (forcedArcOrder == null ? actionSpace : orderActions(actionSpace, forcedArcOrder))) {
          // Check the prerequisite
          if (!action.prerequisitesMet(tree, outgoingEdge)) {
            continue;
          }
          if (forcedArcOrder != null && doneForcedArc) {
            break;
          }
          // 1. Compute the child state
          Optional<State> candidate =
              action.applyTo(tree, lastState, outgoingEdge, subjOrNull, objOrNull);
          if (candidate.isPresent()) {
            double logProbability;
            ClauseClassifierLabel bestLabel;
            Counter<String> features =
                featurizer.apply(Triple.makeTriple(lastState, action, candidate.get()));
            if (forcedArcOrder != null && !doneForcedArc) {
              logProbability = 0.0;
              bestLabel = ClauseClassifierLabel.CLAUSE_SPLIT;
              doneForcedArc = true;
            } else if (features.containsKey("__undocumented_junit_no_classifier")) {
              logProbability = Double.NEGATIVE_INFINITY;
              bestLabel = ClauseClassifierLabel.CLAUSE_INTERM;
            } else {
              Counter<ClauseClassifierLabel> scores = classifier.scoresOf(new RVFDatum<>(features));
              if (scores.size() > 0) {
                Counters.logNormalizeInPlace(scores);
              }
              String rel = outgoingEdge.getRelation().toString();
              if ("nsubj".equals(rel) || "dobj".equals(rel)) {
                scores.remove(
                    ClauseClassifierLabel.NOT_A_CLAUSE); // Always at least yield on nsubj and dobj
              }
              logProbability = Counters.max(scores, Double.NEGATIVE_INFINITY);
              bestLabel = Counters.argmax(scores, (x, y) -> 0, ClauseClassifierLabel.CLAUSE_SPLIT);
            }

            if (bestLabel != ClauseClassifierLabel.NOT_A_CLAUSE) {
              Pair<State, List<Counter<String>>> childState =
                  Pair.makePair(
                      candidate.get().withIsDone(bestLabel),
                      new ArrayList<Counter<String>>(featuresSoFar) {
                        {
                          add(features);
                        }
                      });
              // 2. Register the child state
              if (!seenWords.contains(childState.first.edge.getDependent())) {
                //            System.err.println("  pushing " + action.signature() + " with " +
                // argmax.first.edge);
                fringe.add(childState, logProbability);
              }
            }
          }
        }
      }

      seenWords.add(rootWord);
    }
    //    System.err.println("Search finished in " + ticks + " ticks and " + classifierEvals + "
    // classifier evaluations.");
  }
Esempio n. 11
0
 public void testKevinCaseA() {
   Graph G = getGraph();
   Node X = node("x"), a = node("a"), b = node("b"), c = node("c");
   G.add(Triple.create(X, RDF.Nodes.type, RDF.Nodes.Statement));
   ReifierStd.reifyAs(G, X, Triple.create(a, b, c));
 }
Esempio n. 12
0
  /**
   * Prepare the world for the start of the program. That is: create the initial objects and add
   * them to the world.
   */
  private void prepare() {
    Small small = new Small();
    addObject(small, 127, 105);
    Big big = new Big();
    addObject(big, 843, 121);
    small.setLocation(113, 95);
    big.setLocation(860, 113);
    big.setLocation(885, 111);
    Number_5 number_5 = new Number_5();
    addObject(number_5, 157, 288);
    Number_4 number_4 = new Number_4();
    addObject(number_4, 69, 297);
    number_5.setLocation(167, 295);
    Number_6 number_6 = new Number_6();
    addObject(number_6, 273, 300);
    number_6.setLocation(266, 295);
    Number_7 number_7 = new Number_7();
    addObject(number_7, 369, 303);
    number_7.setLocation(361, 298);
    Number_8 number_8 = new Number_8();
    addObject(number_8, 463, 300);
    number_8.setLocation(456, 298);
    Number_9 number_9 = new Number_9();
    addObject(number_9, 559, 305);
    Number_10 number_10 = new Number_10();
    addObject(number_10, 659, 312);
    Number_11 number_11 = new Number_11();
    addObject(number_11, 767, 312);
    Number_12 number_12 = new Number_12();
    addObject(number_12, 872, 315);
    number_9.setLocation(552, 298);
    number_10.setLocation(650, 300);
    number_11.setLocation(747, 299);
    number_12.setLocation(843, 302);
    Number_13 number_13 = new Number_13();
    addObject(number_13, 950, 306);
    number_13.setLocation(942, 303);
    Combo1And2 combo1and2 = new Combo1And2();
    addObject(combo1and2, 173, 478);
    Combo5And6 combo5and6 = new Combo5And6();
    addObject(combo5and6, 948, 480);
    combo1and2.setLocation(149, 467);
    combo5and6.setLocation(948, 472);

    Number_14 number_14 = new Number_14();
    addObject(number_14, 1046, 311);
    number_14.setLocation(1039, 303);
    Number_15 number_15 = new Number_15();
    addObject(number_15, 1145, 308);
    number_15.setLocation(1138, 303);
    Number_16 number_16 = new Number_16();
    addObject(number_16, 1245, 310);
    number_16.setLocation(1238, 305);
    Number_17 number_17 = new Number_17();
    addObject(number_17, 1342, 309);
    number_17.setLocation(1336, 303);
    big.setLocation(1277, 101);
    big.setLocation(1283, 104);
    small.setLocation(114, 101);
    big.setLocation(1287, 101);
    combo1and2.setLocation(162, 467);
    combo5and6.setLocation(943, 472);
    Combo1And2 combo1and22 = new Combo1And2();
    addObject(combo1and22, 1237, 683);
    removeObject(combo1and22);
    TwoDie twodie = new TwoDie();
    addObject(twodie, 76, 467);
    Combo1And3 combo1and3 = new Combo1And3();
    addObject(combo1and3, 251, 475);
    combo1and3.setLocation(243, 469);
    Combo1And4 combo1and4 = new Combo1And4();
    addObject(combo1and4, 331, 476);
    combo1and4.setLocation(325, 469);
    Combo1And5 combo1and5 = new Combo1And5();
    addObject(combo1and5, 409, 477);
    combo1and5.setLocation(402, 468);
    Combo1And6 combo1and6 = new Combo1And6();
    addObject(combo1and6, 493, 475);
    combo1and6.setLocation(487, 469);
    combo1and5.setLocation(404, 470);
    combo1and6.setLocation(486, 470);
    Combo2And3 combo2and3 = new Combo2And3();
    addObject(combo2and3, 570, 473);
    combo2and3.setLocation(565, 470);
    Combo2And4 combo2and4 = new Combo2And4();
    addObject(combo2and4, 653, 476);
    combo2and4.setLocation(646, 470);
    Combo2And6 combo2and6 = new Combo2And6();
    addObject(combo2and6, 824, 479);
    Combo2And5 combo2and5 = new Combo2And5();
    addObject(combo2and5, 734, 480);
    combo2and5.setLocation(726, 471);
    combo2and6.setLocation(802, 471);
    Combo3And4 combo3and4 = new Combo3And4();
    addObject(combo3and4, 885, 478);
    combo5and6.setLocation(1039, 472);
    combo3and4.setLocation(883, 472);
    combo2and5.setLocation(726, 471);
    Combo1And5 combo1and52 = new Combo1And5();
    addObject(combo1and52, 1233, 659);
    removeObject(combo1and52);
    Combo3And6 combo3and6 = new Combo3And6();
    addObject(combo3and6, 968, 478);
    combo3and6.setLocation(961, 471);
    combo5and6.setLocation(1305, 478);
    Combo4And6 combo4and6 = new Combo4And6();
    addObject(combo4and6, 1131, 481);
    combo5and6.setLocation(1211, 474);
    combo4and6.setLocation(1130, 477);
    Combo4And5 combo4and5 = new Combo4And5();
    addObject(combo4and5, 1049, 479);
    combo4and5.setLocation(1040, 473);
    combo4and6.setLocation(1118, 474);
    combo5and6.setLocation(1196, 473);
    combo1and2.setLocation(162, 467);
    combo2and5.setLocation(726, 475);
    combo3and6.setLocation(961, 473);
    combo3and4.setLocation(883, 474);
    combo2and6.setLocation(805, 473);
    combo3and6.setLocation(961, 473);
    combo5and6.setLocation(1197, 472);
    Combo1And1 combo1and1 = new Combo1And1();
    addObject(combo1and1, 274, 131);
    Combo2And2 combo2and2 = new Combo2And2();
    addObject(combo2and2, 368, 140);
    combo2and2.setLocation(363, 131);
    Combo3And3 combo3and3 = new Combo3And3();
    addObject(combo3and3, 459, 137);
    combo3and3.setLocation(454, 132);
    OneWinsEleven onewinseleven = new OneWinsEleven();
    addObject(onewinseleven, 1038, 736);
    removeObject(onewinseleven);
    EachDoubleOneWinsEleven eachdoubleonewinseleven = new EachDoubleOneWinsEleven();
    addObject(eachdoubleonewinseleven, 363, 38);
    eachdoubleonewinseleven.setLocation(360, 33);
    Combo6And6 combo6and6 = new Combo6And6();
    addObject(combo6and6, 1136, 130);
    number_15.setLocation(1136, 298);
    number_16.setLocation(1235, 299);
    number_17.setLocation(1330, 300);
    number_14.setLocation(1039, 298);
    number_13.setLocation(942, 295);
    number_12.setLocation(842, 296);
    number_11.setLocation(748, 294);
    number_12.setLocation(844, 296);
    number_10.setLocation(650, 295);
    number_8.setLocation(456, 297);
    combo2and3.setLocation(564, 468);
    combo2and4.setLocation(646, 467);
    combo2and5.setLocation(726, 470);
    combo2and6.setLocation(804, 471);
    combo3and4.setLocation(883, 472);
    combo3and6.setLocation(960, 469);
    combo4and5.setLocation(1039, 468);
    combo4and6.setLocation(1118, 468);
    combo4and5.setLocation(1039, 468);
    combo5and6.setLocation(1198, 467);
    Combo5And5 combo5and5 = new Combo5And5();
    addObject(combo5and5, 1042, 136);
    combo5and5.setLocation(1043, 132);
    Combo4And4 combo4and4 = new Combo4And4();
    addObject(combo4and4, 950, 136);
    combo4and4.setLocation(949, 133);
    combo4and4.setLocation(950, 130);
    EachDoubleOneWinsEleven eachdoubleonewinseleven2 = new EachDoubleOneWinsEleven();
    addObject(eachdoubleonewinseleven2, 1054, 35);
    eachdoubleonewinseleven2.setLocation(1041, 33);
    combo2and4.setLocation(646, 470);
    combo2and5.setLocation(728, 473);
    combo3and6.setLocation(961, 469);
    combo4and5.setLocation(1040, 471);
    combo4and6.setLocation(1119, 471);
    combo5and6.setLocation(1198, 470);
    SicBoTiles tiles = new SicBoTiles();
    Dice dice_1 = new Dice_1();
    dice_1.addObserver(tiles);
    addObject(dice_1, 570, 139);
    dice_1.setLocation(568, 140);
    Dice dice_2 = new Dice_2();
    dice_2.addObserver(tiles);
    addObject(dice_2, 684, 150);
    dice_2.setLocation(679, 146);
    dice_2.setLocation(678, 145);
    Dice dice_3 = new Dice_3();
    dice_3.addObserver(tiles);
    addObject(dice_3, 828, 145);
    dice_2.setLocation(686, 130);
    dice_1.setLocation(587, 125);
    dice_3.setLocation(799, 130);
    dice_2.setLocation(693, 129);
    dice_3.setLocation(811, 129);
    dice_2.setLocation(699, 129);
    dice_3.setLocation(820, 129);
    dice_2.setLocation(704, 128);
    Triple triple = new Triple();
    addObject(triple, 49, 605);
    triple.setLocation(359, 752);

    dice_3.setLocation(819, 125);
    dice_2.setLocation(704, 127);
    dice_1.setLocation(588, 124);
    dice_1.setLocation(589, 139);
    dice_2.setLocation(704, 144);
    dice_3.setLocation(818, 144);
    SingleValue_1 singlevalue_1 = new SingleValue_1();
    addObject(singlevalue_1, 215, 645);
    singlevalue_1.setLocation(201, 589);
    SingleValue_2 singlevalue_2 = new SingleValue_2();
    addObject(singlevalue_2, 392, 593);
    singlevalue_2.setLocation(384, 589);
    singlevalue_2.setLocation(384, 588);
    SingleValue_3 singlevalue_3 = new SingleValue_3();
    addObject(singlevalue_3, 574, 598);
    singlevalue_3.setLocation(567, 592);
    singlevalue_2.setLocation(385, 592);
    singlevalue_1.setLocation(201, 595);
    SingleValue_4 singlevalue_4 = new SingleValue_4();
    addObject(singlevalue_4, 760, 599);
    singlevalue_4.setLocation(749, 592);
    SingleValue_5 singlevalue_5 = new SingleValue_5();
    addObject(singlevalue_5, 947, 596);
    singlevalue_5.setLocation(934, 592);
    SingleValue_6 singlevalue_6 = new SingleValue_6();
    addObject(singlevalue_6, 1134, 598);
    singlevalue_6.setLocation(1120, 590);
    singlevalue_2.setLocation(387, 594);
    singlevalue_3.setLocation(569, 593);
    singlevalue_4.setLocation(755, 593);
    singlevalue_6.setLocation(1141, 590);
    singlevalue_5.setLocation(944, 592);
    singlevalue_6.setLocation(1134, 593);
    singlevalue_3.setLocation(570, 596);
    singlevalue_5.setLocation(961, 789);
    singlevalue_4.setLocation(722, 766);
    singlevalue_3.setLocation(494, 754);
    singlevalue_2.setLocation(326, 758);
    singlevalue_6.setLocation(1145, 593);
    singlevalue_4.setLocation(714, 629);
    singlevalue_5.setLocation(955, 595);
    singlevalue_4.setLocation(762, 595);
    singlevalue_3.setLocation(574, 596);
    singlevalue_2.setLocation(389, 596);
    singlevalue_4.setLocation(763, 597);
    singlevalue_5.setLocation(956, 596);
    singlevalue_6.setLocation(1144, 594);
    OneIsToOne oneistoone = new OneIsToOne();
    addObject(oneistoone, 306, 678);
    oneistoone.setLocation(299, 671);
    TwoIsToOne twoistoone = new TwoIsToOne();
    addObject(twoistoone, 680, 678);
    twoistoone.setLocation(677, 671);
    ThreeIsToOne threeistoone = new ThreeIsToOne();
    addObject(threeistoone, 1060, 676);
    threeistoone.setLocation(1054, 670);
    IPlayer nobody = new Nobody();
    Display disp = new Display(nobody);
    ScoreBoard scoreboard = new ScoreBoard(disp);
    addObject(scoreboard, 701, 824);
    // Reset reset=new Reset();
    // addObject(reset,1073, 824);
    Combo3And5 combo3and5 = new Combo3And5();
    addObject(combo3and5, 1348, 597);
    combo4and5.setLocation(1339, 471);
    combo3and6.setLocation(1047, 470);
    combo3and5.setLocation(965, 472);
    combo5and6.setLocation(1258, 468);
    combo4and6.setLocation(1179, 469);
    combo4and5.setLocation(1130, 470);
    combo4and6.setLocation(1187, 469);
    combo5and6.setLocation(1305, 472);
    combo4and5.setLocation(1126, 471);
    combo4and6.setLocation(1205, 473);
    combo5and6.setLocation(1285, 472);
    triple.setLocation(650, 418);
    triple.setLocation(700, 154);
    // NumberInputBox1 numberinputbox1 = new NumberInputBox1();
    // addObject(numberinputbox1, 106, 745);
    // NumberInputBox2 numberinputbox2 = new NumberInputBox2();
    // addObject(numberinputbox2, 304, 753);
    // numberinputbox2.setLocation(309, 749);
    // numberinputbox2.setLocation(311, 746);
    CreateChip1 createchip1 = new CreateChip1();
    addObject(createchip1, 120, 846);
    CreateChip2 createchip2 = new CreateChip2();
    addObject(createchip2, 395, 847);
    // numberinputbox2.setLocation(383, 749);
    // numberinputbox1.setLocation(116, 748);
    NumberInputBox numberinputbox = new NumberInputBox();
    addObject(numberinputbox, 168, 749);
    numberinputbox.setLocation(253, 742);
    dice_1.setLocation(581, 53);
    dice_2.setLocation(695, 53);
    dice_3.setLocation(809, 53);
    /*dice_1.setLocation(785, 362);
    dice_1.setLocation(906, 851);
    dice_3.setLocation(766, 440);
    triple.setLocation(690, 119);
    triple.setLocation(697, 114);
    //reset.setLocation(1216, 721);
    dice_2.setLocation(1061, 843);
    dice_3.setLocation(1150, 828);
    dice_1.setLocation(906, 821);
    dice_2.setLocation(1019, 825);
    dice_3.setLocation(1130, 821);
    dice_3.setLocation(1130, 825);*/
    numberinputbox.setLocation(262, 771);
    createchip2.setLocation(437, 848);
    scoreboard.setLocation(842, 823);
    createchip2.setLocation(480, 853);
    numberinputbox.setLocation(324, 770);
    createchip2.setLocation(531, 843);
    scoreboard.setLocation(878, 814);

    removeObject(oneistoone);
    removeObject(twoistoone);
    removeObject(threeistoone);
    numberinputbox.setLocation(676, 690);
    scoreboard.setLocation(702, 809);

    createchip2.setLocation(1207, 817);
    scoreboard.setLocation(679, 805);
    createchip1.setLocation(156, 804);
    createchip2.setLocation(1203, 791);
    createchip2.setLocation(1199, 794);
    createchip1.setLocation(157, 795);
    createchip2.setLocation(1200, 797);
    createchip2.setLocation(1199, 793);
    createchip2.setLocation(1199, 795);
    Dice.pScoreOne = 0;
    Dice.pScoreTwo = 0;
  }
 public static TripleWithHash create(int n, String s) {
   Triple t = triple(s);
   return new TripleWithHash(n, t.getSubject(), t.getPredicate(), t.getObject());
 }