List of usage examples for java.lang StringBuilder equals
public boolean equals(Object obj)
From source file:br.com.bropenmaps.util.Util.java
/** * Cria uma poro HTML contendo a paginao de determinada busca para aparelhos mveis * @param total - total de itens./*from w w w . j a va 2 s .com*/ * @param inicio - item inicial * @param acaoComp - filtro da busca * @return Cdigo HTML contendo a paginao */ public static StringBuilder criaPaginacaoMobile(StringBuilder total, int inicio, String acaoComp) { StringBuilder paginas = new StringBuilder(""); int pag = 0; if (!total.equals("")) { pag = Integer.parseInt(total.toString()) % Util.MAX_RESULTADOS != 0 ? (Integer.parseInt(total.toString()) / Util.MAX_RESULTADOS) + 1 : (Integer.parseInt(total.toString()) / Util.MAX_RESULTADOS); } if (pag > 1) { int dif_parte1 = inicio - Util.PAG_ANT_DEP; int dif_parte2 = inicio + Util.PAG_ANT_DEP; paginas.append("<div id='paginacaoBusca'>"); if (dif_parte1 > 0) { if (pag - inicio < Util.PAG_ANT_DEP) { dif_parte1 -= (Util.PAG_ANT_DEP - (pag - inicio)); if (dif_parte1 < 1) { dif_parte1 = 1; } } //Primeira if (inicio > 1) { paginas.append("<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=1\"><<</a></div>"); } //Anterior if (dif_parte1 >= 1) { paginas.append( "<div class=\"left left5px right5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + (inicio - 1) + "\"><</a></div>"); } for (int i = dif_parte1; i <= inicio; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + i + "\">" + i + "</a></div>"); } if (dif_parte2 > pag) { for (int i = inicio + 1; i <= pag; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + i + ")\">" + i + "</a></div>"); } } else { for (int i = inicio + 1; i <= dif_parte2; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + i + "\">" + i + "</a></div>"); } } //Prxima if (inicio < pag) { paginas.append("<div class=\"left left5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + (inicio + 1) + "\">></a></div>"); } //ltima if (inicio < pag) { paginas.append("<div class=\"left left5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + pag + "\">>></a></div>"); } } else { //Primeira if (inicio > 1) { paginas.append("<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=1\"><<</a></div>"); } //Anterior if (inicio > 1) { paginas.append( "<div class=\"left left5px right5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + (inicio - 1) + "\"><</a></div>"); } if (Util.PAG_ANT_DEP * 2 >= pag) { for (int i = 1; i <= pag; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + i + "\">" + i + "</a></div>"); } } else { for (int i = 1; i <= (Util.PAG_ANT_DEP * 2) + 1; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + i + "\">" + i + "</a></div>"); } } //Prxima if (inicio < pag) { paginas.append("<div class=\"left left5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + (inicio + 1) + "\">></a></div>"); } //ltima if (inicio < pag) { paginas.append("<div class=\"left left5px\"><a class=\"paginacao nodecoration\" href=\"" + acaoComp + "&inicio=" + pag + "\">>></a></div>"); } } paginas.append("<br class='clear'/></div>"); } return paginas; }
From source file:br.com.bropenmaps.util.Util.java
/** * Cria uma poro HTML contendo a paginao de determinada busca. * @param total - total de itens./*from w w w .ja v a 2 s .c om*/ * @param inicio - item inicial * @param metodoJs - mtodo em Javascript para a alterao de pginas * @param parametro - indica o tipo da busca * @param acaoComp - filtro da busca * @return Cdigo HTML contendo a paginao */ public static StringBuilder criaPaginacao(StringBuilder total, int inicio, String metodoJs, String parametro, String acaoComp) { StringBuilder paginas = new StringBuilder(""); int pag = 0; if (!total.equals("")) { pag = Integer.parseInt(total.toString()) % Util.MAX_RESULTADOS != 0 ? (Integer.parseInt(total.toString()) / Util.MAX_RESULTADOS) + 1 : (Integer.parseInt(total.toString()) / Util.MAX_RESULTADOS); } if (pag > 1) { int dif_parte1 = inicio - Util.PAG_ANT_DEP; int dif_parte2 = inicio + Util.PAG_ANT_DEP; paginas.append("<div class=\"left20px top10px bottom20px\">"); if (dif_parte1 > 0) { if (pag - inicio < Util.PAG_ANT_DEP) { dif_parte1 -= (Util.PAG_ANT_DEP - (pag - inicio)); if (dif_parte1 < 1) { dif_parte1 = 1; } } //Primeira if (inicio > 1) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + "1," + acaoComp + ")\"><img src=\"imagens/bt_primeiro.png\" class=\"noborder\" alt=\"Primeiro\" title=\"Primeiro\"/></a></div>"); } //Anterior if (dif_parte1 >= 1) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + (inicio - 1) + "," + acaoComp + ")\"><img src=\"imagens/bt_anterior.png\" class=\"noborder\" alt=\"Anterior\" title=\"Anterior\"/></a></div>"); } for (int i = dif_parte1; i <= inicio; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao\" href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + i + "," + acaoComp + ")\">" + i + "</a></div>"); } if (dif_parte2 > pag) { for (int i = inicio + 1; i <= pag; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao\" href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + i + "," + acaoComp + ")\">" + i + "</a></div>"); } } else { for (int i = inicio + 1; i <= dif_parte2; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao\" href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + i + "," + acaoComp + ")\">" + i + "</a></div>"); } } //Prxima if (inicio < pag) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + (inicio + 1) + "," + acaoComp + ")\"><img src=\"imagens/bt_proximo.png\" class=\"noborder\" alt=\"Prximo\" title=\"Prximo\"/></a></div>"); } //ltima if (inicio < pag) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + pag + "," + acaoComp + ")\"><img src=\"imagens/bt_ultimo.png\" class=\"noborder\" alt=\"ltimo\" title=\"ltimo\"/></a></div>"); } } else { //Primeira if (inicio > 1) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + "1" + "," + acaoComp + ")\"><img src=\"imagens/bt_primeiro.png\" class=\"noborder\" alt=\"Primeiro\" title=\"Primeiro\"/></a></div>"); } //Anterior if (inicio > 1) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + (inicio - 1) + "," + acaoComp + ")\"><img src=\"imagens/bt_anterior.png\" class=\"noborder\" alt=\"Anterior\" title=\"Anterior\"/></a></div>"); } if (Util.PAG_ANT_DEP * 2 >= pag) { for (int i = 1; i <= pag; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao\" href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + i + "," + acaoComp + ")\">" + i + "</a></div>"); } } else { for (int i = 1; i <= (Util.PAG_ANT_DEP * 2) + 1; i++) { paginas.append(i == inicio ? "<div class=\"left left2px paginacao_item\">" + i + "</div>" : "<div class=\"left left2px\"><a class=\"paginacao\" href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + i + "," + acaoComp + ")\">" + i + "</a></div>"); } } //Prxima if (inicio < pag) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + (inicio + 1) + "," + acaoComp + ")\"><img src=\"imagens/bt_proximo.png\" class=\"noborder\" alt=\"Prximo\" title=\"Prximo\"/></a></div>"); } //ltima if (inicio < pag) { paginas.append("<div class=\"left left2px\"><a href=\"javascript:" + metodoJs + "(" + (parametro != null ? "'" + parametro + "', " : "") + pag + "," + acaoComp + ")\"><img src=\"imagens/bt_ultimo.png\" class=\"noborder\" alt=\"ltimo\" title=\"ltimo\"/></a></div>"); } } paginas.append("</div>"); } return paginas; }
From source file:org.ensembl.healthcheck.testcase.generic.ProductionSpeciesAlias.java
private <T extends CharSequence> boolean checkConsistent(DatabaseRegistryEntry dbre, String species) { boolean result = true; SqlTemplate t = DBUtils.getSqlTemplate(dbre); StringBuilder shortName = new StringBuilder(); for (String speciesChunk : species.split("_")) { shortName.append(speciesChunk);//from w w w . jav a 2 s. co m } String all_sql = "SELECT meta_value, meta_key FROM meta WHERE meta_key in ('species.scientific_name', 'species.production_name', 'species.url')"; Map<String, List<String>> keys = t.queryForMap(all_sql, new StringListMapRowMapper()); String sql = "SELECT meta_value FROM meta WHERE meta_key in ('species.scientific_name', 'species.production_name', 'species.url')"; List<String> names = t.queryForDefaultObjectList(sql, String.class); for (String name : names) { StringBuilder fullName = new StringBuilder(); for (String nameChunk : name.split("_| ")) { fullName.append(nameChunk.toLowerCase()); } if (fullName.equals(shortName)) { ReportManager.problem(this, dbre.getConnection(), keys.get(name) + " has a meta value which does not match the correct species name " + species); result = false; } } return result; }
From source file:org.openmrs.web.taglib.SummaryTest.java
private boolean evaluate(String expr) { expr = expr.trim();//from w w w . ja v a 2 s.c o m log.debug("evaluate " + expr); List<String> commands = new ArrayList<String>(); { StringBuilder command = new StringBuilder(); String[] lines = expr.split("\n"); for (String line : lines) { if (line.trim().startsWith("!") && command.length() > 0) { commands.add(command.toString()); command = new StringBuilder(); } command.append(line.trim()); command.append("\n"); } if (command.length() > 0) { commands.add(command.toString()); } } boolean andMode = true; List<Boolean> commandResults = new ArrayList<Boolean>(); for (String s : commands) { String command = (new StringTokenizer(s.toUpperCase())).nextToken(); if (command.equals("!AND")) { andMode = true; } else if (command.equals("!OR")) { andMode = false; } else if (command.equals("!OBSCHECK")) { s = s.substring("!OBSCHECK".length()).trim(); commandResults.add(handleObsCheck(s)); } else { throw new RuntimeException("Don't know how to handle command " + command + "\n" + s); } } boolean ret = andMode ? true : false; for (Boolean b : commandResults) { if (andMode) { ret &= b; } else { ret |= b; } } return ret; }
From source file:metabup.annotations.general.Annotation.java
public static String longestSubstring(String pivot, List<String> remain, int index) { StringBuilder sb = new StringBuilder(); String str1 = pivot;/*from w ww . java 2 s .c om*/ String str2 = remain.get(index); if (str1 == null || str1.isEmpty() || str2 == null || str2.isEmpty()) return ""; // ignore case str1 = str1.toLowerCase(); str2 = str2.toLowerCase(); // java initializes them already with 0 int[][] num = new int[str1.length()][str2.length()]; int maxlen = 0; int lastSubsBegin = 0; for (int i = 0; i < str1.length(); i++) { for (int j = 0; j < str2.length(); j++) { if (str1.charAt(i) == str2.charAt(j)) { if ((i == 0) || (j == 0)) num[i][j] = 1; else num[i][j] = 1 + num[i - 1][j - 1]; if (num[i][j] > maxlen) { maxlen = num[i][j]; // generate substring from str1 => i int thisSubsBegin = i - num[i][j] + 1; if (lastSubsBegin == thisSubsBegin) { //if the current LCS is the same as the last time this block ran sb.append(str1.charAt(i)); } else { //this block resets the string builder if a different LCS is found lastSubsBegin = thisSubsBegin; sb = new StringBuilder(); sb.append(str1.substring(lastSubsBegin, i + 1)); } } } } } if (sb.equals("")) return ""; index++; if (index < remain.size()) return longestSubstring(sb.toString(), remain, index); else return sb.toString(); }
From source file:org.brandroid.openmanager.activities.OpenExplorer.java
private void saveOpenedEditors() { StringBuilder editing = new StringBuilder(","); for (int i = 0; i < mViewPagerAdapter.getCount(); i++) { OpenFragment f = mViewPagerAdapter.getItem(i); if (f instanceof TextEditorFragment) { TextEditorFragment tf = (TextEditorFragment) f; if (!tf.isSalvagable()) continue; OpenPath path = tf.getPath(); if (editing.indexOf("," + path.getPath() + ",") == -1) editing.append(path + ","); }//from w w w .java 2 s. c om } if (DEBUG && !editing.equals(",")) Logger.LogDebug("Saving [" + editing.toString() + "] as TextEditorFragments"); setSetting("editing", editing.toString()); }
From source file:ThesaurusTreatment.ThesaurusProcess.java
public void loadAllConcepts(String limitUri) { /*System.out.println("Initialize WordNet ..."); WordNetDesambiguisator wnd = WordNetDesambiguisator.getWordNetConnector(); System.out.println("WordNet initialized!");*/ System.out.println("Exporting ADOM ..."); if (!this.spOut.storeData(new StringBuilder(this.getADOMTtl()), false)) { System.out.println("ERROR during exporting ADOM"); System.exit(0);//from w w w .j a va 2s. c o m } System.out.println("ADOM exported!"); //ArrayList<JSONObject> listURI = this.spIn.sendQuery("SELECT * WHERE{?c rdf:type skos:Concept. ?c skos:broader+ <http://aims.fao.org/aos/agrovoc/c_5993>.}"); //toutes les plantes ArrayList<JSONObject> listURI = this.spIn .sendQuery("SELECT * WHERE{?c rdf:type skos:Concept. ?c skos:broader+ <" + limitUri + ">.}"); listURI.addAll(this.spIn .sendQuery("SELECT * WHERE {?c rdf:type skos:Concept. <" + limitUri + "> skos:broader+ ?c.}")); JSONObject joMain = new JSONObject(); JSONObject cUri = new JSONObject(); cUri.put("value", limitUri); joMain.put("c", cUri); System.out.println(joMain); listURI.add(joMain); System.out.println(listURI.size() + " concepts import"); System.out.println("Begin creating raw KB ..."); int i = 0; int nbQuery = 0; int nbSubClassOf = 0; String baseUri = "http://ontology.irstea.fr/AGROVOCTaxon#"; //String stringStats = " Uri sujet ; label franais ; relation ; WordNet; Uri objet ; label franais ; Validation Catherine; Wikipedia; NCBI; note"; // def relations HashMap<String, OntologyRelation> objProp = new HashMap<>(); StringBuilder updateQuery = new StringBuilder("INSERT DATA {"); String classifUri = baseUri + "classification_AGROVOC"; updateQuery.append("<" + classifUri + "> rdf:type <http://ontology.irstea.fr/AgronomicTaxon#Taxonomy>; rdfs:label \"AGROVOC agronomic classification\"."); for (JSONObject s : listURI) { String currentQueryPart = ""; String currentObjPropQuerypart = ""; String uri = s.getJSONObject("c").getString("value"); String rankUri = "http://ontology.irstea.fr/AgronomicTaxon#Taxon"; ArrayList<JSONObject> elemRanks = this.spIn .sendQuery("SELECT * WHERE {<" + uri + "> agrovoc:hasTaxonomicLevel ?rankUri.}"); if (!elemRanks.isEmpty()) { String uriInRank = elemRanks.get(0).getJSONObject("rankUri").getString("value"); rankUri = this.ranksAlign.get(uriInRank); if (rankUri == null) { //rankUri = "http://ontology.irstea.fr/AgronomicTaxon#Taxon"; this.ranksAlign.put(uriInRank, uriInRank); currentQueryPart += "<" + uriInRank + "> rdf:type owl:Class; rdfs:subClassOf <http://ontology.irstea.fr/AgronomicTaxon#Taxon>; "; ArrayList<JSONObject> labelsClass = this.spIn.sendQuery("SELECT * WHERE {<" + uriInRank + "> (<http://www.w3.org/2004/02/skos/core#prefLabel>|<http://www.w3.org/2004/02/skos/core#altLabel>) ?label}"); for (JSONObject sLabel : labelsClass) { String lang = sLabel.getJSONObject("label").getString("xml:lang"); String label = SparqlProxy.cleanString(sLabel.getJSONObject("label").getString("value")); //currentQueryPart += " rdfs:label "; if (lang.isEmpty()) { currentQueryPart += " rdfs:label \" " + label + "\"; "; } else if (this.isAcceptLang(lang)) { currentQueryPart += " rdfs:label \"" + label + "\"@" + lang + "; "; } } currentQueryPart = currentQueryPart.substring(0, currentQueryPart.lastIndexOf(";")); currentQueryPart += "."; rankUri = uriInRank; } } currentQueryPart += "<" + uri + "> rdf:type <" + rankUri + ">; <http://ontology.irstea.fr/AgronomicTaxon#inScheme> <" + classifUri + ">; "; ArrayList<JSONObject> listRel = this.spIn.sendQuery("SELECT * WHERE {<" + uri + "> ?rel ?val.}"); for (JSONObject sRel : listRel) { String rel = sRel.getJSONObject("rel").getString("value"); String val = sRel.getJSONObject("val").getString("value"); if (SparqlProxy.isLabelRel(rel)) { String lang = sRel.getJSONObject("val").getString("xml:lang"); String label = SparqlProxy.cleanString(val); String adomRelUri = "http://ontology.irstea.fr/AgronomicTaxon#hasVernacularName"; if (rel.equalsIgnoreCase("http://www.w3.org/2004/02/skos/core#prefLabel")) { adomRelUri = "http://ontology.irstea.fr/AgronomicTaxon#hasScientificName"; } if (!label.isEmpty()) { if (lang.isEmpty()) { currentQueryPart += " <" + adomRelUri + "> \"" + SparqlProxy.cleanString(val) + "\";"; currentQueryPart += " rdfs:label \"" + SparqlProxy.cleanString(val) + "\";"; } else if (this.isAcceptLang(lang)) { currentQueryPart += " <" + adomRelUri + "> \"" + SparqlProxy.cleanString(val) + "\"@" + lang + ";"; currentQueryPart += " rdfs:label \"" + SparqlProxy.cleanString(val) + "\"@" + lang + ";"; } } } else if (SparqlProxy.isSubRel(rel)) { nbSubClassOf++; currentQueryPart += " <http://ontology.irstea.fr/AgronomicTaxon#hasHigherRank> <" + val + ">; "; /* REMOVE WordNet desambiguator Boolean isSubClassOf = this.isSubClassOf(wnd, uri, val); if(isSubClassOf == null || isSubClassOf) { currentQueryPart += " rdfs:subClassOf <"+val+">; "; if(isSubClassOf == null) { nbSubClassOfNotFoundWN++; stringStats += "\n"+this.getConceptsStatsDescription(uri, val, "Not found"); } else if(isSubClassOf) { nbSubClassOfValidated ++; stringStats += "\n"+this.getConceptsStatsDescription(uri, val, "Validated"); } } else { nbSubClassOfNotValidated++; stringStats += "\n"+this.getConceptsStatsDescription(uri, val, "Not validated"); }*/ } /*else if(!(SparqlProxy.isExcludeRel(rel)) && val.startsWith("http://aims.fao.org/aos/agrovoc/")) { OntologyRelation or = objProp.get(rel); if(or == null) { or = new OntologyRelation(rel, this.spOut); objProp.put(rel, or); } String subProp = or.addRangeDomain(uri, val); currentObjPropQuerypart += subProp; }*/ } currentQueryPart = currentQueryPart.substring(0, currentQueryPart.lastIndexOf(";")); currentQueryPart += "."; currentQueryPart += currentObjPropQuerypart; int fullLength = updateQuery.length() + currentQueryPart.length(); if (fullLength > 4000000) // limit for the fuseki update query length { nbQuery++; updateQuery.append("}"); boolean ret = this.spOut.storeData(updateQuery); System.out.println(i + " concepts treated (query n " + nbQuery + ")..."); if (!ret) //if store query bugged System.exit(0); updateQuery = new StringBuilder("INSERT DATA {" + currentQueryPart); } else { updateQuery.append(currentQueryPart); } i++; } if (!updateQuery.equals("INSERT DATA {")) { nbQuery++; updateQuery.append("}"); this.spOut.storeData(updateQuery); System.out.println(i + " concepts treated (query n " + nbQuery + ")..."); } System.out.println("Begin object properties definitions (" + objProp.values().size() + " objProps) ..."); int nbObjProp = 0; nbQuery = 0; int nbObjPropCached = 0; updateQuery = new StringBuilder("INSERT DATA {"); for (OntologyRelation or : objProp.values()) { StringBuilder currentQueryPart = new StringBuilder(""); nbObjProp++; currentQueryPart.append(or.toTtl(this.spOut)); //currentQueryPart.append(or.getSubPropertiesTtl()); int fullLength = updateQuery.length() + currentQueryPart.length(); if (fullLength > 4000000) // limit for the fuseki limit POST request { nbQuery++; updateQuery.append("}"); boolean ret = this.spOut.storeData(updateQuery); System.out.println(nbObjProp + " properties treated (query n " + nbQuery + ")..."); if (!ret) //if store query bugged System.exit(0); updateQuery = new StringBuilder("INSERT DATA {" + currentQueryPart); nbObjPropCached = 0; } else { updateQuery.append(currentQueryPart); } nbObjPropCached++; System.out.println(nbObjPropCached + " Object properties definitions cached"); } if (!updateQuery.equals("INSERT DATA {")) { nbQuery++; updateQuery.append("}"); this.spOut.storeData(updateQuery); System.out.println(nbObjProp + " properties treated (query n " + nbQuery + ")..."); } System.out.println("Raw KB (" + i + " concepts || " + nbObjProp + " objProps) created!"); /* System.out.println("------------------ \n"); String s = "Nb subClassOf discovered : "+nbSubClassOf+" \n"; s += "Nb subClassOf validated by WN : "+nbSubClassOfValidated+"\n"; s += "Nb subClassOf not found in WN : "+nbSubClassOfNotFoundWN+"\n"; s += "Nb subClassOf not validated by WN : "+nbSubClassOfNotValidated+"\n"; System.out.println(s); File fStatsOut = new File("out/Stats_out.txt"); File fileStat = new File("out/stats_WordNet.csv"); try { FileUtils.writeStringToFile(fStatsOut, s, "UTF8", false); FileUtils.writeStringToFile(fileStat, stringStats); } catch (IOException ex) { System.out.println("EROR during output stats out file "); System.exit(0); }*/ }
From source file:com.arksoft.epamms.ZGlobal1_Operation.java
public String fnAdressLabelText(View vAnyObject, // BASED ON LOD "any object with entity that has address attributes" String stringInternalEntityStructure, String stringInternalAttribStructure, String stringReturnText) { String entityName = null;//from w w w .ja va 2s . c om String stringAttribName = null; String stringMultiLineAddress = null; StringBuilder sb = new StringBuilder(""); String stringAttn = null; String stringCity = null; String stringState = null; String stringZipCode = null; String stringZipCodeFormatted = null; String stringCountry = null; StringBuilder stringSep = null; // set to /r/n or "; " zstrcpy(entityName, stringInternalEntityStructure); zstrcpy(stringAttribName, stringInternalAttribStructure); if (ZeidonStringCompare(stringAttribName, 1, 5, "dLine", 1, 5, 33) == 0) zstrcpy(stringSep, "; "); else zstrcpy(stringSep, "\r\n"); stringMultiLineAddress = ""; stringAttn = ""; sb.setCharAt(0, '\0'); if (IsValidAttribute("AttentionLine1", stringInternalEntityStructure) == 0) GetStringFromAttribute(sb, vAnyObject, entityName, "AttentionLine1"); if (sb.length() != 0) { stringAttn = zsprintf(stringAttn, "Attn: %s%s", sb, stringSep); sb.setCharAt(0, '\0'); } if (IsValidAttribute("AttentionLine2", stringInternalEntityStructure) == 0) GetStringFromAttribute(sb, vAnyObject, entityName, "AttentionLine2"); if (sb.length() != 0) { stringAttn = zsprintf(stringAttn, "%s %s%s", stringAttn, sb, stringSep); sb.setCharAt(0, '\0'); } if (stringAttn.length() != 0) ZeidonStringCopy(stringMultiLineAddress, 1, 0, stringAttn, 1, 0, 2000); if (IsValidAttribute("Line1", stringInternalEntityStructure) == 0) GetStringFromAttribute(sb, vAnyObject, entityName, "Line1"); if (sb.length() != 0) zsprintf(stringMultiLineAddress, "%s%s%s", stringMultiLineAddress, sb, stringSep); if (IsValidAttribute("Line2", stringInternalEntityStructure) == 0) GetStringFromAttribute(sb, vAnyObject, entityName, "Line2"); else sb.setCharAt(0, '\0'); if (sb.length() != 0) stringMultiLineAddress = zsprintf(stringMultiLineAddress, "%s%s%s", stringMultiLineAddress, sb, stringSep); if (IsValidAttribute("Line3", stringInternalEntityStructure) == 0) GetStringFromAttribute(sb, vAnyObject, entityName, "Line3"); else sb.setCharAt(0, '\0'); if (sb.length() != 0) stringMultiLineAddress = zsprintf(stringMultiLineAddress, "%s%s%s", stringMultiLineAddress, sb, stringSep); stringCity = GetStringFromAttribute(stringCity, vAnyObject, entityName, "City"); //GetStringFromAttribute( stringState, vAnyObject, entityName, "State" ); stringState = GetVariableFromAttribute(stringState, 0, zTYPE_STRING, 120, vAnyObject, entityName, "StateProvince", "State", 0); if (stringState.length() == 0) { if (IsValidAttribute("InternationalRegion", stringInternalEntityStructure) == 0) stringState = GetVariableFromAttribute(stringState, 0, zTYPE_STRING, 120, vAnyObject, entityName, "InternationalRegion", "", 0); } // For ZipCodes larger than five characters, we want to format them with a // dash, if they don't already have a dash. stringZipCode = GetVariableFromAttribute(stringZipCode, 0, zTYPE_STRING, 11, vAnyObject, entityName, "PostalCode", "", 0); if (stringZipCode.length() > 5 && stringZipCode.charAt(5) != '-') stringZipCodeFormatted = stringZipCode.substring(0, 4) + "-" + stringZipCode.substring(5, -1); else stringZipCodeFormatted = stringZipCode; stringCountry = ""; if (IsValidAttribute("Country", stringInternalEntityStructure) == 0) GetStrFromAttrByContext(sb, 50, vAnyObject, entityName, "Country", "Country"); if (sb.equals("US") == true) stringCountry = ""; else stringCountry = sb.toString(); if (stringCity.length() != 0) stringMultiLineAddress = zsprintf(stringMultiLineAddress, "%s%s, %s %s %s", stringMultiLineAddress, stringCity, stringState, stringZipCodeFormatted, stringCountry); else stringMultiLineAddress = zsprintf(stringMultiLineAddress, "%s%s %s %s", stringMultiLineAddress, stringState, stringZipCodeFormatted, stringCountry); stringReturnText = ZeidonStringCopy(stringReturnText, 1, 0, stringMultiLineAddress, 1, 0, 255); return stringReturnText; }