Package org.corrib.s3b.nlq.util

Examples of org.corrib.s3b.nlq.util.SmartProperties


   * @throws IOException
   *
   */
  protected void loadRdfQueries() throws IOException{
    InputStream is = NLQueryTemplates.class.getClassLoader().getResourceAsStream(SERVICE_NLQUERIES_RDFPROPERTIES);
    SmartProperties prop = new SmartProperties();
   
    prop.load(is);
    is.close();
   
    // ------ loading list of Strings
    this.lstLangs.addAll(Arrays.asList(prop.getAsStringArray("nlq_locale")));
   
    // --- load default user;
    this.sDefaultUser = prop.getProperty("nlq_default_user");
   
    // ------ loading rdf queries -------
    Integer count = Integer.valueOf(prop.getProperty("nlq_template.count"));
   
    for(int i = 0; i < count; i++){
      String[] templates = prop.getAsStringArray("nlq_template."+i+".query");
      List<TypedRdfQueryTemplate> rdfqueries = new ArrayList<TypedRdfQueryTemplate>();
     
      for(String template : templates){
        int p = template.indexOf(':');
        String query = template.substring(p+1);
View Full Code Here


   * @param nlq
   * @throws IOException
   */
  protected void loadNLQuery(String lang) throws IOException{
    InputStream is = NLQueryTemplates.class.getClassLoader().getResourceAsStream(String.format(SERVICE_TEMPLATE, lang));
    SmartProperties prop = new SmartProperties();
   
    prop.load(is);
    is.close();
   
    // ------ loading rdf queries -------
    Integer count = Integer.valueOf(prop.getProperty("nlq_template.count"));
    String  explaintmpl = prop.getProperty("nlq_template.explain");
   
    for(int i = 0; i < count; i++){
      String template = prop.getProperty("nlq_template."+i+".example_template");
      String explain = String.format(explaintmpl, prop.getProperty("nlq_template."+i+".explain"));
      String[] lstRegexp = prop.getAsStringArray("nlq_template."+i+".regexp");
      List<Pattern> lstPat = new ArrayList<Pattern>();
     
      for(String regexp : lstRegexp){
        try {
          lstPat.add(Pattern.compile(regexp));
View Full Code Here

TOP

Related Classes of org.corrib.s3b.nlq.util.SmartProperties

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.