You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sf...@apache.org on 2010/12/12 17:10:52 UTC
svn commit: r1044841 [3/11] - in /incubator/stanbol/trunk/fise:
SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/
SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/ui/
SemiAutomaticContentEnhancer/src/main/java/eu/iks...
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/test/java/eu/iksproject/fise/engines/metaxa/core/TestMetaxaCore.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/test/java/eu/iksproject/fise/engines/metaxa/core/TestMetaxaCore.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/test/java/eu/iksproject/fise/engines/metaxa/core/TestMetaxaCore.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/test/java/eu/iksproject/fise/engines/metaxa/core/TestMetaxaCore.java Sun Dec 12 16:10:48 2010
@@ -26,7 +26,7 @@ import eu.iksproject.fise.engines.metaxa
/**
* {@link TestMetaxaCore} is a test class for {@link MetaxaCore}.
- *
+ *
* @author Joerg Steffen, DFKI
* @version $Id$
*/
@@ -56,7 +56,7 @@ public class TestMetaxaCore {
/**
* This tests the pdf extraction.
- *
+ *
* @throws ExtractorException
* if there is an error during extraction
* @throws IOException
@@ -67,7 +67,7 @@ public class TestMetaxaCore {
String testFile = "test.pdf";
String testResultFile = "pdf-res.txt";
-
+
// extract text from pdf
InputStream in =
this.getClass().getClassLoader().getResourceAsStream(
@@ -92,7 +92,7 @@ public class TestMetaxaCore {
/**
* This tests the html extraction.
- *
+ *
* @throws ExtractorException
* if there is an error during extraction
* @throws IOException
@@ -103,7 +103,7 @@ public class TestMetaxaCore {
String testFile = "test.html";
String testResultFile = "html-res.txt";
-
+
// extract text from html
InputStream in =
this.getClass().getClassLoader().getResourceAsStream(
@@ -125,10 +125,10 @@ public class TestMetaxaCore {
int tripleCounter = this.printTriples(m);
Assert.assertEquals(28, tripleCounter);
}
-
+
/**
* This tests the html extraction.
- *
+ *
* @throws ExtractorException
* if there is an error during extraction
* @throws IOException
@@ -139,7 +139,7 @@ public class TestMetaxaCore {
String testFile = "test-rdfa.html";
String testResultFile = "rdfa-res.txt";
-
+
// extract text from RDFa annotated html
InputStream in =
this.getClass().getClassLoader().getResourceAsStream(
@@ -161,12 +161,12 @@ public class TestMetaxaCore {
int tripleCounter = this.printTriples(m);
Assert.assertEquals(10, tripleCounter);
}
-
+
/**
* This prints out the FISE triples that would be created for the metadata
* contained in the given model.
- *
+ *
* @param m
* a {@link Model}
* @return an {@code int} with the number of added triples
@@ -174,9 +174,9 @@ public class TestMetaxaCore {
private int printTriples(Model m) {
int tripleCounter = 0;
-
+
HashMap<BlankNode,BNode> blankNodeMap = new HashMap<BlankNode,BNode>();
-
+
ClosableIterator<Statement> it = m.iterator();
while (it.hasNext()) {
Statement oneStmt = it.next();
@@ -185,11 +185,11 @@ public class TestMetaxaCore {
UriRef fisePredicate = (UriRef) MetaxaEngine.asFiseResource(oneStmt.getPredicate(), blankNodeMap);
Resource fiseObject = MetaxaEngine.asFiseResource(oneStmt.getObject(), blankNodeMap);
- if (null != fiseSubject
- && null != fisePredicate
+ if (null != fiseSubject
+ && null != fisePredicate
&& null != fiseObject) {
- Triple t =
- new TripleImpl(fiseSubject, fisePredicate, fiseObject);
+ Triple t =
+ new TripleImpl(fiseSubject, fisePredicate, fiseObject);
LOG.debug("adding " + t);
tripleCounter++;
}
@@ -198,13 +198,13 @@ public class TestMetaxaCore {
}
}
it.close();
-
+
return tripleCounter;
}
/**
* Cleanup strings for comparison, by removing non-printable chars.
- *
+ *
* @param txt
* a {@link String} with the text to clean
* @return a {@link String} with the result
Modified: incubator/stanbol/trunk/fise/engines/opennlp-ner/src/main/java/eu/iksproject/fise/engines/opennlp/impl/NamedEntityExtractionEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/opennlp-ner/src/main/java/eu/iksproject/fise/engines/opennlp/impl/NamedEntityExtractionEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/opennlp-ner/src/main/java/eu/iksproject/fise/engines/opennlp/impl/NamedEntityExtractionEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/opennlp-ner/src/main/java/eu/iksproject/fise/engines/opennlp/impl/NamedEntityExtractionEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -400,8 +400,8 @@ public class NamedEntityExtractionEnhanc
}
public int canEnhance(ContentItem ci) {
- //in case text/pain;charSet=UTF8 is parsed
- String mimeType = ci.getMimeType().split(";",2)[0];
+ //in case text/pain;charSet=UTF8 is parsed
+ String mimeType = ci.getMimeType().split(";",2)[0];
if (TEXT_PLAIN_MIMETYPE.equalsIgnoreCase(mimeType)) {
return ENHANCE_SYNCHRONOUS;
}
Modified: incubator/stanbol/trunk/fise/engines/opennlp-ner/src/test/java/eu/iksproject/fise/engines/opennlp/impl/TestNamedEntityExtractionEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/opennlp-ner/src/test/java/eu/iksproject/fise/engines/opennlp/impl/TestNamedEntityExtractionEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/opennlp-ner/src/test/java/eu/iksproject/fise/engines/opennlp/impl/TestNamedEntityExtractionEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/opennlp-ner/src/test/java/eu/iksproject/fise/engines/opennlp/impl/TestNamedEntityExtractionEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -136,7 +136,7 @@ public class TestNamedEntityExtractionEn
* Helper Methods to check Text and EntityAnnotations
* -----------------------------------------------------------------------
*/
-
+
private int checkAllTextAnnotations(MGraph g, String content) {
Iterator<Triple> textAnnotationIterator = g.filter(null,
RDF_TYPE, FISE_TEXTANNOTATION);
@@ -182,31 +182,31 @@ public class TestNamedEntityExtractionEn
FISE_END, null);
//start end is optional, but if start is present, that also end needs to be set
if(startPosIterator.hasNext()){
- Resource resource = startPosIterator.next().getObject();
- //only a single start position is supported
- assertTrue(!startPosIterator.hasNext());
- assertTrue(resource instanceof TypedLiteral);
- TypedLiteral startPosLiteral = (TypedLiteral) resource;
- resource = null;
- int start = LiteralFactory.getInstance().createObject(Integer.class, startPosLiteral);
- startPosLiteral = null;
- //now get the end
+ Resource resource = startPosIterator.next().getObject();
+ //only a single start position is supported
+ assertTrue(!startPosIterator.hasNext());
+ assertTrue(resource instanceof TypedLiteral);
+ TypedLiteral startPosLiteral = (TypedLiteral) resource;
+ resource = null;
+ int start = LiteralFactory.getInstance().createObject(Integer.class, startPosLiteral);
+ startPosLiteral = null;
+ //now get the end
//end must be defined if start is present
assertTrue(endPosIterator.hasNext());
resource = endPosIterator.next().getObject();
- //only a single end position is supported
- assertTrue(!endPosIterator.hasNext());
- assertTrue(resource instanceof TypedLiteral);
- TypedLiteral endPosLiteral = (TypedLiteral) resource;
- resource = null;
- int end = LiteralFactory.getInstance().createObject(Integer.class, endPosLiteral);
- endPosLiteral = null;
- //check for equality of the selected text and the text on the selected position in the content
- //System.out.println("TA ["+start+"|"+end+"]"+selectedText.getLexicalForm()+"<->"+content.substring(start,end));
+ //only a single end position is supported
+ assertTrue(!endPosIterator.hasNext());
+ assertTrue(resource instanceof TypedLiteral);
+ TypedLiteral endPosLiteral = (TypedLiteral) resource;
+ resource = null;
+ int end = LiteralFactory.getInstance().createObject(Integer.class, endPosLiteral);
+ endPosLiteral = null;
+ //check for equality of the selected text and the text on the selected position in the content
+ //System.out.println("TA ["+start+"|"+end+"]"+selectedText.getLexicalForm()+"<->"+content.substring(start,end));
assertEquals(content.substring(start, end), selectedText.getLexicalForm());
} else {
- //if no start position is present, there must also be no end position defined
- assertTrue(!endPosIterator.hasNext());
+ //if no start position is present, there must also be no end position defined
+ assertTrue(!endPosIterator.hasNext());
}
}
Modified: incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaAPIWrapper.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaAPIWrapper.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaAPIWrapper.java (original)
+++ incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaAPIWrapper.java Sun Dec 12 16:10:48 2010
@@ -21,106 +21,106 @@ import org.slf4j.LoggerFactory;
* This class wraps the Zemanta API into one method.
* Zemanta is able to return RDF-XML so parsing the response into
* a Graph object is simple.
- *
+ *
* @author michaelmarth
* @author westei (Rupert Westenthaler)
*/
public class ZemantaAPIWrapper {
- private static final Logger log = LoggerFactory.getLogger(ZemantaEnhancementEngine.class);
+ private static final Logger log = LoggerFactory.getLogger(ZemantaEnhancementEngine.class);
- private static String apiKey;
+ private static String apiKey;
- private static final String URL = "http://api.zemanta.com/services/rest/0.0/";
+ private static final String URL = "http://api.zemanta.com/services/rest/0.0/";
- public ZemantaAPIWrapper(String key) {
- apiKey = key;
- }
-
- public Graph enhance(String textToAnalyze) {
- InputStream is = sendRequest(textToAnalyze);
- Graph zemantaResponseGraph = parseResponse(is);
- return zemantaResponseGraph;
- }
-
- private InputStream sendRequest(String textToAnalyze) {
- try {
- URL url = new URL(URL);
- HttpURLConnection httpURLConnection = (HttpURLConnection) url
- .openConnection();
- httpURLConnection.setRequestMethod("POST");
- httpURLConnection.setDoOutput(true);
- Map<ZemantaPropertyEnum,String> requestProperties = new EnumMap<ZemantaPropertyEnum, String>(ZemantaPropertyEnum.class);
- requestProperties.put(ZemantaPropertyEnum.api_key, apiKey);
- requestProperties.put(ZemantaPropertyEnum.text, URLEncoder.encode(textToAnalyze, "UTF8"));
- //added an method that adds the default parameters
- StringBuilder data = getRequestData(requestProperties);
-// StringBuilder data = new StringBuilder();
-
-// data.append("method=zemanta.suggest&").append("api_key=").append(
-// apiKey).append("&").append("format=rdfxml&").append(
-// "freebase=1").append("&text=").append(
-// URLEncoder.encode(textToAnalyze, "UTF8"));
-
- httpURLConnection.addRequestProperty("Content-Length", Integer
- .toString(data.length()));
-
- log.info("sending data to Zemanta: " + data);
-
- DataOutputStream dataOutputStream = new DataOutputStream(
- httpURLConnection.getOutputStream());
- dataOutputStream.write(data.toString().getBytes());
- dataOutputStream.close();
-
- InputStream is = httpURLConnection.getInputStream();
- return is;
-
- } catch (UnsupportedEncodingException e) {
- log.error(e.getMessage(),e);
- } catch (MalformedURLException e) {
- log.error(e.getMessage(),e);
- } catch (IOException e) {
- log.error(e.getMessage(),e);
- }
-
- return null;
- }
-
- private StringBuilder getRequestData(Map<ZemantaPropertyEnum,String> requestProperties){
- StringBuilder data = new StringBuilder();
- boolean first = true;
- for (ZemantaPropertyEnum property : ZemantaPropertyEnum.values()){
- String value = requestProperties.get(property);
- if (value == null && property.hasDefault()) {
- value = property.defaultValue();
- }
- //NOTE: value == null may still be OK
- if (property.allowedValue(value)) {
- //NOTE: also this may still say that NULL is OK
- if (value != null) {
- if (!first) {
- data.append('&');
- } else {
- first = false;
- }
- data.append(property.name());
- data.append('=');
- data.append(value);
- } //else property is not present
- } else {
- //Illegal parameter
- log.warn("Value "+value+" is not valied for property "+property);
- }
- }
- return data;
- }
-
- private Graph parseResponse(InputStream is) {
- JenaParserProvider jenaParserProvider = new JenaParserProvider();
- //NOTE(rw): the new third parameter is the base URI used to resolve relative paths
- Graph g = jenaParserProvider.parse(is, SupportedFormat.RDF_XML,null);
- log.debug("graph: " + g.toString());
- return g;
- }
+ public ZemantaAPIWrapper(String key) {
+ apiKey = key;
+ }
+
+ public Graph enhance(String textToAnalyze) {
+ InputStream is = sendRequest(textToAnalyze);
+ Graph zemantaResponseGraph = parseResponse(is);
+ return zemantaResponseGraph;
+ }
+
+ private InputStream sendRequest(String textToAnalyze) {
+ try {
+ URL url = new URL(URL);
+ HttpURLConnection httpURLConnection = (HttpURLConnection) url
+ .openConnection();
+ httpURLConnection.setRequestMethod("POST");
+ httpURLConnection.setDoOutput(true);
+ Map<ZemantaPropertyEnum,String> requestProperties = new EnumMap<ZemantaPropertyEnum, String>(ZemantaPropertyEnum.class);
+ requestProperties.put(ZemantaPropertyEnum.api_key, apiKey);
+ requestProperties.put(ZemantaPropertyEnum.text, URLEncoder.encode(textToAnalyze, "UTF8"));
+ //added an method that adds the default parameters
+ StringBuilder data = getRequestData(requestProperties);
+// StringBuilder data = new StringBuilder();
+
+// data.append("method=zemanta.suggest&").append("api_key=").append(
+// apiKey).append("&").append("format=rdfxml&").append(
+// "freebase=1").append("&text=").append(
+// URLEncoder.encode(textToAnalyze, "UTF8"));
+
+ httpURLConnection.addRequestProperty("Content-Length", Integer
+ .toString(data.length()));
+
+ log.info("sending data to Zemanta: " + data);
+
+ DataOutputStream dataOutputStream = new DataOutputStream(
+ httpURLConnection.getOutputStream());
+ dataOutputStream.write(data.toString().getBytes());
+ dataOutputStream.close();
+
+ InputStream is = httpURLConnection.getInputStream();
+ return is;
+
+ } catch (UnsupportedEncodingException e) {
+ log.error(e.getMessage(),e);
+ } catch (MalformedURLException e) {
+ log.error(e.getMessage(),e);
+ } catch (IOException e) {
+ log.error(e.getMessage(),e);
+ }
+
+ return null;
+ }
+
+ private StringBuilder getRequestData(Map<ZemantaPropertyEnum,String> requestProperties){
+ StringBuilder data = new StringBuilder();
+ boolean first = true;
+ for (ZemantaPropertyEnum property : ZemantaPropertyEnum.values()){
+ String value = requestProperties.get(property);
+ if (value == null && property.hasDefault()) {
+ value = property.defaultValue();
+ }
+ //NOTE: value == null may still be OK
+ if (property.allowedValue(value)) {
+ //NOTE: also this may still say that NULL is OK
+ if (value != null) {
+ if (!first) {
+ data.append('&');
+ } else {
+ first = false;
+ }
+ data.append(property.name());
+ data.append('=');
+ data.append(value);
+ } //else property is not present
+ } else {
+ //Illegal parameter
+ log.warn("Value "+value+" is not valied for property "+property);
+ }
+ }
+ return data;
+ }
+
+ private Graph parseResponse(InputStream is) {
+ JenaParserProvider jenaParserProvider = new JenaParserProvider();
+ //NOTE(rw): the new third parameter is the base URI used to resolve relative paths
+ Graph g = jenaParserProvider.parse(is, SupportedFormat.RDF_XML,null);
+ log.debug("graph: " + g.toString());
+ return g;
+ }
}
Modified: incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaPropertyEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaPropertyEnum.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaPropertyEnum.java (original)
+++ incubator/stanbol/trunk/fise/engines/zemanta/src/main/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaPropertyEnum.java Sun Dec 12 16:10:48 2010
@@ -172,4 +172,4 @@ public enum ZemantaPropertyEnum {
return toString;
}
-}
\ No newline at end of file
+}
Modified: incubator/stanbol/trunk/fise/engines/zemanta/src/test/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaEnhancementEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/zemanta/src/test/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaEnhancementEngineTest.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/zemanta/src/test/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaEnhancementEngineTest.java (original)
+++ incubator/stanbol/trunk/fise/engines/zemanta/src/test/java/eu/iksproject/fise/engines/zemanta/impl/ZemantaEnhancementEngineTest.java Sun Dec 12 16:10:48 2010
@@ -32,32 +32,32 @@ import eu.iksproject.fise.servicesapi.rd
import eu.iksproject.fise.servicesapi.rdf.TechnicalClasses;
public class ZemantaEnhancementEngineTest {
- private static final Logger log = LoggerFactory.getLogger(ZemantaEnhancementEngineTest.class);
-
- /**
- * This key was generated to support testing only. Please do only use it
- * for testing. For real usages of the engine you need to create your own
- * key!
- */
- private static final String ZEMANTA_FISE_TEST_APPLICATION_KEY = "2qsvcvkut8rhnqbhm35znn76";
-
- /**
- * found on this Blog {@linkplain http://bcbio.wordpress.com/2009/01/04/extracting-keywords-from-biological-text-using-zemanta/}
- */
- public static final String BIO_DOMAIN_TEXT = "glh-2 encodes a putative DEAD-box RNA " +
- "helicase that contains six CCHC zinc fingers and is homologous to Drosophila VASA, " +
- "a germ-line-specific, ATP-dependent, RNA helicase; GLH-2 activity may also be required " +
- "for the wild-type morphology of P granules and for localization of several protein " +
- "components, but not accumulation of P granule mRNA components; GLH-2 interacts in " +
- "vitro with itself and with KGB-1, a JNK-like MAP kinase; GLH-2 is a constitutive P " +
- "granule component and thus, with the exception of mature sperm, is expressed in germ " +
- "cells at all stages of development; GLH-2 is cytoplasmic in oocytes and the early " +
- "embryo, while perinuclear in all later developmental stages as well as in the distal " +
- "and medial regions of the hermaphrodite gonad; GLH-2 is expressed at barely detectable " +
- "levels in males";
+ private static final Logger log = LoggerFactory.getLogger(ZemantaEnhancementEngineTest.class);
-
- static ZemantaEnhancementEngine zemantaEngine = new ZemantaEnhancementEngine();
+ /**
+ * This key was generated to support testing only. Please do only use it
+ * for testing. For real usages of the engine you need to create your own
+ * key!
+ */
+ private static final String ZEMANTA_FISE_TEST_APPLICATION_KEY = "2qsvcvkut8rhnqbhm35znn76";
+
+ /**
+ * found on this Blog {@linkplain http://bcbio.wordpress.com/2009/01/04/extracting-keywords-from-biological-text-using-zemanta/}
+ */
+ public static final String BIO_DOMAIN_TEXT = "glh-2 encodes a putative DEAD-box RNA " +
+ "helicase that contains six CCHC zinc fingers and is homologous to Drosophila VASA, " +
+ "a germ-line-specific, ATP-dependent, RNA helicase; GLH-2 activity may also be required " +
+ "for the wild-type morphology of P granules and for localization of several protein " +
+ "components, but not accumulation of P granule mRNA components; GLH-2 interacts in " +
+ "vitro with itself and with KGB-1, a JNK-like MAP kinase; GLH-2 is a constitutive P " +
+ "granule component and thus, with the exception of mature sperm, is expressed in germ " +
+ "cells at all stages of development; GLH-2 is cytoplasmic in oocytes and the early " +
+ "embryo, while perinuclear in all later developmental stages as well as in the distal " +
+ "and medial regions of the hermaphrodite gonad; GLH-2 is expressed at barely detectable " +
+ "levels in males";
+
+
+ static ZemantaEnhancementEngine zemantaEngine = new ZemantaEnhancementEngine();
@BeforeClass
public static void setUpServices() throws IOException {
Dictionary<String, Object> properties = new Hashtable<String, Object>();
@@ -68,7 +68,7 @@ public class ZemantaEnhancementEngineTes
@AfterClass
public static void shutdownServices() {
- zemantaEngine.deactivate(null);
+ zemantaEngine.deactivate(null);
}
public static ContentItem wrapAsContentItem(final String text) {
return new ContentItem() {
@@ -92,24 +92,24 @@ public class ZemantaEnhancementEngineTes
return id;
}
};
- }
+ }
@Test
public void tesetBioText() throws Exception{
- ContentItem ci = wrapAsContentItem(BIO_DOMAIN_TEXT);
- zemantaEngine.computeEnhancements(ci);
- JenaSerializerProvider serializer = new JenaSerializerProvider();
- serializer.serialize(System.out, ci.getMetadata(), SupportedFormat.TURTLE);
- int textAnnoNum = checkAllTextAnnotations(ci.getMetadata(), BIO_DOMAIN_TEXT);
- log.info(textAnnoNum + " TextAnnotations found ...");
- int entityAnnoNum = checkAllEntityAnnotations(ci.getMetadata());
- log.info(textAnnoNum + " EntityAnnotations found ...");
+ ContentItem ci = wrapAsContentItem(BIO_DOMAIN_TEXT);
+ zemantaEngine.computeEnhancements(ci);
+ JenaSerializerProvider serializer = new JenaSerializerProvider();
+ serializer.serialize(System.out, ci.getMetadata(), SupportedFormat.TURTLE);
+ int textAnnoNum = checkAllTextAnnotations(ci.getMetadata(), BIO_DOMAIN_TEXT);
+ log.info(textAnnoNum + " TextAnnotations found ...");
+ int entityAnnoNum = checkAllEntityAnnotations(ci.getMetadata());
+ log.info(textAnnoNum + " EntityAnnotations found ...");
}
/*
* -----------------------------------------------------------------------
* Helper Methods to check Text and EntityAnnotations
* -----------------------------------------------------------------------
*/
-
+
/**
* @param g
* @return
@@ -138,7 +138,7 @@ public class ZemantaEnhancementEngineTes
Iterator<Triple> requiresIterator = g.filter(
entityAnnotation, Properties.DC_REQUIRES, null);
Iterator<Triple> dcTypeCategory = g.filter(
- entityAnnotation, Properties.DC_TYPE, TechnicalClasses.FISE_CATEGORY);
+ entityAnnotation, Properties.DC_TYPE, TechnicalClasses.FISE_CATEGORY);
// check if the relation or an requires annotation set
// also include the DC_TYPE FISE_CATEGORY, because such entityEnhancements
// do not need to have any values for DC_RELATION nor DC_REQUIRES
@@ -219,38 +219,38 @@ public class ZemantaEnhancementEngineTes
Properties.FISE_END, null);
//start end is optional, but if start is present, that also end needs to be set
if(startPosIterator.hasNext()){
- Resource resource = startPosIterator.next().getObject();
- //only a single start position is supported
- assertTrue(!startPosIterator.hasNext());
- assertTrue(resource instanceof TypedLiteral);
- TypedLiteral startPosLiteral = (TypedLiteral) resource;
- resource = null;
- int start = LiteralFactory.getInstance().createObject(Integer.class, startPosLiteral);
- startPosLiteral = null;
- //now get the end
+ Resource resource = startPosIterator.next().getObject();
+ //only a single start position is supported
+ assertTrue(!startPosIterator.hasNext());
+ assertTrue(resource instanceof TypedLiteral);
+ TypedLiteral startPosLiteral = (TypedLiteral) resource;
+ resource = null;
+ int start = LiteralFactory.getInstance().createObject(Integer.class, startPosLiteral);
+ startPosLiteral = null;
+ //now get the end
//end must be defined if start is present
assertTrue(endPosIterator.hasNext());
resource = endPosIterator.next().getObject();
- //only a single end position is supported
- assertTrue(!endPosIterator.hasNext());
- assertTrue(resource instanceof TypedLiteral);
- TypedLiteral endPosLiteral = (TypedLiteral) resource;
- resource = null;
- int end = LiteralFactory.getInstance().createObject(Integer.class, endPosLiteral);
- endPosLiteral = null;
- //check for equality of the selected text and the text on the selected position in the content
- //System.out.println("TA ["+start+"|"+end+"]"+selectedText.getLexicalForm()+"<->"+content.substring(start,end));
- assertTrue(content.substring(start, end).equals(selectedText.getLexicalForm()));
+ //only a single end position is supported
+ assertTrue(!endPosIterator.hasNext());
+ assertTrue(resource instanceof TypedLiteral);
+ TypedLiteral endPosLiteral = (TypedLiteral) resource;
+ resource = null;
+ int end = LiteralFactory.getInstance().createObject(Integer.class, endPosLiteral);
+ endPosLiteral = null;
+ //check for equality of the selected text and the text on the selected position in the content
+ //System.out.println("TA ["+start+"|"+end+"]"+selectedText.getLexicalForm()+"<->"+content.substring(start,end));
+ assertTrue(content.substring(start, end).equals(selectedText.getLexicalForm()));
} else {
- //if no start position is present, there must also be no end position defined
- assertTrue(!endPosIterator.hasNext());
+ //if no start position is present, there must also be no end position defined
+ assertTrue(!endPosIterator.hasNext());
}
}
-
+
public static void main(String[] args) throws Exception{
- ZemantaEnhancementEngineTest test = new ZemantaEnhancementEngineTest();
- test.setUpServices();
- test.tesetBioText();
- test.shutdownServices();
- }
+ ZemantaEnhancementEngineTest test = new ZemantaEnhancementEngineTest();
+ test.setUpServices();
+ test.tesetBioText();
+ test.shutdownServices();
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Address.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Address.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Address.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Address.java Sun Dec 12 16:10:48 2010
@@ -18,44 +18,44 @@ package org.geonames;
/**
* a street address
- *
+ *
* @author Mark Thomas
- *
+ *
*/
public class Address extends PostalCode {
- private String street;
+ private String street;
- private String streetNumber;
+ private String streetNumber;
- /**
- * @return the street
- */
- public String getStreet() {
- return street;
- }
-
- /**
- * @param street
- * the street to set
- */
- public void setStreet(String street) {
- this.street = street;
- }
-
- /**
- * @return the streetNumber
- */
- public String getStreetNumber() {
- return streetNumber;
- }
-
- /**
- * @param streetNumber
- * the streetNumber to set
- */
- public void setStreetNumber(String streetNumber) {
- this.streetNumber = streetNumber;
- }
+ /**
+ * @return the street
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * @param street
+ * the street to set
+ */
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ /**
+ * @return the streetNumber
+ */
+ public String getStreetNumber() {
+ return streetNumber;
+ }
+
+ /**
+ * @param streetNumber
+ * the streetNumber to set
+ */
+ public void setStreetNumber(String streetNumber) {
+ this.streetNumber = streetNumber;
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/FeatureClass.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/FeatureClass.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/FeatureClass.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/FeatureClass.java Sun Dec 12 16:10:48 2010
@@ -18,52 +18,52 @@ package org.geonames;
/**
* Enumeration for the GeoNames feature classes A,H,L,P,R,S,T,U,V
- *
+ *
* @author marc
- *
+ *
*/
public enum FeatureClass {
- /**
- * Administrative Boundary Features
- */
- A,
- /**
- * Hydrographic Features
- */
- H,
- /**
- * Area Features
- */
- L,
- /**
- * Populated Place Features
- */
- P,
- /**
- * Road / Railroad Features
- */
- R,
- /**
- * Spot Features
- */
- S,
- /**
- * Hypsographic Features
- */
- T,
- /**
- * Undersea Features
- */
- U,
- /**
- * Vegetation Features
- */
- V;
+ /**
+ * Administrative Boundary Features
+ */
+ A,
+ /**
+ * Hydrographic Features
+ */
+ H,
+ /**
+ * Area Features
+ */
+ L,
+ /**
+ * Populated Place Features
+ */
+ P,
+ /**
+ * Road / Railroad Features
+ */
+ R,
+ /**
+ * Spot Features
+ */
+ S,
+ /**
+ * Hypsographic Features
+ */
+ T,
+ /**
+ * Undersea Features
+ */
+ U,
+ /**
+ * Vegetation Features
+ */
+ V;
- public static FeatureClass fromValue(String value) {
- if (value == null || "".equals(value)) {
- return null;
- }
- return valueOf(value);
- }
+ public static FeatureClass fromValue(String value) {
+ if (value == null || "".equals(value)) {
+ return null;
+ }
+ return valueOf(value);
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InsufficientStyleException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InsufficientStyleException.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InsufficientStyleException.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InsufficientStyleException.java Sun Dec 12 16:10:48 2010
@@ -19,12 +19,12 @@ package org.geonames;
/**
* Is thrown when trying to access a field that has not been set as the style
* for the request was not sufficiently verbose to return this information.
- *
+ *
* @author marc
- *
+ *
*/
public class InsufficientStyleException extends Exception {
- public InsufficientStyleException(String msg) {
- super(msg);
- }
+ public InsufficientStyleException(String msg) {
+ super(msg);
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Intersection.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Intersection.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Intersection.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Intersection.java Sun Dec 12 16:10:48 2010
@@ -18,101 +18,101 @@ package org.geonames;
/**
* an intersection between two streets
- *
+ *
* @author Mark Thomas
- *
+ *
*/
public class Intersection {
- private String street2;
+ private String street2;
- private Address address = new Address();
+ private Address address = new Address();
- public double getDistance() {
- return address.getDistance();
- }
+ public double getDistance() {
+ return address.getDistance();
+ }
- public void setDistance(double d) {
- address.setDistance(d);
- }
+ public void setDistance(double d) {
+ address.setDistance(d);
+ }
- public String getAdminCode1() {
- return address.getAdminCode1();
- }
+ public String getAdminCode1() {
+ return address.getAdminCode1();
+ }
- public void setAdminCode1(String s) {
- address.setAdminCode1(s);
- }
+ public void setAdminCode1(String s) {
+ address.setAdminCode1(s);
+ }
- public String getAdminName1() {
- return address.getAdminName1();
- }
+ public String getAdminName1() {
+ return address.getAdminName1();
+ }
- public void setAdminName1(String s) {
- address.setAdminName1(s);
- }
+ public void setAdminName1(String s) {
+ address.setAdminName1(s);
+ }
- public String getAdminName2() {
- return address.getAdminName2();
- }
+ public String getAdminName2() {
+ return address.getAdminName2();
+ }
- public void setAdminName2(String s) {
- address.setAdminName2(s);
- }
+ public void setAdminName2(String s) {
+ address.setAdminName2(s);
+ }
- public String getCountryCode() {
- return address.getCountryCode();
- }
+ public String getCountryCode() {
+ return address.getCountryCode();
+ }
- public void setCountryCode(String s) {
- address.setCountryCode(s);
- }
+ public void setCountryCode(String s) {
+ address.setCountryCode(s);
+ }
- public double getLatitude() {
- return address.getLatitude();
- }
+ public double getLatitude() {
+ return address.getLatitude();
+ }
- public void setLatitude(double d) {
- address.setLatitude(d);
- }
+ public void setLatitude(double d) {
+ address.setLatitude(d);
+ }
- public double getLongitude() {
- return address.getLongitude();
- }
+ public double getLongitude() {
+ return address.getLongitude();
+ }
- public void setLongitude(double d) {
- address.setLongitude(d);
- }
+ public void setLongitude(double d) {
+ address.setLongitude(d);
+ }
- public String getPlaceName() {
- return address.getPlaceName();
- }
+ public String getPlaceName() {
+ return address.getPlaceName();
+ }
- public void setPlaceName(String s) {
- address.setPlaceName(s);
- }
+ public void setPlaceName(String s) {
+ address.setPlaceName(s);
+ }
- public String getPostalCode() {
- return address.getPostalCode();
- }
+ public String getPostalCode() {
+ return address.getPostalCode();
+ }
- public void setPostalCode(String s) {
- address.setPostalCode(s);
- }
+ public void setPostalCode(String s) {
+ address.setPostalCode(s);
+ }
- public String getStreet1() {
- return address.getStreet();
- }
+ public String getStreet1() {
+ return address.getStreet();
+ }
- public void setStreet1(String s) {
- address.setStreet(s);
- }
+ public void setStreet1(String s) {
+ address.setStreet(s);
+ }
- public String getStreet2() {
- return street2;
- }
+ public String getStreet2() {
+ return street2;
+ }
- public void setStreet2(String street2) {
- this.street2 = street2;
- }
+ public void setStreet2(String street2) {
+ this.street2 = street2;
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InvalidParameterException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InvalidParameterException.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InvalidParameterException.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/InvalidParameterException.java Sun Dec 12 16:10:48 2010
@@ -19,14 +19,14 @@ package org.geonames;
/**
* is thrown when the search criteria is initialized with obviously invalid parameters,
* such as an invalid country code.
- *
+ *
* @author marc
- *
+ *
*/
public class InvalidParameterException extends Exception {
- public InvalidParameterException(String msg) {
- super(msg);
- }
+ public InvalidParameterException(String msg) {
+ super(msg);
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCode.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCode.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCode.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCode.java Sun Dec 12 16:10:48 2010
@@ -18,184 +18,184 @@ package org.geonames;
/**
* a postal code
- *
+ *
* @author marc@geonames
- *
+ *
*/
public class PostalCode {
- private String postalCode;
+ private String postalCode;
- private String placeName;
+ private String placeName;
- private String countryCode;
+ private String countryCode;
- private double latitude;
+ private double latitude;
- private double longitude;
-
- private String adminName1;
-
- private String adminCode1;
-
- private String adminName2;
-
- private String adminCode2;
-
- private double distance;
-
- /**
- * @return Returns the distance.
- */
- public double getDistance() {
- return distance;
- }
-
- /**
- * @param distance
- * The distance to set.
- */
- public void setDistance(double distance) {
- this.distance = distance;
- }
-
- /**
- * @return Returns the adminCode1.
- */
- public String getAdminCode1() {
- return adminCode1;
- }
-
- /**
- * @param adminCode1
- * The adminCode1 to set.
- */
- public void setAdminCode1(String adminCode1) {
- this.adminCode1 = adminCode1;
- }
-
- /**
- * @return Returns the adminCode2.
- */
- public String getAdminCode2() {
- return adminCode2;
- }
-
- /**
- * @param adminCode2
- * The adminCode2 to set.
- */
- public void setAdminCode2(String adminCode2) {
- this.adminCode2 = adminCode2;
- }
-
- /**
- * @return Returns the adminName1.
- */
- public String getAdminName1() {
- return adminName1;
- }
-
- /**
- * @param adminName1
- * The adminName1 to set.
- */
- public void setAdminName1(String adminName1) {
- this.adminName1 = adminName1;
- }
-
- /**
- * @return Returns the adminName2.
- */
- public String getAdminName2() {
- return adminName2;
- }
-
- /**
- * @param adminName2
- * The adminName2 to set.
- */
- public void setAdminName2(String adminName2) {
- this.adminName2 = adminName2;
- }
-
- /**
- * @return Returns the ISO 3166-1-alpha-2 countryCode.
- */
- public String getCountryCode() {
- return countryCode;
- }
-
- /**
- * @param countryCode
- * The ISO 3166-1-alpha-2 countryCode to set.
- */
- public void setCountryCode(String countryCode) {
- this.countryCode = countryCode;
- }
-
- /**
- * latitude in WGS84
- *
- * @return Returns the latitude.
- */
- public double getLatitude() {
- return latitude;
- }
-
- /**
- * @param latitude
- * The latitude to set.
- */
- public void setLatitude(double latitude) {
- this.latitude = latitude;
- }
-
- /**
- * longitude in WGS84
- *
- * @return Returns the longitude.
- */
- public double getLongitude() {
- return longitude;
- }
-
- /**
- * @param longitude
- * The longitude to set.
- */
- public void setLongitude(double longitude) {
- this.longitude = longitude;
- }
-
- /**
- * @return Returns the placeName.
- */
- public String getPlaceName() {
- return placeName;
- }
-
- /**
- * @param placeName
- * The placeName to set.
- */
- public void setPlaceName(String placeName) {
- this.placeName = placeName;
- }
-
- /**
- * @return Returns the postalCode.
- */
- public String getPostalCode() {
- return postalCode;
- }
-
- /**
- * @param postalCode
- * The postalCode to set.
- */
- public void setPostalCode(String postalCode) {
- this.postalCode = postalCode;
- }
+ private double longitude;
+
+ private String adminName1;
+
+ private String adminCode1;
+
+ private String adminName2;
+
+ private String adminCode2;
+
+ private double distance;
+
+ /**
+ * @return Returns the distance.
+ */
+ public double getDistance() {
+ return distance;
+ }
+
+ /**
+ * @param distance
+ * The distance to set.
+ */
+ public void setDistance(double distance) {
+ this.distance = distance;
+ }
+
+ /**
+ * @return Returns the adminCode1.
+ */
+ public String getAdminCode1() {
+ return adminCode1;
+ }
+
+ /**
+ * @param adminCode1
+ * The adminCode1 to set.
+ */
+ public void setAdminCode1(String adminCode1) {
+ this.adminCode1 = adminCode1;
+ }
+
+ /**
+ * @return Returns the adminCode2.
+ */
+ public String getAdminCode2() {
+ return adminCode2;
+ }
+
+ /**
+ * @param adminCode2
+ * The adminCode2 to set.
+ */
+ public void setAdminCode2(String adminCode2) {
+ this.adminCode2 = adminCode2;
+ }
+
+ /**
+ * @return Returns the adminName1.
+ */
+ public String getAdminName1() {
+ return adminName1;
+ }
+
+ /**
+ * @param adminName1
+ * The adminName1 to set.
+ */
+ public void setAdminName1(String adminName1) {
+ this.adminName1 = adminName1;
+ }
+
+ /**
+ * @return Returns the adminName2.
+ */
+ public String getAdminName2() {
+ return adminName2;
+ }
+
+ /**
+ * @param adminName2
+ * The adminName2 to set.
+ */
+ public void setAdminName2(String adminName2) {
+ this.adminName2 = adminName2;
+ }
+
+ /**
+ * @return Returns the ISO 3166-1-alpha-2 countryCode.
+ */
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ /**
+ * @param countryCode
+ * The ISO 3166-1-alpha-2 countryCode to set.
+ */
+ public void setCountryCode(String countryCode) {
+ this.countryCode = countryCode;
+ }
+
+ /**
+ * latitude in WGS84
+ *
+ * @return Returns the latitude.
+ */
+ public double getLatitude() {
+ return latitude;
+ }
+
+ /**
+ * @param latitude
+ * The latitude to set.
+ */
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ /**
+ * longitude in WGS84
+ *
+ * @return Returns the longitude.
+ */
+ public double getLongitude() {
+ return longitude;
+ }
+
+ /**
+ * @param longitude
+ * The longitude to set.
+ */
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+
+ /**
+ * @return Returns the placeName.
+ */
+ public String getPlaceName() {
+ return placeName;
+ }
+
+ /**
+ * @param placeName
+ * The placeName to set.
+ */
+ public void setPlaceName(String placeName) {
+ this.placeName = placeName;
+ }
+
+ /**
+ * @return Returns the postalCode.
+ */
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ /**
+ * @param postalCode
+ * The postalCode to set.
+ */
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCodeSearchCriteria.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCodeSearchCriteria.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCodeSearchCriteria.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/PostalCodeSearchCriteria.java Sun Dec 12 16:10:48 2010
@@ -18,228 +18,228 @@ package org.geonames;
/**
* search criteria for web services returning postal codes
- *
+ *
* @author marc@geonames
- *
+ *
*/
public class PostalCodeSearchCriteria {
- private String postalCode;
+ private String postalCode;
- private String placeName;
+ private String placeName;
- private String adminCode1;
+ private String adminCode1;
- private String countryCode;
+ private String countryCode;
- private String countryBias;
-
- private Double latitude;
-
- private Double longitude;
-
- private double radius;
-
- private Style style;
-
- private int maxRows;
-
- private int startRow;
-
- private boolean isOROperator = false;
-
- /**
- * @return Returns the style.
- */
- public Style getStyle() {
- return style;
- }
-
- /**
- * @param style
- * The style to set.
- */
- public void setStyle(Style style) {
- this.style = style;
- }
-
- /**
- * @return Returns the ISO 3166-1-alpha-2 countryCode.
- */
- public String getCountryCode() {
- return countryCode;
- }
-
- /**
- * @param countryCode
- * The ISO 3166-1-alpha-2 countryCode to set.
- */
- public void setCountryCode(String countryCode)
- throws InvalidParameterException {
- if (countryCode != null && countryCode.length() != 2) {
- throw new InvalidParameterException("invalid country code "
- + countryCode);
- }
- this.countryCode = countryCode;
- }
-
- /**
- * @return Returns the latitude.
- */
- public Double getLatitude() {
- return latitude;
- }
-
- /**
- * @param latitude
- * The latitude to set.
- */
- public void setLatitude(double latitude) throws InvalidParameterException {
- if (latitude > 90.0 || latitude < -90.0) {
- throw new InvalidParameterException("invalid latitude " + latitude);
- }
- this.latitude = new Double(latitude);
- }
-
- /**
- * @return Returns the longitude.
- */
- public Double getLongitude() {
- return longitude;
- }
-
- /**
- * @param longitude
- * The longitude to set.
- */
- public void setLongitude(double longitude) throws InvalidParameterException {
- if (longitude > 180.0 || longitude < -180.0) {
- throw new InvalidParameterException("invalid longitude "
- + longitude);
- }
- this.longitude = new Double(longitude);
- }
-
- /**
- * @return Returns the placeName.
- */
- public String getPlaceName() {
- return placeName;
- }
-
- /**
- * @param placeName
- * The placeName to set.
- */
- public void setPlaceName(String placeName) {
- this.placeName = placeName;
- }
-
- /**
- * @return Returns the postalCode.
- */
- public String getPostalCode() {
- return postalCode;
- }
-
- /**
- * @param postalCode
- * The postalCode to set.
- */
- public void setPostalCode(String postalCode) {
- this.postalCode = postalCode;
- }
-
- /**
- * @return the maxRows
- */
- public int getMaxRows() {
- return maxRows;
- }
-
- /**
- * @param maxRows
- * the maxRows to set
- */
- public void setMaxRows(int maxRows) {
- this.maxRows = maxRows;
- }
-
- /**
- * @param isOROperator
- * the isOROperator to set
- */
- public void setOROperator(boolean isOROperator) {
- this.isOROperator = isOROperator;
- }
-
- /**
- * @return the isOROperator
- */
- public boolean isOROperator() {
- return isOROperator;
- }
-
- /**
- * @return the adminCode1
- */
- public String getAdminCode1() {
- return adminCode1;
- }
-
- /**
- * @param adminCode1
- * the adminCode1 to set
- */
- public void setAdminCode1(String adminCode1) {
- this.adminCode1 = adminCode1;
- }
-
- /**
- * the radius in km to be used for reverse geocoding.
- *
- * @param radius
- * the radius to set
- */
- public void setRadius(double radius) {
- this.radius = radius;
- }
-
- /**
- * @return the radius
- */
- public double getRadius() {
- return radius;
- }
-
- /**
- * @return the countryBias
- */
- public String getCountryBias() {
- return countryBias;
- }
-
- /**
- * @param countryBias
- * the countryBias to set
- */
- public void setCountryBias(String countryBias) {
- this.countryBias = countryBias;
- }
-
- /**
- * @return the startRow
- */
- public int getStartRow() {
- return startRow;
- }
-
- /**
- * @param startRow
- * the startRow to set
- */
- public void setStartRow(int startRow) {
- this.startRow = startRow;
- }
+ private String countryBias;
+
+ private Double latitude;
+
+ private Double longitude;
+
+ private double radius;
+
+ private Style style;
+
+ private int maxRows;
+
+ private int startRow;
+
+ private boolean isOROperator = false;
+
+ /**
+ * @return Returns the style.
+ */
+ public Style getStyle() {
+ return style;
+ }
+
+ /**
+ * @param style
+ * The style to set.
+ */
+ public void setStyle(Style style) {
+ this.style = style;
+ }
+
+ /**
+ * @return Returns the ISO 3166-1-alpha-2 countryCode.
+ */
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ /**
+ * @param countryCode
+ * The ISO 3166-1-alpha-2 countryCode to set.
+ */
+ public void setCountryCode(String countryCode)
+ throws InvalidParameterException {
+ if (countryCode != null && countryCode.length() != 2) {
+ throw new InvalidParameterException("invalid country code "
+ + countryCode);
+ }
+ this.countryCode = countryCode;
+ }
+
+ /**
+ * @return Returns the latitude.
+ */
+ public Double getLatitude() {
+ return latitude;
+ }
+
+ /**
+ * @param latitude
+ * The latitude to set.
+ */
+ public void setLatitude(double latitude) throws InvalidParameterException {
+ if (latitude > 90.0 || latitude < -90.0) {
+ throw new InvalidParameterException("invalid latitude " + latitude);
+ }
+ this.latitude = new Double(latitude);
+ }
+
+ /**
+ * @return Returns the longitude.
+ */
+ public Double getLongitude() {
+ return longitude;
+ }
+
+ /**
+ * @param longitude
+ * The longitude to set.
+ */
+ public void setLongitude(double longitude) throws InvalidParameterException {
+ if (longitude > 180.0 || longitude < -180.0) {
+ throw new InvalidParameterException("invalid longitude "
+ + longitude);
+ }
+ this.longitude = new Double(longitude);
+ }
+
+ /**
+ * @return Returns the placeName.
+ */
+ public String getPlaceName() {
+ return placeName;
+ }
+
+ /**
+ * @param placeName
+ * The placeName to set.
+ */
+ public void setPlaceName(String placeName) {
+ this.placeName = placeName;
+ }
+
+ /**
+ * @return Returns the postalCode.
+ */
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ /**
+ * @param postalCode
+ * The postalCode to set.
+ */
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ /**
+ * @return the maxRows
+ */
+ public int getMaxRows() {
+ return maxRows;
+ }
+
+ /**
+ * @param maxRows
+ * the maxRows to set
+ */
+ public void setMaxRows(int maxRows) {
+ this.maxRows = maxRows;
+ }
+
+ /**
+ * @param isOROperator
+ * the isOROperator to set
+ */
+ public void setOROperator(boolean isOROperator) {
+ this.isOROperator = isOROperator;
+ }
+
+ /**
+ * @return the isOROperator
+ */
+ public boolean isOROperator() {
+ return isOROperator;
+ }
+
+ /**
+ * @return the adminCode1
+ */
+ public String getAdminCode1() {
+ return adminCode1;
+ }
+
+ /**
+ * @param adminCode1
+ * the adminCode1 to set
+ */
+ public void setAdminCode1(String adminCode1) {
+ this.adminCode1 = adminCode1;
+ }
+
+ /**
+ * the radius in km to be used for reverse geocoding.
+ *
+ * @param radius
+ * the radius to set
+ */
+ public void setRadius(double radius) {
+ this.radius = radius;
+ }
+
+ /**
+ * @return the radius
+ */
+ public double getRadius() {
+ return radius;
+ }
+
+ /**
+ * @return the countryBias
+ */
+ public String getCountryBias() {
+ return countryBias;
+ }
+
+ /**
+ * @param countryBias
+ * the countryBias to set
+ */
+ public void setCountryBias(String countryBias) {
+ this.countryBias = countryBias;
+ }
+
+ /**
+ * @return the startRow
+ */
+ public int getStartRow() {
+ return startRow;
+ }
+
+ /**
+ * @param startRow
+ * the startRow to set
+ */
+ public void setStartRow(int startRow) {
+ this.startRow = startRow;
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/StreetSegment.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/StreetSegment.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/StreetSegment.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/StreetSegment.java Sun Dec 12 16:10:48 2010
@@ -19,162 +19,162 @@ package org.geonames;
/**
* a street line segment. Includes house number information for the beginning
* and end of the line as well as right and left hand side of the line.
- *
+ *
* @author marc@geonames
- *
+ *
*/
public class StreetSegment extends PostalCode {
- private double[] latArray;
+ private double[] latArray;
- private double[] lngArray;
+ private double[] lngArray;
- /**
- * census feature class codes see
- * http://www.geonames.org/maps/Census-Feature-Class-Codes.txt
- */
- private String cfcc;
-
- private String name;
-
- /**
- * from address left
- */
- private String fraddl;
-
- /**
- * from address right
- */
- private String fraddr;
-
- /**
- * to address left
- */
- private String toaddl;
-
- /**
- * to address right
- */
- private String toaddr;
-
- /**
- * @return the latArray
- */
- public double[] getLatArray() {
- return latArray;
- }
-
- /**
- * @param latArray
- * the latArray to set
- */
- public void setLatArray(double[] latArray) {
- this.latArray = latArray;
- }
-
- /**
- * @return the lngArray
- */
- public double[] getLngArray() {
- return lngArray;
- }
-
- /**
- * @param lngArray
- * the lngArray to set
- */
- public void setLngArray(double[] lngArray) {
- this.lngArray = lngArray;
- }
-
- /**
- * @return the cfcc
- */
- public String getCfcc() {
- return cfcc;
- }
-
- /**
- * @param cfcc
- * the cfcc to set
- */
- public void setCfcc(String cfcc) {
- this.cfcc = cfcc;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the fraddl
- */
- public String getFraddl() {
- return fraddl;
- }
-
- /**
- * @param fraddl
- * the fraddl to set
- */
- public void setFraddl(String fraddl) {
- this.fraddl = fraddl;
- }
-
- /**
- * @return the fraddr
- */
- public String getFraddr() {
- return fraddr;
- }
-
- /**
- * @param fraddr
- * the fraddr to set
- */
- public void setFraddr(String fraddr) {
- this.fraddr = fraddr;
- }
-
- /**
- * @return the toaddl
- */
- public String getToaddl() {
- return toaddl;
- }
-
- /**
- * @param toaddl
- * the toaddl to set
- */
- public void setToaddl(String toaddl) {
- this.toaddl = toaddl;
- }
-
- /**
- * @return the toaddr
- */
- public String getToaddr() {
- return toaddr;
- }
-
- /**
- * @param toaddr
- * the toaddr to set
- */
- public void setToaddr(String toaddr) {
- this.toaddr = toaddr;
- }
+ /**
+ * census feature class codes see
+ * http://www.geonames.org/maps/Census-Feature-Class-Codes.txt
+ */
+ private String cfcc;
+
+ private String name;
+
+ /**
+ * from address left
+ */
+ private String fraddl;
+
+ /**
+ * from address right
+ */
+ private String fraddr;
+
+ /**
+ * to address left
+ */
+ private String toaddl;
+
+ /**
+ * to address right
+ */
+ private String toaddr;
+
+ /**
+ * @return the latArray
+ */
+ public double[] getLatArray() {
+ return latArray;
+ }
+
+ /**
+ * @param latArray
+ * the latArray to set
+ */
+ public void setLatArray(double[] latArray) {
+ this.latArray = latArray;
+ }
+
+ /**
+ * @return the lngArray
+ */
+ public double[] getLngArray() {
+ return lngArray;
+ }
+
+ /**
+ * @param lngArray
+ * the lngArray to set
+ */
+ public void setLngArray(double[] lngArray) {
+ this.lngArray = lngArray;
+ }
+
+ /**
+ * @return the cfcc
+ */
+ public String getCfcc() {
+ return cfcc;
+ }
+
+ /**
+ * @param cfcc
+ * the cfcc to set
+ */
+ public void setCfcc(String cfcc) {
+ this.cfcc = cfcc;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the fraddl
+ */
+ public String getFraddl() {
+ return fraddl;
+ }
+
+ /**
+ * @param fraddl
+ * the fraddl to set
+ */
+ public void setFraddl(String fraddl) {
+ this.fraddl = fraddl;
+ }
+
+ /**
+ * @return the fraddr
+ */
+ public String getFraddr() {
+ return fraddr;
+ }
+
+ /**
+ * @param fraddr
+ * the fraddr to set
+ */
+ public void setFraddr(String fraddr) {
+ this.fraddr = fraddr;
+ }
+
+ /**
+ * @return the toaddl
+ */
+ public String getToaddl() {
+ return toaddl;
+ }
+
+ /**
+ * @param toaddl
+ * the toaddl to set
+ */
+ public void setToaddl(String toaddl) {
+ this.toaddl = toaddl;
+ }
+
+ /**
+ * @return the toaddr
+ */
+ public String getToaddr() {
+ return toaddr;
+ }
+
+ /**
+ * @param toaddr
+ * the toaddr to set
+ */
+ public void setToaddr(String toaddr) {
+ this.toaddr = toaddr;
+ }
}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Style.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Style.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Style.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Style.java Sun Dec 12 16:10:48 2010
@@ -20,10 +20,10 @@ package org.geonames;
/**
* Enumeration for style parameter specifying the verbosity of geonames web
* services
- *
+ *
* @author marc@geonames
- *
+ *
*/
public enum Style {
- SHORT, MEDIUM, LONG, FULL
-}
\ No newline at end of file
+ SHORT, MEDIUM, LONG, FULL
+}
Modified: incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Timezone.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Timezone.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Timezone.java (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/Timezone.java Sun Dec 12 16:10:48 2010
@@ -20,70 +20,70 @@ package org.geonames;
* gmtOffset and dstOffset are computed on the server with the
* {@link java.util.TimeZone} and included in the web service as not all
* geonames users are using java.
- *
+ *
* @author marc
- *
+ *
*/
public class Timezone {
- private String timezoneId;
+ private String timezoneId;
- private double gmtOffset;
+ private double gmtOffset;
- private double dstOffset;
+ private double dstOffset;
- /**
- * the dstOffset as of first of July of current year
- *
- * @return the dstOffset
- */
- public double getDstOffset() {
- return dstOffset;
- }
-
- /**
- * @param dstOffset
- * the dstOffset to set
- */
- public void setDstOffset(double dstOffset) {
- this.dstOffset = dstOffset;
- }
-
- /**
- * the gmtOffset as of first of January of current year
- *
- * @return the gmtOffset
- */
- public double getGmtOffset() {
- return gmtOffset;
- }
-
- /**
- * @param gmtOffset
- * the gmtOffset to set
- */
- public void setGmtOffset(double gmtOffset) {
- this.gmtOffset = gmtOffset;
- }
-
- /**
- * the timezoneId (example : "Pacific/Honolulu")
- *
- * see also {@link java.util.TimeZone} and
- * http://www.twinsun.com/tz/tz-link.htm
- *
- * @return the timezoneId
- */
- public String getTimezoneId() {
- return timezoneId;
- }
-
- /**
- * @param timezoneId
- * the timezoneId to set
- */
- public void setTimezoneId(String timezoneId) {
- this.timezoneId = timezoneId;
- }
+ /**
+ * the dstOffset as of first of July of current year
+ *
+ * @return the dstOffset
+ */
+ public double getDstOffset() {
+ return dstOffset;
+ }
+
+ /**
+ * @param dstOffset
+ * the dstOffset to set
+ */
+ public void setDstOffset(double dstOffset) {
+ this.dstOffset = dstOffset;
+ }
+
+ /**
+ * the gmtOffset as of first of January of current year
+ *
+ * @return the gmtOffset
+ */
+ public double getGmtOffset() {
+ return gmtOffset;
+ }
+
+ /**
+ * @param gmtOffset
+ * the gmtOffset to set
+ */
+ public void setGmtOffset(double gmtOffset) {
+ this.gmtOffset = gmtOffset;
+ }
+
+ /**
+ * the timezoneId (example : "Pacific/Honolulu")
+ *
+ * see also {@link java.util.TimeZone} and
+ * http://www.twinsun.com/tz/tz-link.htm
+ *
+ * @return the timezoneId
+ */
+ public String getTimezoneId() {
+ return timezoneId;
+ }
+
+ /**
+ * @param timezoneId
+ * the timezoneId to set
+ */
+ public void setTimezoneId(String timezoneId) {
+ this.timezoneId = timezoneId;
+ }
}