@Override
 protected void writeTuples(File f, List<Triple> tuples) throws FileNotFoundException {
   Graph g = GraphFactory.createGraphMem();
   for (Triple t : tuples) {
     g.add(t);
   }
   RDFDataMgr.write(new FileOutputStream(f), g, getLanguage());
 }
示例#2
0
  public static Map<Node, Graph> indexBySubject(Iterator<Triple> it) {
    Map<Node, Graph> result = new HashMap<Node, Graph>();
    while (it.hasNext()) {
      Triple triple = it.next();
      Node s = triple.getSubject();

      Graph graph = result.get(s);
      if (graph == null) {
        graph = GraphFactory.createGraphMem();
        result.put(s, graph);
      }
      graph.add(triple);
    }

    return result;
  }