View Javadoc

1   /*
2    * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
3    *
4    * Licensed under the Aduna BSD-style license.
5    */
6   package org.openrdf.query.parser.serqo;
7   
8   import org.openrdf.query.QueryLanguage;
9   import org.openrdf.query.parser.QueryParser;
10  import org.openrdf.query.parser.QueryParserFactory;
11  
12  /**
13   * A {@link QueryParserFactory} for SeRQO parsers.
14   * 
15   * @author Arjohn Kampman
16   */
17  public class SeRQOParserFactory implements QueryParserFactory {
18  
19  	private SeRQOParser sharedParser = null;
20  
21  	/**
22  	 * Returns {@link QueryLanguage#SERQO}.
23  	 */
24  	public QueryLanguage getQueryLanguage() {
25  		return QueryLanguage.SERQO;
26  	}
27  
28  	/**
29  	 * Returns a shared, thread-safe, instance of SeRQOParser.
30  	 */
31  	public QueryParser getParser() {
32  		if (sharedParser == null) {
33  			sharedParser = new SeRQOParser();
34  		}
35  
36  		return sharedParser;
37  	}
38  }