コード例 #1
0
 @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
ファイル: GraphUtils.java プロジェクト: AKSW/jena-sparql-api
  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;
  }