Strabon

changeset 650:5991b1b45020 temporals

modified NQuadsTranslator.java accordingly
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Tue Oct 23 20:02:56 2012 +0300 (2012-10-23)
parents f21d6acefe7f
children 3b6d6674f0aa
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java	Tue Oct 23 19:55:28 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java	Tue Oct 23 20:02:56 2012 +0300
     1.3 @@ -17,49 +17,27 @@
     1.4  public class NQuadsTranslator {
     1.5  	
     1.6      private NQuadsParser parser;
     1.7 -    private TranslateRDFHandler rdfHandler;
     1.8 +    private QuadRDFHandler handler;
     1.9 +    private StringBuffer handledTriples;
    1.10      
    1.11 -    private class TranslateRDFHandler extends StatementCollector {
    1.12  
    1.13 -        
    1.14 -
    1.15 -        @Override
    1.16 -        public void startRDF() throws RDFHandlerException {
    1.17 -            super.startRDF();
    1.18 -        }
    1.19 -
    1.20 -        @Override
    1.21 -        public void endRDF() throws RDFHandlerException {
    1.22 -            super.endRDF();
    1.23 -        }
    1.24 -
    1.25 -        @Override
    1.26 -        public void handleStatement(Statement statement) {
    1.27 -            super.handleStatement(statement);
    1.28 -            //logger.debug(statement.toString());
    1.29 -        }
    1.30 -
    1.31 -		public TranslateRDFHandler() {
    1.32 -			super();
    1.33 -		}
    1.34 -        
    1.35 -        
    1.36 -
    1.37 -    }
    1.38      
    1.39      public NQuadsTranslator() {
    1.40  		super();
    1.41  		this.parser = new NQuadsParser();
    1.42 -		this.rdfHandler = new TranslateRDFHandler();
    1.43 +		this.handler = new QuadRDFHandler();
    1.44 +		this.handledTriples = new StringBuffer(1024);
    1.45  	}
    1.46  
    1.47  	public Collection<Statement>  translate(InputStream is,String baseURI)
    1.48      {
    1.49      	Collection<Statement> statements = null; 
    1.50 -    	TranslateRDFHandler handler = new TranslateRDFHandler();
    1.51 +
    1.52      	parser.setRDFHandler(handler);
    1.53      	try {
    1.54  			parser.parse(is, "http://test.base.uri");
    1.55 +		    handledTriples = handler.getTriples();
    1.56 +	        System.out.println("HANDLED TRIPLES: "+handledTriples.toString());
    1.57  		} catch (RDFParseException e) {
    1.58  			// TODO Auto-generated catch block
    1.59  			e.printStackTrace();