Exemplo n.º 1
0
  public static void readDataset(DatasetGraph dataset, String uri, Lang lang) {
    TypedInputStream typedInput = open(uri, lang);
    String contentType = typedInput.getMediaType();
    lang = chooseLang(contentType, lang);

    if (lang == null)
      throw new RiotException(
          "Can't determine the syntax of <"
              + uri
              + "> (media type="
              + typedInput.getMediaType()
              + ")");

    Sink<Quad> sink = RiotLoader.datasetSink(dataset);
    RiotLoader.readQuads(typedInput, lang, uri, sink);
  }
Exemplo n.º 2
0
  public static void readGraph(Graph graph, String uri, Lang lang) {
    TypedInputStream typedInput = open(uri, lang);
    String contentType = typedInput.getMediaType();
    lang = chooseLang(contentType, lang);

    if (lang == null)
      throw new RiotException(
          "Can't determine the syntax of <"
              + uri
              + "> (media type="
              + typedInput.getMediaType()
              + ")");

    Sink<Triple> sink = RiotLoader.graphSink(graph);
    RiotLoader.readTriples(typedInput, lang, uri, sink);
  }