Révision 3816
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/Messages.java (revision 3816) | ||
---|---|---|
1 |
package org.txm.annotation.kr.core.repository; |
|
2 |
|
|
3 |
import org.txm.utils.messages.Utf8NLS; |
|
4 |
|
|
5 |
public class Messages extends Utf8NLS { |
|
6 |
|
|
7 |
static { |
|
8 |
Utf8NLS.initializeMessages(Messages.class); |
|
9 |
} |
|
10 |
|
|
11 |
private Messages() {} |
|
12 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/LocalKnowledgeRepository.java (revision 3816) | ||
---|---|---|
5 | 5 |
import java.io.FileReader; |
6 | 6 |
import java.util.HashSet; |
7 | 7 |
|
8 |
import org.eclipse.osgi.util.NLS; |
|
8 | 9 |
import org.txm.Toolbox; |
9 | 10 |
import org.txm.annotation.kr.core.DatabasePersistenceManager; |
11 |
import org.txm.annotation.kr.core.messages.Messages; |
|
12 |
import org.txm.core.messages.TXMCoreMessages; |
|
10 | 13 |
import org.txm.sql.SQLConnection; |
11 | 14 |
import org.txm.utils.logger.Log; |
12 | 15 |
|
... | ... | |
27 | 30 |
|
28 | 31 |
String path = accessProperties.get(SQLConnection.SQL_ADDRESS); |
29 | 32 |
if (path == null || path.trim().length() == 0) { // no address, forge one |
30 |
path = Toolbox.getTxmHomePath() + "/repositories/" + getName(); |
|
31 |
Log.finest("No address given to build values. No values created");
|
|
33 |
path = Toolbox.getTxmHomePath() + "/repositories/" + getName(); //$NON-NLS-1$
|
|
34 |
Log.finest("No address given to build values. No values created."); //$NON-NLS-1$
|
|
32 | 35 |
return true; |
33 | 36 |
} |
34 | 37 |
currentDirectory = new File(path); |
35 | 38 |
|
36 | 39 |
if (!currentDirectory.exists()) { |
37 |
Log.finest("Values address given does not exists: " + currentDirectory); |
|
40 |
Log.finest("Values address given does not exists: " + currentDirectory); //$NON-NLS-1$
|
|
38 | 41 |
return false; |
39 | 42 |
} |
40 | 43 |
try { |
... | ... | |
47 | 50 |
HashSet<String> values = new HashSet<String>(); |
48 | 51 |
while (line != null) { |
49 | 52 |
if (line.length() > 0) { |
50 |
String split[] = line.split("\t", 2); |
|
53 |
String split[] = line.split("\t", 2); //$NON-NLS-1$
|
|
51 | 54 |
TypedValue val = null; |
52 | 55 |
if (split.length == 2) { |
53 | 56 |
val = new TypedValue(split[1], split[0], type); |
... | ... | |
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
if (values.contains(val.getPK().getId())) { |
60 |
Log.warning("WARNING: duplicate '" + val.getId() + "' value ID in '" + type + "' type of '" + name + "' knowledge repository. Ignoring the value.");
|
|
63 |
Log.warning(TXMCoreMessages.bind(Messages.WarningDuplicatedP0ValueInP1OfTheP2KRIgnoringTheValue, val.getId(), type, name)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
61 | 64 |
} |
62 | 65 |
else { |
63 | 66 |
values.add(val.getPK().getId()); |
... | ... | |
77 | 80 |
return true; |
78 | 81 |
} |
79 | 82 |
catch (Exception e) { |
80 |
Log.severe("Error while loading types from file: " + currentDirectory);
|
|
83 |
Log.severe(NLS.bind(Messages.ErrorWhileLoadingTypesFromFileP0, currentDirectory)); //$NON-NLS-1$
|
|
81 | 84 |
e.printStackTrace(); |
82 | 85 |
return false; |
83 | 86 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/AnnotationType.java (revision 3816) | ||
---|---|---|
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
public String toString() { |
91 |
return name + "(" + effect + ")"; |
|
91 |
return name + "(" + effect + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
92 | 92 |
} |
93 | 93 |
|
94 | 94 |
public void setURL(String webaccess) { |
... | ... | |
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
public String toHumanString() { |
103 |
return this.getName() + " (" + this.getId() + "): " + this.webaccess; |
|
103 |
return this.getName() + " (" + this.getId() + "): " + this.webaccess; //$NON-NLS-1$ //$NON-NLS-2$
|
|
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
public TypedValue getTypedValue(String value) { |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/repository/SQLKnowledgeRepository.java (revision 3816) | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.eclipse.osgi.util.NLS; |
12 | 12 |
import org.txm.annotation.kr.core.DatabasePersistenceManager; |
13 |
import org.txm.annotation.kr.core.messages.Messages; |
|
13 | 14 |
import org.txm.sql.SQLConnection; |
14 | 15 |
import org.txm.utils.logger.Log; |
15 | 16 |
|
... | ... | |
120 | 121 |
boolean[] ret = { false, false }; |
121 | 122 |
|
122 | 123 |
if (isConnected) return ret; |
123 |
Log.warning("KR is not connected, checking credential requirement.");
|
|
124 |
if (DatabasePersistenceManager.ACCESS_SQL.equals(accessProperties.get("mode"))) { |
|
125 |
ret[0] = "true".equals(accessProperties.get(SQLConnection.SQL_USER)); |
|
126 |
ret[1] = "true".equals(accessProperties.get(SQLConnection.SQL_PASSWORD)); |
|
124 |
Log.warning(Messages.KRIsNotConnectedCheckingCredentialRequirement); //$NON-NLS-1$
|
|
125 |
if (DatabasePersistenceManager.ACCESS_SQL.equals(accessProperties.get("mode"))) { //$NON-NLS-1$
|
|
126 |
ret[0] = "true".equals(accessProperties.get(SQLConnection.SQL_USER)); //$NON-NLS-1$
|
|
127 |
ret[1] = "true".equals(accessProperties.get(SQLConnection.SQL_PASSWORD)); //$NON-NLS-1$
|
|
127 | 128 |
} |
128 | 129 |
return ret; |
129 | 130 |
} |
... | ... | |
148 | 149 |
return true; |
149 | 150 |
} |
150 | 151 |
catch (Exception e) { |
151 |
Log.warning(NLS.bind("Fail to get SQL connection with the {0} properties, error={1}", accessProperties, e));
|
|
152 |
Log.warning(NLS.bind(Messages.FailToGetSQLConnectionWithTheP0PropertiesErrorP1, accessProperties, e)); //$NON-NLS-1$
|
|
152 | 153 |
} |
153 | 154 |
isConnected = false; |
154 | 155 |
return false; |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/PropertiesRecoder.java (revision 3816) | ||
---|---|---|
20 | 20 |
|
21 | 21 |
ArrayList<String[]> anaValues = new ArrayList<String[]>(); |
22 | 22 |
|
23 |
String[] currentAnaValues = { "", "", "" }; |
|
23 |
String[] currentAnaValues = { "", "", "" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
24 | 24 |
|
25 | 25 |
StringBuilder anaValue = new StringBuilder(); |
26 | 26 |
|
27 |
String EMPTY = ""; |
|
27 |
String EMPTY = ""; //$NON-NLS-1$
|
|
28 | 28 |
|
29 | 29 |
@Override |
30 | 30 |
public void processStartElement() throws XMLStreamException, IOException { |
31 |
if (localname.equals("w")) { |
|
31 |
if (localname.equals("w")) { //$NON-NLS-1$
|
|
32 | 32 |
startW = true; |
33 | 33 |
anaValues.clear(); |
34 | 34 |
super.processStartElement(); |
35 | 35 |
} |
36 |
else if (localname.equals("ana")) { |
|
36 |
else if (localname.equals("ana")) { //$NON-NLS-1$
|
|
37 | 37 |
if (startW) { |
38 | 38 |
startAna = true; |
39 | 39 |
anaValue.setLength(0); |
... | ... | |
41 | 41 |
currentAnaValues[1] = EMPTY; |
42 | 42 |
currentAnaValues[2] = EMPTY; |
43 | 43 |
for (int i = 0; i < parser.getAttributeCount(); i++) { |
44 |
if (parser.getAttributeLocalName(i).equals("resp")) { |
|
44 |
if (parser.getAttributeLocalName(i).equals("resp")) { //$NON-NLS-1$
|
|
45 | 45 |
currentAnaValues[0] = parser.getAttributeValue(i); |
46 | 46 |
} |
47 |
else if (parser.getAttributeLocalName(i).equals("type")) { |
|
47 |
else if (parser.getAttributeLocalName(i).equals("type")) { //$NON-NLS-1$
|
|
48 | 48 |
currentAnaValues[1] = parser.getAttributeValue(i); |
49 | 49 |
} |
50 | 50 |
} |
... | ... | |
67 | 67 |
|
68 | 68 |
@Override |
69 | 69 |
public void processEndElement() throws XMLStreamException { |
70 |
if (localname.equals("w")) { |
|
70 |
if (localname.equals("w")) { //$NON-NLS-1$
|
|
71 | 71 |
startW = false; |
72 | 72 |
|
73 | 73 |
for (String[] values : anaValues) { |
74 | 74 |
try { |
75 |
writer.writeStartElement("txm:ana"); |
|
76 |
writer.writeAttribute("resp", values[0]); |
|
77 |
writer.writeAttribute("type", values[1]); |
|
75 |
writer.writeStartElement("txm:ana"); //$NON-NLS-1$
|
|
76 |
writer.writeAttribute("resp", values[0]); //$NON-NLS-1$
|
|
77 |
writer.writeAttribute("type", values[1]); //$NON-NLS-1$
|
|
78 | 78 |
writer.writeCharacters(values[2]); |
79 | 79 |
writer.writeEndElement(); |
80 | 80 |
} |
... | ... | |
86 | 86 |
|
87 | 87 |
super.processEndElement(); |
88 | 88 |
} |
89 |
else if (localname.equals("ana")) { |
|
89 |
else if (localname.equals("ana")) { //$NON-NLS-1$
|
|
90 | 90 |
if (startW) { |
91 | 91 |
currentAnaValues[2] = anaValue.toString(); |
92 | 92 |
anaValues.add(currentAnaValues); |
... | ... | |
100 | 100 |
|
101 | 101 |
public static void main(String args[]) { |
102 | 102 |
try { |
103 |
File xmlFile = new File("/home/mdecorde/TEMP/test.xml"); |
|
104 |
File outfile = new File("/home/mdecorde/TEMP/test-o.xml"); |
|
103 |
File xmlFile = new File("/home/mdecorde/TEMP/test.xml"); //$NON-NLS-1$
|
|
104 |
File outfile = new File("/home/mdecorde/TEMP/test-o.xml"); //$NON-NLS-1$
|
|
105 | 105 |
HashSet<String> fromProperties = new HashSet<String>(); |
106 | 106 |
HashSet<String> toProperties = new HashSet<String>(); |
107 | 107 |
|
108 | 108 |
PropertiesRecoder recoder = new PropertiesRecoder(xmlFile, fromProperties, toProperties); |
109 |
System.out.println("Result: " + recoder.process(outfile)); |
|
109 |
System.out.println("Result: " + recoder.process(outfile)); //$NON-NLS-1$
|
|
110 | 110 |
} |
111 | 111 |
catch (Exception e) { |
112 | 112 |
e.printStackTrace(); |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationComparator.java (revision 3816) | ||
---|---|---|
10 | 10 |
public int compare(Annotation a1, Annotation a2) { |
11 | 11 |
// comparer e1 et e2 |
12 | 12 |
|
13 |
DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); |
|
13 |
DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
|
|
14 | 14 |
// System.out.println("Date 1 : "+a1.getDate() + " => "+dateformat.format(a1.getDate())); |
15 | 15 |
// System.out.println("Date 2 : "+a2.getDate() + " => "+dateformat.format(a2.getDate())); |
16 |
StringTokenizer tokenizer1 = new StringTokenizer(dateformat.format(a1.getDate()), "-"); |
|
17 |
StringTokenizer tokenizer2 = new StringTokenizer(dateformat.format(a2.getDate()), "-"); |
|
16 |
StringTokenizer tokenizer1 = new StringTokenizer(dateformat.format(a1.getDate()), "-"); //$NON-NLS-1$
|
|
17 |
StringTokenizer tokenizer2 = new StringTokenizer(dateformat.format(a2.getDate()), "-"); //$NON-NLS-1$
|
|
18 | 18 |
|
19 | 19 |
for (int i = 0; i < 2 && tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens(); ++i) { |
20 | 20 |
String token1 = tokenizer1.nextToken(); |
... | ... | |
42 | 42 |
|
43 | 43 |
public static void main(String[] args) { |
44 | 44 |
AnnotationComparator comp = new AnnotationComparator(); |
45 |
Annotation a1 = new Annotation("truc", "bidule", 3, 10); |
|
46 |
Annotation a2 = new Annotation("truc", "bidule", 6, 8); |
|
45 |
Annotation a1 = new Annotation("truc", "bidule", 3, 10); //$NON-NLS-1$ //$NON-NLS-2$
|
|
46 |
Annotation a2 = new Annotation("truc", "bidule", 6, 8); //$NON-NLS-1$ //$NON-NLS-2$
|
|
47 | 47 |
int ret = comp.compare(a1, a2); |
48 |
System.out.println("Le retour est : " + ret); |
|
48 |
System.out.println("Le retour est : " + ret); //$NON-NLS-1$
|
|
49 | 49 |
} |
50 | 50 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/DatabasePersistenceManager.java (revision 3816) | ||
---|---|---|
9 | 9 |
// Object can be Corpus or KnowledgeRepository |
10 | 10 |
protected HashMap<Object, EntityManager> managers; |
11 | 11 |
|
12 |
public static final String PERSISTENCE_UNIT_NAME = "HSQLKRPERSISTENCE"; |
|
12 |
public static final String PERSISTENCE_UNIT_NAME = "HSQLKRPERSISTENCE"; //$NON-NLS-1$
|
|
13 | 13 |
|
14 |
public static String ACCESS_SQL = "sql"; |
|
14 |
public static String ACCESS_SQL = "sql"; //$NON-NLS-1$
|
|
15 | 15 |
|
16 |
public static String ACCESS_FILE = "file"; |
|
16 |
public static String ACCESS_FILE = "file"; //$NON-NLS-1$
|
|
17 | 17 |
|
18 |
public static String ACCESS_SPARQL = "sparql"; |
|
18 |
public static String ACCESS_SPARQL = "sparql"; //$NON-NLS-1$
|
|
19 | 19 |
|
20 | 20 |
/** |
21 | 21 |
* Instantiates a new database manager. |
... | ... | |
48 | 48 |
for (Object key : managers.keySet()) { |
49 | 49 |
EntityManager m = managers.get(key); |
50 | 50 |
m.flush(); |
51 |
m.createNativeQuery("SHUTDOWN;"); |
|
51 |
m.createNativeQuery("SHUTDOWN;"); //$NON-NLS-1$
|
|
52 | 52 |
m.close(); |
53 | 53 |
} |
54 | 54 |
managers.clear(); |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java (revision 3816) | ||
---|---|---|
14 | 14 |
import org.eclipse.core.runtime.IProgressMonitor; |
15 | 15 |
import org.eclipse.osgi.util.NLS; |
16 | 16 |
import org.osgi.service.prefs.BackingStoreException; |
17 |
import org.txm.annotation.kr.core.messages.KRAnnotationCoreMessages;
|
|
17 |
import org.txm.annotation.kr.core.messages.Messages; |
|
18 | 18 |
import org.txm.annotation.kr.core.repository.AnnotationEffect; |
19 | 19 |
import org.txm.annotation.kr.core.repository.AnnotationType; |
20 | 20 |
import org.txm.annotation.kr.core.repository.KnowledgeRepository; |
... | ... | |
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
if (monitor != null) { |
77 |
monitor.beginTask(KRAnnotationCoreMessages.savingAnnotations, annots.size());
|
|
77 |
monitor.beginTask(Messages.savingAnnotations, annots.size()); |
|
78 | 78 |
monitor.setTaskName("Writing annotations in XML-TXM files"); |
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
AnnotationWriter writer = new AnnotationWriter(corpus); |
82 | 82 |
if (writer.writeAnnotations(annots, monitor)) { |
83 |
Log.info(KRAnnotationCoreMessages.annotationSuccesfullyWritten);
|
|
84 |
corpus.getProject().appendToHistory(NLS.bind(KRAnnotationCoreMessages.savingP0Annotations, annots.size()));
|
|
83 |
Log.info(Messages.annotationSuccesfullyWritten); |
|
84 |
corpus.getProject().appendToHistory(NLS.bind(Messages.savingP0Annotations, annots.size())); |
|
85 | 85 |
tempManager.deleteAnnotations(); |
86 | 86 |
dirty = false; |
87 | 87 |
return true; |
... | ... | |
93 | 93 |
AnnotationWriter writer = new AnnotationWriter(corpus); |
94 | 94 |
|
95 | 95 |
if (writer.writeAnnotationsInStandoff(resultZipFile)) { |
96 |
Log.info(NLS.bind(KRAnnotationCoreMessages.annotationSuccesfullyWrittenIntheP0File, resultZipFile));
|
|
96 |
Log.info(NLS.bind(Messages.annotationSuccesfullyWrittenIntheP0File, resultZipFile)); |
|
97 | 97 |
return true; |
98 | 98 |
} |
99 | 99 |
return false; |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationPK.java (revision 3816) | ||
---|---|---|
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
public String toString() { |
65 |
return getRefType() + "[" + getStartPosition() + "-" + getEndPosition() + "]"; |
|
65 |
return getRefType() + "[" + getStartPosition() + "-" + getEndPosition() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
66 | 66 |
} |
67 | 67 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/conversion/CorpusRuledConvertion.java (revision 3816) | ||
---|---|---|
12 | 12 |
import org.apache.commons.lang.StringUtils; |
13 | 13 |
import org.eclipse.osgi.util.NLS; |
14 | 14 |
import org.txm.Toolbox; |
15 |
import org.txm.annotation.kr.core.messages.Messages; |
|
15 | 16 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
16 | 17 |
import org.txm.utils.ConsoleProgressBar; |
17 | 18 |
import org.txm.utils.io.IOUtils; |
... | ... | |
32 | 33 |
BufferedReader reader = IOUtils.getReader(conversionFile); |
33 | 34 |
String line = reader.readLine(); |
34 | 35 |
while (line != null) { |
35 |
int idx = line.indexOf("\t"); |
|
36 |
int idx = line.indexOf("\t"); //$NON-NLS-1$
|
|
36 | 37 |
if (idx > 0) { |
37 | 38 |
String k = line.substring(0, idx); |
38 | 39 |
String v = line.substring(idx + 1); |
... | ... | |
41 | 42 |
line = reader.readLine(); |
42 | 43 |
} |
43 | 44 |
|
44 |
Log.info(NLS.bind("Conversion rules: {0}.", rules));
|
|
45 |
Log.info(NLS.bind(Messages.ConversionRulesP0, rules));
|
|
45 | 46 |
} |
46 | 47 |
|
47 | 48 |
public CorpusRuledConvertion(LinkedHashMap<Pattern, String> rules, |
... | ... | |
54 | 55 |
|
55 | 56 |
public boolean process(MainCorpus corpus) throws XMLStreamException, IOException { |
56 | 57 |
File binaryCorpusDirectory = corpus.getProjectDirectory(); |
57 |
File txmDirectory = new File(binaryCorpusDirectory, "txm"); |
|
58 |
File txmDirectory = new File(binaryCorpusDirectory, "txm"); //$NON-NLS-1$
|
|
58 | 59 |
if (!txmDirectory.exists()) { |
59 |
Log.warning(NLS.bind("The 'txm' directory was not found in {0}.", binaryCorpusDirectory.getAbsolutePath()));
|
|
60 |
Log.warning(NLS.bind(Messages.ThxTXMDirectoryWasNotFoundInP0, binaryCorpusDirectory.getAbsolutePath()));
|
|
60 | 61 |
return false; |
61 | 62 |
} |
62 | 63 |
File txmCorpusDirectory = new File(txmDirectory, corpus.getID()); |
63 | 64 |
if (!txmCorpusDirectory.exists()) { |
64 |
Log.warning(NLS.bind("The ''{0}'' corpus directory was not found in {1}.", corpus.getName(), txmDirectory.getAbsolutePath()));
|
|
65 |
Log.warning(NLS.bind(Messages.TheP0CorpusDirectoryWasNotFoundInP1, corpus.getName(), txmDirectory.getAbsolutePath()));
|
|
65 | 66 |
return false; |
66 | 67 |
} |
67 | 68 |
File[] files = txmCorpusDirectory.listFiles(IOUtils.HIDDENFILE_FILTER); |
68 | 69 |
if (files == null || files.length == 0) { |
69 |
Log.warning(NLS.bind("No file found in the {0} directory.", txmCorpusDirectory));
|
|
70 |
Log.warning(NLS.bind(Messages.NoFileFoundInTheP0Directory, txmCorpusDirectory));
|
|
70 | 71 |
return false; |
71 | 72 |
} |
72 | 73 |
ConsoleProgressBar cpb = new ConsoleProgressBar(files.length); |
... | ... | |
74 | 75 |
cpb.tick(); |
75 | 76 |
if (xmlFile.isDirectory()) continue; |
76 | 77 |
if (xmlFile.isHidden()) continue; |
77 |
if (!xmlFile.getName().endsWith(".xml")) continue; |
|
78 |
if (!xmlFile.getName().endsWith(".xml")) continue; //$NON-NLS-1$
|
|
78 | 79 |
|
79 |
File tmpFile = new File(xmlFile.getParentFile(), "tmp_" + xmlFile.getName()); |
|
80 |
File tmpFile = new File(xmlFile.getParentFile(), "tmp_" + xmlFile.getName()); //$NON-NLS-1$
|
|
80 | 81 |
XMLTXMFileRuledConversion converter = new XMLTXMFileRuledConversion(xmlFile, rules, null, oldType, newType, XMLTXMFileRuledConversion.ABANDON); |
81 | 82 |
if (converter.process(tmpFile)) { |
82 | 83 |
xmlFile.delete(); |
... | ... | |
89 | 90 |
|
90 | 91 |
HashSet<String> errors = converter.getNoMatchValues(); |
91 | 92 |
if (errors.size() > 0) { |
92 |
Log.warning("Some values did not match rule: ");
|
|
93 |
Log.warning(Messages.SomeValuesDidNotMatchRule);
|
|
93 | 94 |
int i = 0; |
94 | 95 |
for (String error : errors) { |
95 |
Log.warning("\t" + error); |
|
96 |
Log.warning("\t" + error); //$NON-NLS-1$
|
|
96 | 97 |
if (i >= 10) break; |
97 | 98 |
} |
98 | 99 |
if (errors.size() > 10) { |
99 | 100 |
try { |
100 |
File errorFile = new File(Toolbox.getTxmHomePath(), "errors.txt"); |
|
101 |
IOUtils.write(errorFile, StringUtils.join(errors, "\t")); |
|
102 |
Log.warning(NLS.bind("More errors, see the {0} errors file.", errorFile.getAbsolutePath()));
|
|
101 |
File errorFile = new File(Toolbox.getTxmHomePath(), "errors.txt"); //$NON-NLS-1$
|
|
102 |
IOUtils.write(errorFile, StringUtils.join(errors, "\t")); //$NON-NLS-1$
|
|
103 |
Log.warning(NLS.bind(Messages.MoreErrorsSeeTheP0ErrorFile, errorFile.getAbsolutePath()));
|
|
103 | 104 |
} |
104 | 105 |
catch (Exception e) { |
105 | 106 |
e.printStackTrace(); |
... | ... | |
110 | 111 |
|
111 | 112 |
tmpFile.renameTo(xmlFile); |
112 | 113 |
if (tmpFile.exists()) { |
113 |
Log.warning(NLS.bind("Could not replace original file with the {0} result file with {1}.", xmlFile, tmpFile));
|
|
114 |
Log.warning(NLS.bind(Messages.CouldNotReplaceOriginalFileWithTheP0ResultFile, xmlFile, tmpFile));
|
|
114 | 115 |
return false; |
115 | 116 |
} |
116 | 117 |
} |
117 | 118 |
else { |
118 |
Log.warning(NLS.bind("Fail to process the {0} XML file.", xmlFile));
|
|
119 |
Log.warning(NLS.bind(Messages.FailToProcessTheP0XMLFile, xmlFile));
|
|
119 | 120 |
return false; |
120 | 121 |
} |
121 | 122 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationWriter.java (revision 3816) | ||
---|---|---|
16 | 16 |
import org.eclipse.osgi.util.NLS; |
17 | 17 |
import org.osgi.service.prefs.BackingStoreException; |
18 | 18 |
import org.txm.Toolbox; |
19 |
import org.txm.annotation.kr.core.messages.KRAnnotationCoreMessages;
|
|
19 |
import org.txm.annotation.kr.core.messages.Messages; |
|
20 | 20 |
import org.txm.annotation.kr.core.repository.AnnotationEffect; |
21 | 21 |
import org.txm.annotation.kr.core.repository.AnnotationType; |
22 | 22 |
import org.txm.annotation.kr.core.repository.KnowledgeRepository; |
... | ... | |
162 | 162 |
public boolean writeAnnotations(List<Annotation> allCorpusAnnotations, IProgressMonitor monitor) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException, XMLStreamException, |
163 | 163 |
BackingStoreException { |
164 | 164 |
// MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(c.getName()); |
165 |
Log.info(NLS.bind(KRAnnotationCoreMessages.savingP0Annotations, allCorpusAnnotations.size()));
|
|
165 |
Log.info(NLS.bind(Messages.savingP0Annotations, allCorpusAnnotations.size())); |
|
166 | 166 |
|
167 | 167 |
int[] end_limits = corpus.getTextEndLimits(); |
168 | 168 |
int[] start_limits = corpus.getTextStartLimits(); |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/CQPAnnotationManager.java (revision 3816) | ||
---|---|---|
25 | 25 |
|
26 | 26 |
MainCorpus corpus; |
27 | 27 |
|
28 |
public static final String REF = "ref"; |
|
28 |
public static final String REF = "ref"; //$NON-NLS-1$
|
|
29 | 29 |
|
30 | 30 |
public CQPAnnotationManager(MainCorpus corpus) { |
31 | 31 |
this.corpus = corpus; |
... | ... | |
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
for (StructuralUnit su : corpus.getStructuralUnits()) { |
106 |
if (su.getName().equals("text") || su.getName().equals("txmcorpus") || |
|
107 |
su.getName().equals("lb") || su.getName().equals("pb")) continue; // that's no annotation for sure ;) |
|
106 |
if (su.getName().equals("text") || su.getName().equals("txmcorpus") || //$NON-NLS-1$ //$NON-NLS-2$
|
|
107 |
su.getName().equals("lb") || su.getName().equals("pb")) continue; // that's no annotation for sure ;) //$NON-NLS-1$ //$NON-NLS-2$
|
|
108 | 108 |
|
109 | 109 |
StructuralUnitProperty sup = su.getProperty(REF); |
110 |
if (sup == null) sup = su.getProperty("n"); |
|
110 |
if (sup == null) sup = su.getProperty("n"); //$NON-NLS-1$
|
|
111 | 111 |
if (sup != null) { |
112 | 112 |
if (!supList.containsKey(sup)) // don't override a know annotation |
113 | 113 |
supList.put(sup, null); |
... | ... | |
401 | 401 |
return struc_str[0]; |
402 | 402 |
} |
403 | 403 |
else { // should not happens |
404 |
Log.warning("WARNING: FOUND EXISTING ANNOTATION FOR TYPE=" + type + " START=" + start + " END=" + end); |
|
404 |
Log.warning("WARNING: FOUND EXISTING ANNOTATION FOR TYPE=" + type + " START=" + start + " END=" + end); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
405 | 405 |
return null; |
406 | 406 |
} |
407 | 407 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/Annotation.java (revision 3816) | ||
---|---|---|
21 | 21 |
private AnnotationPK PK; |
22 | 22 |
|
23 | 23 |
// corresponding to the type and value of the KnowledgeRepository, used to annotate |
24 |
private String refVal = ""; |
|
24 |
private String refVal = ""; //$NON-NLS-1$
|
|
25 | 25 |
|
26 | 26 |
// user in the project, responsible for the annotation, maybe should be an integer |
27 |
private String annotatorId = ""; |
|
27 |
private String annotatorId = ""; //$NON-NLS-1$
|
|
28 | 28 |
|
29 | 29 |
private String date; |
30 | 30 |
|
... | ... | |
41 | 41 |
this.annotatorId = s; |
42 | 42 |
} |
43 | 43 |
else { |
44 |
this.annotatorId = System.getProperty("user.name"); |
|
44 |
this.annotatorId = System.getProperty("user.name"); //$NON-NLS-1$
|
|
45 | 45 |
} |
46 | 46 |
} |
47 | 47 |
|
... | ... | |
82 | 82 |
|
83 | 83 |
|
84 | 84 |
public String toString() { |
85 |
return getPK().toString() + "=" + getValue(); |
|
85 |
return getPK().toString() + "=" + getValue(); //$NON-NLS-1$
|
|
86 | 86 |
} |
87 | 87 |
|
88 | 88 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/preferences/KRAnnotationPreferences.java (revision 3816) | ||
---|---|---|
11 | 11 |
*/ |
12 | 12 |
public class KRAnnotationPreferences extends TXMPreferences { |
13 | 13 |
|
14 |
public static final String UPDATE_EDITION = "udpate_edition"; |
|
14 |
public static final String UPDATE_EDITION = "udpate_edition"; //$NON-NLS-1$
|
|
15 | 15 |
|
16 |
public static final String UPDATE = "udpate"; |
|
16 |
public static final String UPDATE = "udpate"; //$NON-NLS-1$
|
|
17 | 17 |
|
18 |
public static final String PRESERVE_ANNOTATIONS = "reset_temporary_annotations_when leaving_txm"; |
|
18 |
public static final String PRESERVE_ANNOTATIONS = "reset_temporary_annotations_when leaving_txm"; //$NON-NLS-1$
|
|
19 | 19 |
|
20 | 20 |
/** |
21 | 21 |
* Gets the instance. |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/messages/KRAnnotationCoreMessages.java (revision 3816) | ||
---|---|---|
1 |
package org.txm.annotation.kr.core.messages; |
|
2 |
|
|
3 |
import org.eclipse.osgi.util.NLS; |
|
4 |
import org.txm.utils.messages.Utf8NLS; |
|
5 |
|
|
6 |
|
|
7 |
/** |
|
8 |
* KR annotation Core messages. |
|
9 |
* |
|
10 |
* @author mdecorde |
|
11 |
* @author sjacquot |
|
12 |
* |
|
13 |
*/ |
|
14 |
public class KRAnnotationCoreMessages extends NLS { |
|
15 |
|
|
16 |
private static final String BUNDLE_NAME = "org.txm.annotation.kr.core.messages.messages"; //$NON-NLS-1$ |
|
17 |
|
|
18 |
public static String savingP0Annotations; |
|
19 |
|
|
20 |
public static String annotationSuccesfullyWritten; |
|
21 |
|
|
22 |
public static String savingAnnotations; |
|
23 |
|
|
24 |
public static String annotationSuccesfullyWrittenIntheP0File; |
|
25 |
|
|
26 |
static { |
|
27 |
// initialize resource bundle |
|
28 |
Utf8NLS.initializeMessages(BUNDLE_NAME, KRAnnotationCoreMessages.class); |
|
29 |
} |
|
30 |
|
|
31 |
private KRAnnotationCoreMessages() { |
|
32 |
|
|
33 |
} |
|
34 |
} |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/messages/messages.properties (revision 3816) | ||
---|---|---|
4 | 4 |
annotationSuccesfullyWrittenIntheP0File=Annotations successfully written in the {0} file. |
5 | 5 |
savingAnnotations=Saving annotations. |
6 | 6 |
savingP0Annotations=Saving {0} annotations... |
7 |
ConversionRulesP0=Conversion rules: {0}. |
|
8 |
CouldNotReplaceOriginalFileWithTheP0ResultFile=Could not replace original file with the {0} result file with {1}. |
|
9 |
FailToProcessTheP0XMLFile=Fail to process the {0} XML file. |
|
10 |
MoreErrorsSeeTheP0ErrorFile=More errors, see the {0} errors file. |
|
11 |
NoFileFoundInTheP0Directory=No file found in the {0} directory. |
|
12 |
SomeValuesDidNotMatchRule=Some values did not match rule: |
|
13 |
TheP0CorpusDirectoryWasNotFoundInP1=The ''{0}'' corpus directory was not found in {1}. |
|
14 |
ThxTXMDirectoryWasNotFoundInP0=The 'txm' directory was not found in {0}. |
|
15 |
FailToGetSQLConnectionWithTheP0PropertiesErrorP1=Fail to get SQL connection with the {0} properties, error={1} |
|
16 |
KRIsNotConnectedCheckingCredentialRequirement=KR is not connected, checking credential requirement. |
|
17 |
LocalKnowledgeRepository.ErrorWhileLoadingTypesFromFileP0=Error while loading types from file: {0}. |
|
18 |
LocalKnowledgeRepository.WarningDuplicatedP0ValueInP1OfTheP2KRIgnoringTheValue=WARNING: duplicated ''{0}'' value ID in the ''{1}'' type of the ''{3}'' knowledge repository. Ignoring the value. |
TXM/trunk/bundles/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/messages/Messages.java (revision 3816) | ||
---|---|---|
1 |
package org.txm.annotation.kr.core.messages; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.eclipse.osgi.util.NLS; |
|
6 |
import org.txm.utils.messages.Utf8NLS; |
|
7 |
|
|
8 |
|
|
9 |
/** |
|
10 |
* KR annotation Core messages. |
|
11 |
* |
|
12 |
* @author mdecorde |
|
13 |
* @author sjacquot |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class Messages extends NLS { |
|
17 |
|
|
18 |
private static final String BUNDLE_NAME = "org.txm.annotation.kr.core.messages.messages"; //$NON-NLS-1$ |
|
19 |
|
|
20 |
public static String KRIsNotConnectedCheckingCredentialRequirement; |
|
21 |
|
|
22 |
public static String WarningDuplicatedP0ValueInP1OfTheP2KRIgnoringTheValue; |
|
23 |
|
|
24 |
public static String ErrorWhileLoadingTypesFromFileP0; |
|
25 |
|
|
26 |
public static String savingP0Annotations; |
|
27 |
|
|
28 |
public static String annotationSuccesfullyWritten; |
|
29 |
|
|
30 |
public static String savingAnnotations; |
|
31 |
|
|
32 |
public static String annotationSuccesfullyWrittenIntheP0File; |
|
33 |
|
|
34 |
public static String ConversionRulesP0; |
|
35 |
public static String CouldNotReplaceOriginalFileWithTheP0ResultFile; |
|
36 |
public static String FailToProcessTheP0XMLFile; |
|
37 |
public static String MoreErrorsSeeTheP0ErrorFile; |
|
38 |
public static String NoFileFoundInTheP0Directory; |
|
39 |
public static String SomeValuesDidNotMatchRule; |
|
40 |
public static String TheP0CorpusDirectoryWasNotFoundInP1; |
|
41 |
public static String ThxTXMDirectoryWasNotFoundInP0; |
|
42 |
|
|
43 |
public static String FailToGetSQLConnectionWithTheP0PropertiesErrorP1; |
|
44 |
|
|
45 |
static { |
|
46 |
// initialize resource bundle |
|
47 |
Utf8NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
|
48 |
} |
|
49 |
|
|
50 |
private Messages() { |
|
51 |
|
|
52 |
} |
|
53 |
} |
|
0 | 54 |
Formats disponibles : Unified diff