Examples of SmartProperties


Examples of org.corrib.jonto.beans.SmartProperties

  /**
   * Initiatiates recommendations templates
   */
  protected RecommendationTemplates() {
    String s3bConfiguration = System.getProperty("org.corrib.s3b.recommendations.configuration");
    SmartProperties prop = null;
   
    if(s3bConfiguration == null)
      prop = new SmartProperties("org.corrib.s3b.recommendations.configuration", RecommendationTemplates.class);
    else
      prop = new SmartProperties(new File(s3bConfiguration));
   
    Map<String, String>[] amConfig = prop.getAsMap("recommendation_plugin", "id", "type", "value", "property", "prefix", "query", "postprocess");
   
    for(Map<String,String> config : amConfig) {
      RecommendationPlugin plugin = new GenericRecommendationPlugin(config.get("id"), config.get("type"),
                                      config.get("value"), config.get("property"),
                                      config.get("prefix"), config.get("query"),
                                      config.get("postprocess"));
     
      plugins.put(config.get("id"), plugin);
    }
   
    plugins.put("overall", new OverallRecommendationPlugin("overall"));
   
    this.defaults = prop.getAsStringArray("recommendation_plugin.default");
    this.qsLabel = new QuerableString(prop.getProperty("recommendation_plugin.label_pattern"),
                      prop.getAsStringArray("recommendation_plugin.label_component"));
    this.qsComment = new QuerableString(prop.getProperty("recommendation_plugin.comment_pattern"),
          prop.getAsStringArray("recommendation_plugin.comment_component"));
    this.qsCover = new QuerableString(prop.getProperty("recommendation_plugin.cover_pattern"),
          prop.getAsStringArray("recommendation_plugin.cover_component"));
   
  }
View Full Code Here

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

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

   * @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
Copyright © 2018 www.massapi.com. 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.