/** * Register the given parser factory for the specified syntax. If another factory is registered * for the syntax it is replaced by the given one. */ public void add(Syntax syntax, SPARQLParserFactory f) { if (!f.accept(syntax)) throw new IllegalArgumentException( "The given parser factory does not accept the specified syntax."); factories.put(syntax, f); }
/** * Return a suitable parser for the given syntax * * @param syntax the syntax to be processed * @return a parser or null if none accept the request */ public SPARQLParser createParser(Syntax syntax) { SPARQLParserFactory f = getFactory(syntax); return (f != null) ? f.create(syntax) : null; }