Package org.openrdf.rio

Examples of org.openrdf.rio.Parser


    public void addData(InputStream dataStream, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener) throws IOException, AccessDeniedException
    {
  try
  {
      Parser parser = null;
      Map noParams = new HashMap();
      if(format.equals(RDFFormat.TURTLE))
      {
    parser = new TurtleParser();
    }
      else if(format.equals(RDFFormat.RDFXML))
    {
    parser = new RdfXmlParser();
    }
      else if(format.equals(RDFFormat.NTRIPLES))
      {
    parser = new NTriplesParser();
      }
      else return;

      parser.setDatatypeHandling(Parser.DT_IGNORE); // TODO find out what this is doing
      StatementHandler sh = new StatementHandler()
      {
    public void handleStatement(Resource subj, URI pred, Value obj)
    {
        addSingleStatement(subj, pred, obj);
  }
      };
      parser.setStatementHandler(sh);
      parser.parse(dataStream, baseURI);
      dataStream.close();
  }
  catch (Exception e)
  {
      System.out.println(e.getMessage());
View Full Code Here

TOP

Related Classes of org.openrdf.rio.Parser

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.