Revision: 17671
http://sourceforge.net/p/gate/code/17671
Author: markagreenwood
Date: 2014-03-15 10:03:31 +0000 (Sat, 15 Mar 2014)
Log Message:
-----------
and that's all the G* plugins cleaned up and the compiler warnings enabled
Modified Paths:
--------------
gate/trunk/plugins/GENIA/build.xml
gate/trunk/plugins/GENIA/src/gate/creole/genia/splitter/GENIASentenceSplitter.java
gate/trunk/plugins/Gazetteer_LKB/.classpath
gate/trunk/plugins/Gazetteer_LKB/build.xml
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/AliasCacheImpl.java
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/EntityPriority.java
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/HashRegister.java
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/Options.java
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/test/PrivateRepositoryFeedTest.java
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/util/datastore/GazetteerListFeed.java
gate/trunk/plugins/Gazetteer_Ontology_Based/build.xml
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/OntoRootGaz.java
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/query/serql/SerqlUtils.java
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/regex/ExpressionFinder.java
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/Ontology2Map.java
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/StringUtil.java
gate/trunk/plugins/Groovy/build.xml
gate/trunk/plugins/Groovy/src/gate/groovy/GateGroovyMethods.java
gate/trunk/plugins/Groovy/src/gate/groovy/GroovySupport.java
gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java
gate/trunk/plugins/Groovy/src/gate/groovy/ScriptableController.groovy
gate/trunk/plugins/Groovy/src/gate/groovy/gui/ControllerScriptEditor.java
gate/trunk/plugins/Groovy/src/gate/groovy/gui/ScriptPREditor.java
Modified: gate/trunk/plugins/GENIA/build.xml
===================================================================
--- gate/trunk/plugins/GENIA/build.xml 2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/GENIA/build.xml 2014-03-15 10:03:31 UTC (rev 17671)
@@ -11,6 +11,7 @@
<property name="jar.location" location="GENIA.jar" />
<property name="doc.dir" location="doc" />
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
+ <property name="gate.compile.maxwarnings" value="10000" />
<!-- Path to compile - includes gate.jar and GATE/lib/*.jar -->
<path id="compile.classpath">
@@ -28,7 +29,11 @@
<!-- compile the source -->
<target name="compile" depends="prepare">
- <javac classpathref="compile.classpath" srcdir="${src.dir}"
destdir="${classes.dir}" debug="true" debuglevel="lines,source"
encoding="UTF-8" source="1.5" target="1.5" />
+ <javac classpathref="compile.classpath" srcdir="${src.dir}"
destdir="${classes.dir}" debug="true" debuglevel="lines,source"
encoding="UTF-8" source="1.6" target="1.6">
+ <compilerarg value="-Xmaxwarns" />
+ <compilerarg value="${gate.compile.maxwarnings}" />
+ <compilerarg value="-Xlint:all" />
+ </javac>
</target>
<target name="resources" depends="prepare">
Modified:
gate/trunk/plugins/GENIA/src/gate/creole/genia/splitter/GENIASentenceSplitter.java
===================================================================
---
gate/trunk/plugins/GENIA/src/gate/creole/genia/splitter/GENIASentenceSplitter.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/GENIA/src/gate/creole/genia/splitter/GENIASentenceSplitter.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -29,9 +29,13 @@
import java.io.FileReader;
import java.net.URL;
+import org.apache.commons.io.IOUtils;
+
@CreoleResource(name = "GENIA Sentence Splitter", icon =
"sentence-splitter.png", helpURL =
"http://gate.ac.uk/userguide/sec:domain-creole:biomed:genia")
public class GENIASentenceSplitter extends AbstractLanguageAnalyser {
+ private static final long serialVersionUID = 142837355544158905L;
+
private boolean debug = false;
private String annotationSetName;
@@ -81,6 +85,9 @@
String docContent =
document.getContent().toString().replace((char)160, ' ');
+ //The reader that brings back the output from the sentence splitter
+ BufferedReader in = null;
+
try {
// create temporary files to use with the external sentence splitter
File tmpIn = File.createTempFile("GENIA", ".txt");
@@ -109,7 +116,7 @@
int end = 0;
// read in the output from the sentence splitter one line at a time
- BufferedReader in = new BufferedReader(new FileReader(tmpOut));
+ in = new BufferedReader(new FileReader(tmpOut));
String sentence = in.readLine();
while(sentence != null) {
@@ -141,5 +148,8 @@
} catch(Exception ioe) {
throw new ExecutionException("An error occured running the splitter",
ioe);
}
+ finally {
+ IOUtils.closeQuietly(in);
+ }
}
}
Modified: gate/trunk/plugins/Gazetteer_LKB/.classpath
===================================================================
--- gate/trunk/plugins/Gazetteer_LKB/.classpath 2014-03-15 09:18:40 UTC (rev
17670)
+++ gate/trunk/plugins/Gazetteer_LKB/.classpath 2014-03-15 10:03:31 UTC (rev
17671)
@@ -7,12 +7,12 @@
<classpathentry exported="true" kind="lib"
path="lib/commons-httpclient-3.1.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/kim-api-3.0-RC5.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/kim-util-3.0-RC5.jar"/>
- <classpathentry exported="true" kind="lib"
path="lib/openrdf-sesame-2.6.10-onejar.jar"/>
- <classpathentry exported="true" kind="lib"
path="lib/owlim-lite-5.3.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/slf4j-api-1.5.11.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/slf4j-log4j12-1.5.11.jar"/>
<classpathentry exported="true" kind="lib"
path="lib/trove4j-2.0.2.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" exported="true" kind="src"
path="/GATE"/>
+ <classpathentry kind="lib" path="lib/openrdf-sesame-2.7.9-onejar.jar"/>
+ <classpathentry kind="lib" path="lib/owlim-lite-5.4.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: gate/trunk/plugins/Gazetteer_LKB/build.xml
===================================================================
--- gate/trunk/plugins/Gazetteer_LKB/build.xml 2014-03-15 09:18:40 UTC (rev
17670)
+++ gate/trunk/plugins/Gazetteer_LKB/build.xml 2014-03-15 10:03:31 UTC (rev
17671)
@@ -49,6 +49,8 @@
<!-- JavaDoc documentation directory -->
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
+ <property name="gate.compile.maxwarnings" value="10000" />
+
<!-- lib directory - put any additional JAR files your plugin requires into
this directory. You will also need to add them as <JAR> entries in
creole.xml -->
@@ -84,8 +86,12 @@
destdir="${classes.dir}"
debug="true"
debuglevel="lines,source"
- source="1.5"
- target="1.5" />
+ source="1.6"
+ target="1.6">
+ <compilerarg value="-Xmaxwarns" />
+ <compilerarg value="${gate.compile.maxwarnings}" />
+ <compilerarg value="-Xlint:all" />
+ </javac>
</target>
<!-- copy resources (anything non-.java) from src to classes -->
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/AliasCacheImpl.java
===================================================================
---
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/AliasCacheImpl.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/AliasCacheImpl.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -4,9 +4,24 @@
import gate.util.profile.Profiler;
import gnu.trove.TIntHashSet;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.rmi.RemoteException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.commons.collections.Transformer;
import org.apache.commons.io.FileUtils;
@@ -64,9 +79,9 @@
* aliases has been stored in the alias register. */
protected HashRegister aliasInstRegister;
/** Array used for encoding/decoding the instance URI's name-spaces */
- protected ArrayList<String> instNS;
+ protected List<String> instNS;
/** Array used for encoding/decoding the semantic class URIs */
- protected ArrayList<String> classCache;
+ protected List<String> classCache;
/** Additional register containing exactly appointed aliases, which
* must be ignored on storing */
protected HashRegister aliasToIgnore;
@@ -301,6 +316,7 @@
pro.checkPoint("cache loaded");
}
+ @SuppressWarnings("unchecked")
private boolean loadDictionaryFromCacheFile(File fileTCache,
boolean flagTLoaded) {
try {
@@ -310,8 +326,8 @@
ois.close();
aliasRegister = (HashRegister) res[0];
aliasPrefixes = (TIntHashSet) res[1];
- instNS = (ArrayList<String>) res[2];
- classCache = (ArrayList<String>) res[3];
+ instNS = (List<String>) res[2];
+ classCache = (List<String>) res[3];
aliasInstRegister = new HashRegister();
@@ -388,9 +404,9 @@
public void endTableQueryResult() throws IOException {
super.endTableQueryResult();
if (existsClassPriority && allPrioritiesCompetition != null) {
- Iterator it = allPrioritiesCompetition.keySet().iterator();
+ Iterator<String> it = allPrioritiesCompetition.keySet().iterator();
while (it.hasNext()) {
- ArrayList<priorityCompetition> pcList =
+ List<priorityCompetition> pcList =
allPrioritiesCompetition.get(it.next());
int maxPrior = pcList.get(0).maxPriority;
int treshold = m_entPrior.getThreshold();
@@ -571,7 +587,7 @@
* @param alias - the label string of the alias
* @return - array of matching HashedAlias instances
*/
- public ArrayList<KimLookupParser.AliasWrapper> lookup(String alias) {
+ public List<KimLookupParser.AliasWrapper> lookup(String alias) {
ParsingFrame pfm = new ParsingFrame(alias);
pfm.parseAll();
return lookup(pfm, true);
@@ -580,10 +596,10 @@
public Collection<KimLookupParser.AliasWrapper> lookup(ParsingFrame pfm) {
return lookup(pfm, false);
}
- private ArrayList<KimLookupParser.AliasWrapper> lookup(
+ private List<KimLookupParser.AliasWrapper> lookup(
ParsingFrame pfm, boolean exactlySame) {
Stats.markIt(-1);
- ArrayList<KimLookupParser.AliasWrapper> res = new
ArrayList<KimLookupParser.AliasWrapper>();
+ List<KimLookupParser.AliasWrapper> res = new
ArrayList<KimLookupParser.AliasWrapper>();
Object[] tmp = aliasRegister.get(pfm.getAliasHash1());
Stats.markIt(5);
@@ -687,7 +703,7 @@
}
}
- protected HashMap<String, ArrayList<priorityCompetition>>
allPrioritiesCompetition = new HashMap();
+ protected Map<String, List<priorityCompetition>> allPrioritiesCompetition =
new HashMap<String,List<priorityCompetition>>();
protected EntityPriority entPrior;
protected boolean existsClassPriority = false;
@@ -715,13 +731,13 @@
rejectedByPriority =
entPrior.m_hClassPrio.containsKey(priorityClassName);
if (rejectedByPriority) {
- int mp = (Integer) entPrior.m_hClassPrio.get(priorityClassName);
+ int mp = entPrior.m_hClassPrio.get(priorityClassName);
log.info("COMPETITION:" + "\t" + instURI
+ "\t" + classURI + "\t" + alias + "\t" + mp);
if (!allPrioritiesCompetition.containsKey(alias))
allPrioritiesCompetition.put(alias,
new ArrayList<priorityCompetition>());
- ArrayList<priorityCompetition> pcList =
+ List<priorityCompetition> pcList =
allPrioritiesCompetition.get(alias);
boolean foundLesser = false;
for (int i = 0; i < pcList.size(); i++) {
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/EntityPriority.java
===================================================================
---
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/EntityPriority.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/EntityPriority.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -4,6 +4,7 @@
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import com.ontotext.kim.KIMConstants;
@@ -21,9 +22,9 @@
protected int m_nThreshold;
protected boolean m_bFilterLookups;
- protected HashMap m_hClassPrio;
- protected HashMap m_hInstPrio;
- protected HashMap m_hRules;
+ protected Map<String,Integer> m_hClassPrio;
+ protected Map<String,Integer> m_hInstPrio;
+ protected Map<String,Integer> m_hRules;
/**
* read the config file
@@ -31,9 +32,9 @@
* @throws Exception
*/
public EntityPriority() {
- m_hClassPrio = new HashMap(50);
- m_hInstPrio = new HashMap(50);
- m_hRules = new HashMap(100);
+ m_hClassPrio = new HashMap<String,Integer>(50);
+ m_hInstPrio = new HashMap<String,Integer>(50);
+ m_hRules = new HashMap<String,Integer>(100);
m_prop = new Properties();
}
@@ -52,7 +53,7 @@
.getProperty("priority.filterLookups"));
// init class and instance priority
- for (Iterator iter = m_prop.keySet().iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = m_prop.keySet().iterator();
iter.hasNext();) {
String item = (String) iter.next();
if (item.startsWith(PRIORITY_CLASS_PREFIX))
addClassPriority(item);
@@ -94,17 +95,17 @@
}
public int getInstancePriority(String sInstanceURI) {
- Integer prio = (Integer) m_hInstPrio.get(stripNameSpace(sInstanceURI));
+ Integer prio = m_hInstPrio.get(stripNameSpace(sInstanceURI));
return prio == null ? m_nDefaultInstancePriority : prio.intValue();
}
public int getClassPriority(String sClassURI) {
- Integer prio = (Integer) m_hClassPrio.get(stripNameSpace(sClassURI));
+ Integer prio = m_hClassPrio.get(stripNameSpace(sClassURI));
return prio == null ? m_nDefaultInstancePriority : prio.intValue();
}
public int getPairDelta(String sClass1, String sClass2) {
- Integer nDelta = (Integer) m_hRules.get(stripNameSpace(sClass1) + "_"
+ Integer nDelta = m_hRules.get(stripNameSpace(sClass1) + "_"
+ stripNameSpace(sClass2));
if (nDelta == null)
return 0;
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/HashRegister.java
===================================================================
---
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/HashRegister.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/HashRegister.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -80,7 +80,7 @@
byte elemCountChange = add12(element);
if (elemCountChange < 0) {
if (element instanceof Comparable)
- elemCountChange = addSorted((Comparable) element);
+ elemCountChange = addSorted((Comparable<?>) element);
else
elemCountChange = addUnsorted(element);
}
@@ -117,7 +117,8 @@
return 1;
}
- private static final Comparator<Comparable> nsc = new NullComparator(true);
+ @SuppressWarnings("unchecked")
+ private static final Comparator<Comparable<?>> nsc = new
NullComparator(true);
/** Method adds new element to the container in sorted manner.
* The method is called only if the container already have 2
@@ -126,9 +127,9 @@
* @return number of elements stored: 1 - if stored successfully;
* 0 - element already existed and no duplicates are allowed;
*/
- private byte addSorted(Comparable element) {
- Comparable[] newSubReg;
- Comparable[] oldSubReg = ((Comparable[])elementHolder);
+ private byte addSorted(Comparable<?> element) {
+ Comparable<?>[] newSubReg;
+ Comparable<?>[] oldSubReg = ((Comparable[])elementHolder);
int addPosition = Arrays.binarySearch( oldSubReg, element, nsc);
if (addPosition >= 0) {
return 0; // ignore the new one and retain the old one
@@ -180,8 +181,8 @@
Object[] newSubReg;
if (element instanceof Comparable) {
newSubReg = new Comparable[1 + subRegIncrement];
- if (nsc.compare((Comparable) elementHolder,
- (Comparable) element) < 0) {
+ if (nsc.compare((Comparable<?>) elementHolder,
+ (Comparable<?>) element) < 0) {
newSubReg[0] = elementHolder;
newSubReg[1] = element;
}
@@ -219,8 +220,8 @@
if (element == null)
return (elements == null);
else if (element instanceof Comparable)
- return Arrays.binarySearch( (Comparable[])elements,
- (Comparable) element, nsc) >= 0;
+ return Arrays.binarySearch( (Comparable<?>[])elements,
+ (Comparable<?>) element, nsc) >= 0;
else
return Arrays.asList(elements).contains(element);
}
@@ -234,8 +235,8 @@
int i = -1;
if (element != null) {
if (element instanceof Comparable)
- i = Arrays.binarySearch( (Comparable[])elements,
- (Comparable) element, nsc);
+ i = Arrays.binarySearch( (Comparable<?>[])elements,
+ (Comparable<?>) element, nsc);
else
i = Arrays.asList(elements).indexOf(element);
}
@@ -262,7 +263,7 @@
}
else { // getPoint.elementHolder contains single object
if (elementHolder instanceof Comparable)
- return new Comparable[]{(Comparable) elementHolder};
+ return new Comparable[]{(Comparable<?>) elementHolder};
else
return new Object[]{elementHolder};
}
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/Options.java
===================================================================
--- gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/Options.java
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/model/Options.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -15,7 +15,6 @@
import org.apache.log4j.Logger;
import org.openrdf.model.Graph;
import org.openrdf.model.Statement;
-import org.openrdf.model.impl.GraphImpl;
import org.openrdf.model.impl.URIImpl;
import org.openrdf.rio.RDFFormat;
import org.openrdf.rio.RDFHandlerException;
@@ -50,13 +49,14 @@
* @param dictionaryPath the dictionary path, not null
* @return an Options instance, no null
*/
+ @SuppressWarnings("deprecation")
public static Options load(File dictionaryPath) {
Map<String, String> opts = new HashMap<String, String>();
Reader inp = null;
try {
inp = new FileReader(new File(dictionaryPath, getConfigFileName()));
RDFParser parser =
RDFParserRegistry.getInstance().get(RDFFormat.TURTLE).getParser();
- Graph statements = new GraphImpl();
+ Graph statements = new org.openrdf.model.impl.GraphImpl();
parser.setRDFHandler(new StatementCollector(statements));
parser.parse(inp, "http://www.ontotext.com/lkb_gazetteer#");
Iterator<Statement> it = statements.match(new
URIImpl("http://www.ontotext.com/lkb_gazetteer#DictionaryConfiguration"), null,
null);
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/test/PrivateRepositoryFeedTest.java
===================================================================
---
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/test/PrivateRepositoryFeedTest.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/test/PrivateRepositoryFeedTest.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -22,7 +22,8 @@
URL configReader =
this.getClass().getClassLoader().getResource("config.ttl");
String query =
IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("query.txt"));
int settingsHash = new
SettingsHashBuilder().getHash(configReader, query);
- PrivateRepositoryFeed feed = new
PrivateRepositoryFeed(configReader, query, settingsHash, new
Options(Collections.EMPTY_MAP, new File(".")));
+ @SuppressWarnings("unchecked")
+ PrivateRepositoryFeed feed = new PrivateRepositoryFeed(configReader,
query, settingsHash, new Options(Collections.EMPTY_MAP, new File(".")));
QueryResultCounter counter = new QueryResultCounter();
feed.feedTo(counter);
assertEquals(100, counter.getCount());
@@ -33,7 +34,8 @@
URL configReader = configFile.toURI().toURL();
String query = FileUtils.readFileToString(new
File(configFile.getParentFile(), "query.txt"));
int settingsHash = new
SettingsHashBuilder().getHash(configReader, query);
- PrivateRepositoryFeed feed = new
PrivateRepositoryFeed(configReader, query, settingsHash, new
Options(Collections.EMPTY_MAP, new File(".")));
+ @SuppressWarnings("unchecked")
+ PrivateRepositoryFeed feed = new PrivateRepositoryFeed(configReader,
query, settingsHash, new Options(Collections.EMPTY_MAP, new File(".")));
QueryResultCounter counter = new QueryResultCounter();
feed.feedTo(counter);
assertEquals(327, counter.getCount());
Modified:
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/util/datastore/GazetteerListFeed.java
===================================================================
---
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/util/datastore/GazetteerListFeed.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_LKB/src/com/ontotext/kim/util/datastore/GazetteerListFeed.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -8,8 +8,8 @@
import java.io.File;
import java.io.IOException;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.apache.commons.io.FileUtils;
@@ -70,8 +70,7 @@
private void loadDefinitions(QueryResultListener listener)
throws ResourceInstantiationException, IOException {
- @SuppressWarnings("unchecked")
- List<File> definitionPaths =
(List<File>)FileUtils.listFiles(dictionaryPath,
+ Collection<File> definitionPaths = FileUtils.listFiles(dictionaryPath,
new WildcardFileFilter(DEF_EXTENSION), null);
for(File definitionPath : definitionPaths) {
Modified: gate/trunk/plugins/Gazetteer_Ontology_Based/build.xml
===================================================================
--- gate/trunk/plugins/Gazetteer_Ontology_Based/build.xml 2014-03-15
09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Gazetteer_Ontology_Based/build.xml 2014-03-15
10:03:31 UTC (rev 17671)
@@ -17,6 +17,7 @@
<property name="gate.lib" location="${gate.home}/lib" />
<property name="doc.dir" location="doc" />
<property name="javadoc.dir" location="${doc.dir}/javadoc" />
+ <property name="gate.compile.maxwarnings" value="10000" />
<path id="classpath">
<pathelement location="${gate.jar}" />
@@ -40,8 +41,11 @@
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
- <javac srcdir="${src}" destdir="${build}" debug="true" source="1.5"
target="1.5">
+ <javac srcdir="${src}" destdir="${build}" debug="true" source="1.6"
target="1.6">
<classpath refid="classpath"/>
+ <compilerarg value="-Xmaxwarns" />
+ <compilerarg value="${gate.compile.maxwarnings}" />
+ <compilerarg value="-Xlint:all" />
</javac>
</target>
Modified:
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/OntoRootGaz.java
===================================================================
---
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/OntoRootGaz.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/OntoRootGaz.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -30,7 +30,6 @@
import gate.creole.morph.Morph;
import gate.creole.ontology.InvalidURIException;
import gate.creole.ontology.Ontology;
-import gate.creole.ontology.URI;
import gate.creole.tokeniser.DefaultTokeniser;
import gate.util.OffsetComparator;
@@ -146,6 +145,8 @@
this.init();
}
+ @Override
+ @SuppressWarnings("deprecation")
public Resource init() throws ResourceInstantiationException {
// list of namespaces to be ignored when creating gazetteer list
List<String> nsToIgnore = new ArrayList<String>();
@@ -188,7 +189,7 @@
typesToConsider.add(CATConstants.TYPE_INSTANCE);
typesToConsider.add(CATConstants.TYPE_PROPERTY);
}
- fsmStates = new HashSet();
+ fsmStates = new HashSet<FSMState>();
initialState = new FSMState(this);
/* set the hidden feature to true */
FeatureMap features = Factory.newFeatureMap();
@@ -256,13 +257,13 @@
/* create uriURI for validation purposes */
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
String classType = "";
if(uri.startsWith("_")) {
- uriUri = new URI(uri, true);
+ uriUri = new gate.creole.ontology.URI(uri, true);
classType = "bNode";
} else {
- uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, false);
classType =
new ArrayList<String>(Ontology2MapManager.getInstance()
.getOntology2Map().getInstanceTypes().get(uri)).get(0);
@@ -328,10 +329,10 @@
try {
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
if(uri.startsWith("_"))
- uriUri = new URI(uri, true);
- else uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, true);
+ else uriUri = new gate.creole.ontology.URI(uri, false);
String propUri = columns[1].trim();
if((propertiesToIncludeList.size() == 0 ||
propertiesToIncludeList
.contains(propUri))
@@ -373,10 +374,10 @@
try {
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
if(uri.startsWith("_"))
- uriUri = new URI(uri, true);
- else uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, true);
+ else uriUri = new gate.creole.ontology.URI(uri, false);
String propUri = columns[1].trim();
if((propertiesToIncludeList.size() == 0 ||
propertiesToIncludeList
.contains(propUri))
@@ -419,10 +420,10 @@
try {
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
if(uri.startsWith("_"))
- uriUri = new URI(uri, true);
- else uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, true);
+ else uriUri = new gate.creole.ontology.URI(uri, false);
String shortName = uriUri.getResourceName();
if(!nsToIgnore.contains(uriUri.getNameSpace())) {
Map<String, Object> lookupFeatures =
@@ -450,10 +451,10 @@
try {
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
if(uri.startsWith("_"))
- uriUri = new URI(uri, true);
- else uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, true);
+ else uriUri = new gate.creole.ontology.URI(uri, false);
String shortName = uriUri.getResourceName();
if(!nsToIgnore.contains(uriUri.getNameSpace())) {
Map<String, Object> lookupFeatures =
@@ -464,7 +465,7 @@
Set<String> l =
Ontology2MapManager.getInstance().getOntology2Map()
.getInstanceTypes().get(uri);
- if(l == null) l = new HashSet();
+ if(l == null) l = new HashSet<String>();
lookupFeatures.put(CATConstants.CLASS_URI_LIST, l);
lookupFeatures.put(CATConstants.CLASS_URI, new ArrayList<String>(
l).get(0));
@@ -490,10 +491,10 @@
try {
// URI uriUri = new URI(uri, false);
// OURI uriUri = ontology.createOURI(uri);
- URI uriUri = null;
+ gate.creole.ontology.URI uriUri = null;
if(uri.startsWith("_"))
- uriUri = new URI(uri, true);
- else uriUri = new URI(uri, false);
+ uriUri = new gate.creole.ontology.URI(uri, true);
+ else uriUri = new gate.creole.ontology.URI(uri, false);
String shortName = uriUri.getResourceName();
if(!nsToIgnore.contains(uriUri.getNameSpace())) {
Map<String, Object> lookupFeatures =
@@ -664,9 +665,9 @@
} catch(ExecutionException ee) {
throw new ResourceInstantiationException(ee);
}
- Iterator it = applicationCorpus.iterator();
+ Iterator<Document> it = applicationCorpus.iterator();
while(it.hasNext()) {
- Document doc = (Document)it.next();
+ Document doc = it.next();
Set<String> tokenTypes = new HashSet<String>();
tokenTypes.add(ANNIEConstants.TOKEN_ANNOTATION_TYPE);
tokenTypes.add(ANNIEConstants.SPACE_TOKEN_ANNOTATION_TYPE);
Modified:
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/query/serql/SerqlUtils.java
===================================================================
---
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/query/serql/SerqlUtils.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/query/serql/SerqlUtils.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -11,19 +11,15 @@
*/
package gate.clone.ql.query.serql;
-import java.io.IOException;
-
-import java.util.HashSet;
-import java.util.Set;
-
import gate.clone.ql.CATConstants;
import gate.creole.ontology.GateOntologyException;
-import gate.creole.ontology.OConstants.QueryLanguage;
-import gate.creole.ontology.Ontology;
-import gate.creole.ontology.OntologyTupleQuery;
+import gate.creole.ontology.OConstants.OWL;
import gate.creole.ontology.OConstants.RDF;
import gate.creole.ontology.OConstants.RDFS;
-import gate.creole.ontology.OConstants.OWL;
+import gate.creole.ontology.Ontology;
+
+import java.util.HashSet;
+import java.util.Set;
//import org.openrdf.model.vocabulary.OWL;
//import org.openrdf.model.vocabulary.RDF;
//import org.openrdf.model.vocabulary.RDFS;
@@ -36,6 +32,7 @@
* @author Danica Damljanovic
*
*/
+@SuppressWarnings("deprecation")
public class SerqlUtils {
// public static Ontology ontology;
@@ -223,10 +220,12 @@
+ " {p} rdf:type {<" + OWL.OBJECTPROPERTY + ">} " + "where y in ("
+ domainClasses + ") and x in (" + domainClasses + ") and x!=y";
+ @SuppressWarnings("unused")
String domainAddition =
" select distinct p, x" + " from {p} rdfs:domain {x}" + " where x=<"
+ firstUri + "> ";
+ @SuppressWarnings("unused")
String rangeAddition =
" select distinct p, x" + " from {p} rdfs:range {x}" + " where x=<"
+ secondUri + "> ";
Modified:
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/regex/ExpressionFinder.java
===================================================================
---
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/regex/ExpressionFinder.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/regex/ExpressionFinder.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -53,7 +53,6 @@
public static String findAndSeparateCamelCases(String inputString,
String regularExpression, String substituteString) {
String afterSubstitution = null;
- int matches = 0;
Pattern pattern = null;
PatternMatcherInput input;
PatternCompiler compiler;
@@ -84,7 +83,7 @@
while(matcher.contains(input, pattern)) {
// Since we're still in the loop, fetch match that was found.
result = matcher.getMatch();
- ++matches;
+
// System.out.println("Match " + matches + ": " + result);
String foundMatch = result.toString();
String[] chars = foundMatch.split("");
Modified:
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/Ontology2Map.java
===================================================================
---
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/Ontology2Map.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/Ontology2Map.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -11,14 +11,13 @@
*/
package gate.clone.ql.utils;
+import gate.clone.ql.query.serql.SerqlUtils;
+import gate.creole.ontology.Ontology;
+
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import gate.clone.ql.query.serql.SerqlUtils;
-import gate.creole.ontology.Ontology;
-
/**
*
* @author Danica Damljanovic
Modified:
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/StringUtil.java
===================================================================
---
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/StringUtil.java
2014-03-15 09:18:40 UTC (rev 17670)
+++
gate/trunk/plugins/Gazetteer_Ontology_Based/src/gate/clone/ql/utils/StringUtil.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -13,7 +13,6 @@
import gate.clone.ql.CATConstants;
import gate.creole.ontology.InvalidURIException;
-import gate.creole.ontology.URI;
import java.util.HashMap;
import java.util.HashSet;
@@ -40,6 +39,7 @@
* @return a Map with a key taken from the first column of the table and a
* value being a set of values taken from the second column.
*/
+ @SuppressWarnings("deprecation")
public static Map<String, Set<String>> fromStringToMap(String resultsTable) {
Map<String, Set<String>> map = new HashMap<String, Set<String>>();
@@ -55,7 +55,8 @@
}
classes.add(classUri);
try {
- URI uri = new URI(propertyUri, false);
+ @SuppressWarnings("unused")
+ gate.creole.ontology.URI uri = new
gate.creole.ontology.URI(propertyUri, false);
map.put(propertyUri, classes);
}
catch(InvalidURIException e) {
@@ -75,13 +76,15 @@
* @return a Set of Strings from the given table (string separated by new
* lines)
*/
+ @SuppressWarnings("deprecation")
public static Set<String> fromStringToSet(String resultsTable) {
Set<String> set = new HashSet<String>();
String[] rows = resultsTable.split(CATConstants.NEW_LINE);
for(String eachRow : rows) {
String uri = eachRow.trim();
try {
- URI uriUri = new URI(uri, false);
+ @SuppressWarnings("unused")
+ gate.creole.ontology.URI uriUri = new gate.creole.ontology.URI(uri,
false);
set.add(uri);
}
catch(InvalidURIException e) {
Modified: gate/trunk/plugins/Groovy/build.xml
===================================================================
--- gate/trunk/plugins/Groovy/build.xml 2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/build.xml 2014-03-15 10:03:31 UTC (rev 17671)
@@ -56,7 +56,8 @@
<!-- Compile the java and Groovy code from ${src} into ${build} -->
<groovyc srcdir="${src}" destdir="${build}">
<classpath refid="classpath"/>
- <javac debug="true" debuglevel="lines,source" source="1.5" target="1.5"
/>
+ <javac debug="true" debuglevel="lines,source" source="1.6" target="1.6">
+ </javac>
</groovyc>
</target>
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/GateGroovyMethods.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/GateGroovyMethods.java
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/GateGroovyMethods.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -47,8 +47,8 @@
* @param closure the closure to call
* @return a list of the return values from each closure call.
*/
- public static List collect(Corpus self, Closure closure) {
- return (List)collect(self, new ArrayList(), closure);
+ public static <T> List<T> collect(Corpus self, Closure<T> closure) {
+ return (List<T>)collect(self, new ArrayList<T>(), closure);
}
/**
@@ -61,11 +61,11 @@
* @param closure the closure to call
* @return a list of the return values from each closure call.
*/
- public static Collection collect(Corpus self, Collection coll,
- Closure closure) {
+ public static <T> Collection<T> collect(Corpus self, Collection<T> coll,
+ Closure<T> closure) {
for(int i = 0; i < self.size(); i++) {
boolean docWasLoaded = self.isDocumentLoaded(i);
- Document doc = (Document)self.get(i);
+ Document doc = self.get(i);
coll.add(closure.call(doc));
if(!docWasLoaded) {
self.unloadDocument(doc);
@@ -85,10 +85,10 @@
* @param closure the closure to call
* @return the corpus.
*/
- public static Object each(Corpus self, Closure closure) {
+ public static <T> Object each(Corpus self, Closure<T> closure) {
for(int i = 0; i < self.size(); i++) {
boolean docWasLoaded = self.isDocumentLoaded(i);
- Document doc = (Document)self.get(i);
+ Document doc = self.get(i);
closure.call(doc);
if(!docWasLoaded) {
self.unloadDocument(doc);
@@ -108,10 +108,10 @@
* @param closure the closure to call
* @return the corpus.
*/
- public static Object eachWithIndex(Corpus self, Closure closure) {
+ public static <T> Object eachWithIndex(Corpus self, Closure<T> closure) {
for(int i = 0; i < self.size(); i++) {
boolean docWasLoaded = self.isDocumentLoaded(i);
- Document doc = (Document)self.get(i);
+ Document doc = self.get(i);
closure.call(new Object[] {doc, i});
if(!docWasLoaded) {
self.unloadDocument(doc);
@@ -129,7 +129,8 @@
* (as start and end return Long).
* @see AnnotationSet#getContained(Long, Long)
*/
- public static AnnotationSet getAt(AnnotationSet self, Range range) {
+ @SuppressWarnings("unchecked")
+ public static AnnotationSet getAt(AnnotationSet self, Range<?> range) {
if(range.getFrom() instanceof Number) {
return self.getContained(
Long.valueOf(((Number)range.getFrom()).longValue()),
@@ -154,7 +155,7 @@
* @param range
* @return
*/
- public static DocumentContent getAt(DocumentContent self, Range range) {
+ public static DocumentContent getAt(DocumentContent self, Range<?> range) {
if(range.getFrom() instanceof Number) {
try {
return self.getContent(
@@ -203,7 +204,7 @@
* @param closure
* @return the value returned from the closure
*/
- public static Object withResource(Resource self, Closure closure) {
+ public static <T> T withResource(Resource self, Closure<T> closure) {
try {
return closure.call(self);
}
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/GroovySupport.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/GroovySupport.java
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/GroovySupport.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -54,6 +54,8 @@
@CreoleResource(name = "Groovy support for GATE", isPrivate = true, tool =
true,
autoinstances = @AutoInstance)
public class GroovySupport extends AbstractResource implements
ActionsPublisher {
+
+ private static final long serialVersionUID = 4763983982544551334L;
/**
* Standard list of import statements that are available to any groovy script
* or console in GATE.
@@ -105,7 +107,7 @@
private List<Action> actions;
- public List getActions() {
+ public List<Action> getActions() {
if(actions == null) {
actions = new ArrayList<Action>();
actions.add(new AbstractAction("Groovy Console",
MainFrame.getIcon("groovyConsole")) {
@@ -145,6 +147,7 @@
* of Console. So we have to implement the property setter here,
* delegating to the real private field in the superclass.
*/
+ @SuppressWarnings("unused")
public void setScriptRunning(boolean b) {
try {
Field f =
groovy.ui.Console.class.getDeclaredField("scriptRunning");
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java 2014-03-15
09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java 2014-03-15
10:03:31 UTC (rev 17671)
@@ -53,6 +53,8 @@
ProcessingResource,
ControllerAwarePR {
+ private static final long serialVersionUID = 7563063357390091727L;
+
/**
* Groovy script file
*/
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/ScriptableController.groovy
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/ScriptableController.groovy
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/ScriptableController.groovy
2014-03-15 10:03:31 UTC (rev 17671)
@@ -28,7 +28,7 @@
icon = "/gate/groovy/scriptable-controller")
public class ScriptableController extends SerialController
implements CorpusController, LanguageAnalyser {
-
+
protected static final Logger log = Logger.getLogger(ScriptableController)
/**
@@ -430,7 +430,7 @@
* Yes, this is another typo in the superclass, the method really is called
* getOffendingP(r)ocessingResources.
*/
- public List getOffendingPocessingResources() {
+ public List<ProcessingResource> getOffendingPocessingResources() {
return []
}
Modified:
gate/trunk/plugins/Groovy/src/gate/groovy/gui/ControllerScriptEditor.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/gui/ControllerScriptEditor.java
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/gui/ControllerScriptEditor.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -22,6 +22,8 @@
implements DocumentListener,
PropertyChangeListener {
+ private static final long serialVersionUID = -3690719863931044767L;
+
protected ConsoleTextEditor editor;
protected ScriptableController controller;
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/gui/ScriptPREditor.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/gui/ScriptPREditor.java
2014-03-15 09:18:40 UTC (rev 17670)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/gui/ScriptPREditor.java
2014-03-15 10:03:31 UTC (rev 17671)
@@ -46,6 +46,8 @@
ProgressListener,
DocumentListener {
+ private static final long serialVersionUID = -3397858340190887863L;
+
private ConsoleTextEditor editor;
private ScriptPR pr;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs