Package org.openrdf.rio

Examples of org.openrdf.rio.RDFParser


    @Override
    protected void runTest() {
      try {
        // 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();

        fail("Parser parses erroneous data without reporting errors");
      }
      catch (RDFParseException e) {
View Full Code Here


    @Override
    protected void runTest() {
      try {
        // 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();

        fail("Parser parses erroneous data without reporting errors");
      }
      catch (RDFParseException e) {
View Full Code Here

   *---------*/

  public void testNTriplesFile()
    throws Exception
  {
    RDFParser turtleParser = createRDFParser();
    turtleParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);
    turtleParser.setRDFHandler(new RDFHandlerBase());

    InputStream in = NTriplesParser.class.getResourceAsStream(NTRIPLES_TEST_FILE);
    try {
      turtleParser.parse(in, NTRIPLES_TEST_URL);
    }
    catch (RDFParseException e) {
      fail("Failed to parse N-Triples test document: " + e.getMessage());
    }
    finally {
View Full Code Here

    @Override
    protected void runTest()
      throws Exception
    {
      // 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));
      }
      finally {
        in.close();
      }
View Full Code Here

    @Override
    protected void runTest() {
      try {
        // 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();

        fail("Parser parses erroneous data without reporting errors");
      }
      catch (RDFParseException e) {
View Full Code Here

    @Override
    protected void runTest()
      throws Exception
    {
      // 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);
View Full Code Here

    @Override
    protected void runTest() {
      try {
        // 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();

        fail("Parser parses erroneous data without reporting errors");
      }
      catch (RDFParseException e) {
View Full Code Here

    @Override
    protected void runTest()
      throws Exception
    {
      // 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);
View Full Code Here

    @Override
    protected void runTest()
      throws Exception
    {
      // Parse input data
      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());
View Full Code Here

  {
    BackgroundGraphResult result = null;
    String mimeType = readContentType();
    try {
      RDFFormat format = RDFParserRegistry.getInstance().getFileFormatForMIMEType(mimeType);
      RDFParser parser = Rio.createParser(format, pool.getValueFactory());
      parser.setPreserveBNodeIDs(true);
      InputStream in = getResponseBodyAsStream();
      String base = method.getURI().getURI();
      result = new BackgroundGraphResult(parser, in, base, this);
      pool.executeTask(result);
      return result;
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFParser

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.