You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2013/10/03 06:39:20 UTC
svn commit: r1528715 - in
/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol:
enhancer/it/FstLinkingTest.java enhancer/it/FstProcessingStressTest.java
entityhub/it/EntityhubTest.java
Author: rwesten
Date: Thu Oct 3 04:39:20 2013
New Revision: 1528715
URL: http://svn.apache.org/r1528715
Log:
STANBOL-1128: added two integration tests for the FST Linking Engine; minor: organized imports of EntityhubTest
Added:
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstLinkingTest.java
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstProcessingStressTest.java
Modified:
stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
Added: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstLinkingTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstLinkingTest.java?rev=1528715&view=auto
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstLinkingTest.java (added)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstLinkingTest.java Thu Oct 3 04:39:20 2013
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.stanbol.enhancer.it;
+
+import org.junit.Test;
+
+public class FstLinkingTest extends EnhancerTestBase {
+
+
+ public static final String TEST_TEXT = "There has been a worried response in "
+ + "Greece to the Sunday's election in Germany. The win of Chancellor "
+ + "Angela Merkel means that there will not be a radical change in "
+ + "European policy. Greeks would have preferred SPD candidate Peer "
+ + "Steinbrueck, whose party lost Sunday.";
+
+ /**
+ *
+ */
+ public FstLinkingTest() {
+ super(getChainEndpoint("dbpedia-fst-linking"),
+ "langdetect"," LanguageDetectionEnhancementEngine",
+ "opennlp-sentence"," OpenNlpSentenceDetectionEngine",
+ "opennlp-token"," OpenNlpTokenizerEngine",
+ "opennlp-pos","OpenNlpPosTaggingEngine",
+ "dbpedia-fst-linking","FstLinkingEngine");
+ }
+
+
+ @Test
+ public void testFstLinkingEnhancement() throws Exception {
+ executor.execute(
+ builder.buildPostRequest(getEndpoint())
+ .withHeader("Accept","text/rdf+nt")
+ .withContent(TEST_TEXT)
+ )
+ .assertStatus(200)
+ .assertContentRegexp( // it MUST detect the language
+ "http://purl.org/dc/terms/creator.*LanguageDetectionEnhancementEngine",
+ "http://purl.org/dc/terms/language.*en",
+ //and the entityLinkingEngine
+ "http://purl.org/dc/terms/creator.*FstLinkingEngine",
+ //needs to suggest the following Entities
+ "http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Chancellor",
+ "http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Angela_Merkel",
+ "http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Greece",
+ "http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Germany",
+ "http://fise.iks-project.eu/ontology/entity-reference.*http://dbpedia.org/resource/Social_Democratic_Party_of_Germany",
+ //for the following sections within the text
+ "http://fise.iks-project.eu/ontology/selected-text.*Chancellor",
+ "http://fise.iks-project.eu/ontology/selected-text.*Angela Merkel",
+ "http://fise.iks-project.eu/ontology/selected-text.*Greece",
+ "http://fise.iks-project.eu/ontology/selected-text.*Germany",
+ "http://fise.iks-project.eu/ontology/selected-text.*SPD");
+ }
+
+
+}
Added: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstProcessingStressTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstProcessingStressTest.java?rev=1528715&view=auto
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstProcessingStressTest.java (added)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/FstProcessingStressTest.java Thu Oct 3 04:39:20 2013
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.stanbol.enhancer.it;
+
+import org.junit.Test;
+
+public class FstProcessingStressTest extends MultiThreadedTestBase {
+
+ public static final String FST_LINKING_CHAIN = "dbpedia-fst-linking";
+
+ public FstProcessingStressTest(){
+ super();
+ }
+
+ @Test
+ public void testProperNounLinking() throws Exception {
+ TestSettings settings = new TestSettings();
+ settings.setChain(FST_LINKING_CHAIN);
+ //use the default for the rest of the tests
+ performTest(settings);
+ }
+
+}
Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java?rev=1528715&r1=1528714&r2=1528715&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java Thu Oct 3 04:39:20 2013
@@ -16,12 +16,7 @@
*/
package org.apache.stanbol.entityhub.it;
-import static junit.framework.Assert.assertNotSame;
import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML;
-import static org.apache.stanbol.entityhub.it.DbpediaDefaultdataConstants.DBPEDIA_DEFAULTDATA_OPTIONAL_FIELDS;
-import static org.apache.stanbol.entityhub.it.DbpediaDefaultdataConstants.DBPEDIA_DEFAULTDATA_REQUIRED_FIELDS;
-import static org.apache.stanbol.entityhub.it.DbpediaDefaultdataConstants.DBPEDIA_SITE_ID;
-import static org.apache.stanbol.entityhub.it.DbpediaDefaultdataConstants.DBPEDIA_SITE_PATH;
import static org.apache.stanbol.entityhub.test.it.AssertEntityhubJson.assertEntity;
import static org.apache.stanbol.entityhub.test.it.AssertEntityhubJson.assertQueryResults;
import static org.apache.stanbol.entityhub.test.it.AssertEntityhubJson.assertRepresentation;
@@ -29,7 +24,6 @@ import static org.apache.stanbol.entityh
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -37,30 +31,23 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.InputStreamEntity;
import org.apache.stanbol.commons.testing.http.Request;
import org.apache.stanbol.commons.testing.http.RequestExecutor;
import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
-import org.apache.stanbol.entityhub.test.it.AssertEntityhubJson;
-import org.apache.stanbol.entityhub.test.it.EntityhubTestBase;
import org.apache.stanbol.entityhub.test.query.FieldQueryTestCase;
import org.apache.stanbol.entityhub.test.query.FindQueryTestCase;
import org.apache.stanbol.entityhub.test.query.QueryTestBase;
-import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.junit.Assert;