Exemplo n.º 1
0
 // check for duplicate code
 private static List<Tuple<NodeId>> convert(List<Triple> triples, NodeTable nodeTable) {
   return triples
       .stream()
       .map(
           t ->
               Tuple.createTuple(
                   nodeTable.getAllocateNodeId(t.getSubject()),
                   nodeTable.getAllocateNodeId(t.getPredicate()),
                   nodeTable.getAllocateNodeId(t.getObject())))
       .collect(Collectors.toList());
 }
Exemplo n.º 2
0
  private static void convert(
      List<Triple> triples, List<Tuple<NodeId>> tuples, NodeTable nodeTable) {
    // Slightly faster.  But larger batches?
    for (Triple t : triples) {
      NodeId nid_s = nodeTable.getAllocateNodeId(t.getSubject());
      NodeId nid_p = nodeTable.getAllocateNodeId(t.getPredicate());
      NodeId nid_o = nodeTable.getAllocateNodeId(t.getObject());
      Tuple<NodeId> x = Tuple.createTuple(nid_s, nid_p, nid_o);
      tuples.add(x);
    }

    //        triples.stream().map(t->
    //                  Tuple.createTuple
    //                  (nodeTable.getAllocateNodeId(t.getSubject()),
    //                   nodeTable.getAllocateNodeId(t.getPredicate()),
    //                   nodeTable.getAllocateNodeId(t.getObject())))
    //                .collect(Collectors.toCollection(()->tuples)) ;
  }