Package org.openrdf.rio.helpers

Examples of org.openrdf.rio.helpers.StatementCollector


        // Try parsing the input; this should result in an error being
        // reported.
        RDFParser turtleParser = createRDFParser();
        turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

        turtleParser.setRDFHandler(new StatementCollector());

        InputStream in = inputURL.openStream();
        turtleParser.parse(in, base(baseURL));
        in.close();
View Full Code Here


        // Try parsing the input; this should result in an error being
        // reported.
        RDFParser rdfxmlParser = createRDFParser();
        rdfxmlParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

        rdfxmlParser.setRDFHandler(new StatementCollector());

        InputStream in = resolveURL(inputURL).openStream();
        rdfxmlParser.parse(in, base(inputURL));
        in.close();
View Full Code Here

      // Parse input data
      RDFParser turtleParser = createRDFParser();
      turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> inputCollection = new LinkedHashSet<Statement>();
      StatementCollector inputCollector = new StatementCollector(inputCollection);
      turtleParser.setRDFHandler(inputCollector);

      InputStream in = inputURL.openStream();
      try {
        turtleParser.parse(in, base(baseURL));
      }
      finally {
        in.close();
      }

      // Parse expected output data
      RDFFormat outputFormat = Rio.getParserFormatForFileName(outputURL.toExternalForm());
      RDFParser outputParser = Rio.createParser(outputFormat);
      outputParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> outputCollection = new LinkedHashSet<Statement>();
      StatementCollector outputCollector = new StatementCollector(outputCollection);
      outputParser.setRDFHandler(outputCollector);

      in = outputURL.openStream();
      try {
        outputParser.parse(in, base(baseURL));
View Full Code Here

        // Try parsing the input; this should result in an error being
        // reported.
        RDFParser turtleParser = createRDFParser();
        turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

        turtleParser.setRDFHandler(new StatementCollector());

        InputStream in = inputURL.openStream();
        turtleParser.parse(in, base(baseURL));
        in.close();
View Full Code Here

      // Parse input data
      RDFParser turtleParser = createRDFParser();
      turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> inputCollection = new LinkedHashSet<Statement>();
      StatementCollector inputCollector = new StatementCollector(inputCollection);
      turtleParser.setRDFHandler(inputCollector);

      InputStream in = inputURL.openStream();
      turtleParser.parse(in, base(inputURL.toExternalForm()));
      in.close();

      // Parse expected output data
      NTriplesParser ntriplesParser = new NTriplesParser();
      ntriplesParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> outputCollection = new LinkedHashSet<Statement>();
      StatementCollector outputCollector = new StatementCollector(outputCollection);
      ntriplesParser.setRDFHandler(outputCollector);

      in = outputURL.openStream();
      ntriplesParser.parse(in, base(outputURL.toExternalForm()));
      in.close();
View Full Code Here

        // Try parsing the input; this should result in an error being
        // reported.
        RDFParser turtleParser = createRDFParser();
        turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

        turtleParser.setRDFHandler(new StatementCollector());

        InputStream in = inputURL.openStream();
        turtleParser.parse(in, base(inputURL.toExternalForm()));
        in.close();
View Full Code Here

      // Parse input data
      RDFParser turtleParser = createRDFParser();
      turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> inputCollection = new LinkedHashSet<Statement>();
      StatementCollector inputCollector = new StatementCollector(inputCollection);
      turtleParser.setRDFHandler(inputCollector);

      InputStream in = inputURL.openStream();
      turtleParser.parse(in, base(baseURL));
      in.close();

      // Parse expected output data
      NTriplesParser ntriplesParser = new NTriplesParser();
      ntriplesParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> outputCollection = new LinkedHashSet<Statement>();
      StatementCollector outputCollector = new StatementCollector(outputCollection);
      ntriplesParser.setRDFHandler(outputCollector);

      in = outputURL.openStream();
      ntriplesParser.parse(in, base(baseURL));
      in.close();
View Full Code Here

      RDFParser rdfxmlParser = createRDFParser();
      rdfxmlParser.setValueFactory(new CanonXMLValueFactory());
      rdfxmlParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> inputCollection = new LinkedHashSet<Statement>();
      StatementCollector inputCollector = new StatementCollector(inputCollection);
      rdfxmlParser.setRDFHandler(inputCollector);

      InputStream in = resolveURL(inputURL).openStream();
      rdfxmlParser.parse(in, base(inputURL));
      in.close();

      // Parse expected output data
      NTriplesParser ntriplesParser = new NTriplesParser();
      ntriplesParser.setValueFactory(new CanonXMLValueFactory());
      ntriplesParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);

      Set<Statement> outputCollection = new LinkedHashSet<Statement>();
      StatementCollector outputCollector = new StatementCollector(outputCollection);
      ntriplesParser.setRDFHandler(outputCollector);

      in = resolveURL(outputURL).openStream();
      ntriplesParser.parse(in, base(inputURL));
      in.close();
View Full Code Here

  public Model readModel()
    throws IOException, RDFParseException, NoCompatibleMediaType
  {
    Model model = new LinkedHashModel();
    try {
      readRDF(new StatementCollector(model));
    }
    catch (RDFHandlerException e) {
      throw new AssertionError(e);
    }
    return model;
View Full Code Here

    try {
      RDFParser parser = Rio.createParser(format);

      Model statements = new LinkedHashModel();
      parser.setRDFHandler(new StatementCollector(statements));

      InputStream stream = url.openStream();
      try {
        parser.parse(stream, url.toString());
      }
View Full Code Here

TOP

Related Classes of org.openrdf.rio.helpers.StatementCollector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.