diff --git a/.gitignore b/.gitignore index c2106f6..21f6e68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /dist/ /build/ /store/ -build diff --git a/build.xml b/build.xml index 8146a81..d9e5b22 100644 --- a/build.xml +++ b/build.xml @@ -89,11 +89,22 @@ - + + + + + + + + - + + + + + diff --git a/build/classes/type/detect/TypeDetect.class b/build/classes/type/detect/TypeDetect.class deleted file mode 100644 index e2a74c4..0000000 Binary files a/build/classes/type/detect/TypeDetect.class and /dev/null differ diff --git a/build/classes/type/detect/grok/BooleanConverter.class b/build/classes/type/detect/grok/BooleanConverter.class deleted file mode 100644 index cf8c76e..0000000 Binary files a/build/classes/type/detect/grok/BooleanConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/ByteConverter.class b/build/classes/type/detect/grok/ByteConverter.class deleted file mode 100644 index d9cf5b9..0000000 Binary files a/build/classes/type/detect/grok/ByteConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Converter.class b/build/classes/type/detect/grok/Converter.class deleted file mode 100644 index c589f16..0000000 Binary files a/build/classes/type/detect/grok/Converter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/DateConverter.class b/build/classes/type/detect/grok/DateConverter.class deleted file mode 100644 index b075223..0000000 Binary files a/build/classes/type/detect/grok/DateConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Discovery$1.class b/build/classes/type/detect/grok/Discovery$1.class deleted file mode 100644 index e5557ce..0000000 Binary files a/build/classes/type/detect/grok/Discovery$1.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Discovery.class b/build/classes/type/detect/grok/Discovery.class deleted file mode 100644 index 4bacc8a..0000000 Binary files a/build/classes/type/detect/grok/Discovery.class and /dev/null differ diff --git a/build/classes/type/detect/grok/DoubleConverter.class b/build/classes/type/detect/grok/DoubleConverter.class deleted file mode 100644 index 2e2a625..0000000 Binary files a/build/classes/type/detect/grok/DoubleConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/FloatConverter.class b/build/classes/type/detect/grok/FloatConverter.class deleted file mode 100644 index 36926a3..0000000 Binary files a/build/classes/type/detect/grok/FloatConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Garbage.class b/build/classes/type/detect/grok/Garbage.class deleted file mode 100644 index 950615e..0000000 Binary files a/build/classes/type/detect/grok/Garbage.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Grok.class b/build/classes/type/detect/grok/Grok.class deleted file mode 100644 index 3e8a886..0000000 Binary files a/build/classes/type/detect/grok/Grok.class and /dev/null differ diff --git a/build/classes/type/detect/grok/GrokUtils.class b/build/classes/type/detect/grok/GrokUtils.class deleted file mode 100644 index 21dfa8c..0000000 Binary files a/build/classes/type/detect/grok/GrokUtils.class and /dev/null differ diff --git a/build/classes/type/detect/grok/IConverter.class b/build/classes/type/detect/grok/IConverter.class deleted file mode 100644 index 60be555..0000000 Binary files a/build/classes/type/detect/grok/IConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/IntegerConverter.class b/build/classes/type/detect/grok/IntegerConverter.class deleted file mode 100644 index d7bf616..0000000 Binary files a/build/classes/type/detect/grok/IntegerConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/KeyValue.class b/build/classes/type/detect/grok/KeyValue.class deleted file mode 100644 index fff4cc5..0000000 Binary files a/build/classes/type/detect/grok/KeyValue.class and /dev/null differ diff --git a/build/classes/type/detect/grok/LongConverter.class b/build/classes/type/detect/grok/LongConverter.class deleted file mode 100644 index 68abdfe..0000000 Binary files a/build/classes/type/detect/grok/LongConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Match$1.class b/build/classes/type/detect/grok/Match$1.class deleted file mode 100644 index 5830bda..0000000 Binary files a/build/classes/type/detect/grok/Match$1.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Match.class b/build/classes/type/detect/grok/Match.class deleted file mode 100644 index 9033395..0000000 Binary files a/build/classes/type/detect/grok/Match.class and /dev/null differ diff --git a/build/classes/type/detect/grok/Pile.class b/build/classes/type/detect/grok/Pile.class deleted file mode 100644 index 927b34b..0000000 Binary files a/build/classes/type/detect/grok/Pile.class and /dev/null differ diff --git a/build/classes/type/detect/grok/ShortConverter.class b/build/classes/type/detect/grok/ShortConverter.class deleted file mode 100644 index bdf45b4..0000000 Binary files a/build/classes/type/detect/grok/ShortConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/StringConverter.class b/build/classes/type/detect/grok/StringConverter.class deleted file mode 100644 index 2943ebe..0000000 Binary files a/build/classes/type/detect/grok/StringConverter.class and /dev/null differ diff --git a/build/classes/type/detect/grok/exception/GrokError.class b/build/classes/type/detect/grok/exception/GrokError.class deleted file mode 100644 index fa84e61..0000000 Binary files a/build/classes/type/detect/grok/exception/GrokError.class and /dev/null differ diff --git a/build/classes/type/detect/grok/exception/GrokException.class b/build/classes/type/detect/grok/exception/GrokException.class deleted file mode 100644 index ff7f9f7..0000000 Binary files a/build/classes/type/detect/grok/exception/GrokException.class and /dev/null differ diff --git a/build/classes/type/detect/kb/freebase/FreebaseUtil.class b/build/classes/type/detect/kb/freebase/FreebaseUtil.class deleted file mode 100644 index b085b21..0000000 Binary files a/build/classes/type/detect/kb/freebase/FreebaseUtil.class and /dev/null differ diff --git a/build/classes/type/detect/kb/knowledgegraph/KnowledgeGraphUtil.class b/build/classes/type/detect/kb/knowledgegraph/KnowledgeGraphUtil.class deleted file mode 100644 index 3760975..0000000 Binary files a/build/classes/type/detect/kb/knowledgegraph/KnowledgeGraphUtil.class and /dev/null differ diff --git a/resources/wikidata/search_by_id.sparql b/resources/wikidata/search_by_id.sparql index ae3bb03..f2accda 100644 --- a/resources/wikidata/search_by_id.sparql +++ b/resources/wikidata/search_by_id.sparql @@ -1,7 +1,8 @@ PREFIX entity: -SELECT ?typelabel +SELECT distinct ?typelabel WHERE { - entity:{{id}} wdt:P31 ?type . + entity:{{id}} wdt:P31|wdt:P279 ?type . ?type rdfs:label ?typelabel FILTER (LANG(?typelabel)="en") . -} \ No newline at end of file + } + diff --git a/src/type/detect/kb/wikidata/WikiDataConsumer.java b/src/type/detect/kb/wikidata/WikiDataConsumer.java index e15a7a1..3e986c9 100644 --- a/src/type/detect/kb/wikidata/WikiDataConsumer.java +++ b/src/type/detect/kb/wikidata/WikiDataConsumer.java @@ -29,6 +29,7 @@ public class WikiDataConsumer { private static final String SEARCH_URL_TEMPLATE = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search={{query}}&language=en&type=item&format=json"; private static final String SPAPRQL_TYPE_QUERY = IOUtils.readFileToString("resources/wikidata/search_by_id.sparql"); private static final String SPARQL_URL_TEMPLATE = "https://query.wikidata.org/sparql?format=json&query={{sparql}}"; + private static final Integer DEFUALT_SEARCH_LIMIT = 3; public static void main(String[] args) { // final Map types = getTypes("barack obama"); @@ -52,7 +53,7 @@ public static Map getTypes(List terms) { public static Map getTypes(String term) { Map freq = new HashMap<>(); - List results = search(term); + List results = search(term, DEFUALT_SEARCH_LIMIT); System.out.println(results); for (WikiDataSearchEntity ent : results) { final List types = recognizeTypesForID(ent.getId()); @@ -99,6 +100,15 @@ public static List recognizeTypesForID(String id) { return null; } + public static List search(String query, int limit) { + final List results = search(query); + if (results.size() <= limit) { + return results; + } else { + return results.subList(0, limit); + } + } + public static List search(String query) { List results = new ArrayList<>(); try { diff --git a/test/type/detect/TypeDetectTest.java b/test/type/detect/TypeDetectTest.java new file mode 100644 index 0000000..7f117b0 --- /dev/null +++ b/test/type/detect/TypeDetectTest.java @@ -0,0 +1,92 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import junit.framework.TestCase; + +/** + * + * @author Amir + */ +public class TypeDetectTest extends TestCase { + + public TypeDetectTest(String testName) { + super(testName); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of main method, of class TypeDetect. + */ + public void testMain() { + System.out.println("main"); + String[] args = null; + TypeDetect.main(args); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of besttype method, of class TypeDetect. + */ + public void testBesttype_String() { + System.out.println("besttype"); + String text = ""; + TypeDetect instance = new TypeDetect(); + String expResult = ""; + String result = instance.besttype(text); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of besttype method, of class TypeDetect. + */ + public void testBesttype_List() { + System.out.println("besttype"); + List list = Arrays.asList("ITGB3", "ERBB2", "CTLA4"); + TypeDetect instance = new TypeDetect(); + String result = instance.besttype(list); + assertEquals("protein-coding gene", result); + } + + public void testBesttype_List2() { + System.out.println("besttype"); + List list = Arrays.asList("Klebsiella", "Escherichia coli", "Bacteria and protozoa", "Neisseria meningitidis"); + TypeDetect instance = new TypeDetect(); + String result = instance.besttype(list); + assertEquals("taxon", result); +// System.out.println(result); + } + + /** + * Test of besttype method, of class TypeDetect. + */ + public void testBesttype_Set() { + System.out.println("besttype"); + Set set = null; + TypeDetect instance = new TypeDetect(); + String expResult = ""; + String result = instance.besttype(set); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/KbSuite.java b/test/type/detect/kb/KbSuite.java new file mode 100644 index 0000000..35a253c --- /dev/null +++ b/test/type/detect/kb/KbSuite.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import type.detect.kb.freebase.FreebaseSuite; +import type.detect.kb.knowledgegraph.KnowledgegraphSuite; +import type.detect.kb.sparql.SparqlSuite; +import type.detect.kb.wikidata.WikidataSuite; + +/** + * + * @author Amir + */ +public class KbSuite extends TestCase { + + public KbSuite(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite("KbSuite"); + suite.addTest(WikidataSuite.suite()); + suite.addTest(KnowledgegraphSuite.suite()); + suite.addTest(SparqlSuite.suite()); + suite.addTest(FreebaseSuite.suite()); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/test/type/detect/kb/freebase/FreebaseSuite.java b/test/type/detect/kb/freebase/FreebaseSuite.java new file mode 100644 index 0000000..b41ce51 --- /dev/null +++ b/test/type/detect/kb/freebase/FreebaseSuite.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.freebase; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class FreebaseSuite extends TestCase { + + public FreebaseSuite(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite("FreebaseSuite"); + suite.addTest(FreebaseUtilTest.suite()); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/test/type/detect/kb/freebase/FreebaseUtilTest.java b/test/type/detect/kb/freebase/FreebaseUtilTest.java new file mode 100644 index 0000000..ed55fdf --- /dev/null +++ b/test/type/detect/kb/freebase/FreebaseUtilTest.java @@ -0,0 +1,79 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.freebase; + +import java.util.Map; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import net.sf.json.JSONArray; + +/** + * + * @author Amir + */ +public class FreebaseUtilTest extends TestCase { + + public FreebaseUtilTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(FreebaseUtilTest.class); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of main method, of class FreebaseUtil. + */ + public void testMain() { + System.out.println("main"); + String[] args = null; + FreebaseUtil.main(args); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of search method, of class FreebaseUtil. + */ + public void testSearch() { + System.out.println("search"); + String query = ""; + String mql_query_file = ""; + int limit = 0; + JSONArray expResult = null; + JSONArray result = FreebaseUtil.search(query, mql_query_file, limit); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of fetch method, of class FreebaseUtil. + */ + public void testFetch() { + System.out.println("fetch"); + String query_template_file = ""; + Map params = null; + JSONArray expResult = null; + JSONArray result = FreebaseUtil.fetch(query_template_file, params); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/knowledgegraph/KnowledgeGraphUtilTest.java b/test/type/detect/kb/knowledgegraph/KnowledgeGraphUtilTest.java new file mode 100644 index 0000000..2cd5223 --- /dev/null +++ b/test/type/detect/kb/knowledgegraph/KnowledgeGraphUtilTest.java @@ -0,0 +1,75 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.knowledgegraph; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import org.json.simple.JSONArray; + +/** + * + * @author Amir + */ +public class KnowledgeGraphUtilTest extends TestCase { + + public KnowledgeGraphUtilTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(KnowledgeGraphUtilTest.class); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of main method, of class KnowledgeGraphUtil. + */ + public void testMain() { + System.out.println("main"); + String[] args = null; + KnowledgeGraphUtil.main(args); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getType method, of class KnowledgeGraphUtil. + */ + public void testGetType() { + System.out.println("getType"); + String query = ""; + String expResult = ""; + String result = KnowledgeGraphUtil.getType(query); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getResult method, of class KnowledgeGraphUtil. + */ + public void testGetResult() { + System.out.println("getResult"); + String query = ""; + JSONArray expResult = null; + JSONArray result = KnowledgeGraphUtil.getResult(query); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/knowledgegraph/KnowledgegraphSuite.java b/test/type/detect/kb/knowledgegraph/KnowledgegraphSuite.java new file mode 100644 index 0000000..3f9d39c --- /dev/null +++ b/test/type/detect/kb/knowledgegraph/KnowledgegraphSuite.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.knowledgegraph; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class KnowledgegraphSuite extends TestCase { + + public KnowledgegraphSuite(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite("KnowledgegraphSuite"); + suite.addTest(KnowledgeGraphUtilTest.suite()); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/test/type/detect/kb/sparql/SparqlConsumerTest.java b/test/type/detect/kb/sparql/SparqlConsumerTest.java new file mode 100644 index 0000000..dad0012 --- /dev/null +++ b/test/type/detect/kb/sparql/SparqlConsumerTest.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.sparql; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class SparqlConsumerTest extends TestCase { + + public SparqlConsumerTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(SparqlConsumerTest.class); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of main method, of class SparqlConsumer. + */ + public void testMain() { + System.out.println("main"); + String[] args = null; + SparqlConsumer.main(args); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of query method, of class SparqlConsumer. + */ + public void testQuery() { + System.out.println("query"); + String endpoint = ""; + String query = ""; + SparqlConsumer.query(endpoint, query); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/sparql/SparqlSuite.java b/test/type/detect/kb/sparql/SparqlSuite.java new file mode 100644 index 0000000..7dfa0db --- /dev/null +++ b/test/type/detect/kb/sparql/SparqlSuite.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.sparql; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class SparqlSuite extends TestCase { + + public SparqlSuite(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite("SparqlSuite"); + suite.addTest(SparqlConsumerTest.suite()); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/test/type/detect/kb/wikidata/WikiDataConsumerTest.java b/test/type/detect/kb/wikidata/WikiDataConsumerTest.java new file mode 100644 index 0000000..a902b55 --- /dev/null +++ b/test/type/detect/kb/wikidata/WikiDataConsumerTest.java @@ -0,0 +1,128 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.wikidata; + +import java.util.List; +import java.util.Map; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class WikiDataConsumerTest extends TestCase { + + public WikiDataConsumerTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(WikiDataConsumerTest.class); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of main method, of class WikiDataConsumer. + */ + public void testMain() { + System.out.println("main"); + String[] args = null; + WikiDataConsumer.main(args); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getTypes method, of class WikiDataConsumer. + */ + public void testGetTypes_List() { + System.out.println("getTypes"); + List terms = null; + Map expResult = null; + Map result = WikiDataConsumer.getTypes(terms); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getTypes method, of class WikiDataConsumer. + */ + public void testGetTypes_String() { + System.out.println("getTypes"); + String term = ""; + Map expResult = null; + Map result = WikiDataConsumer.getTypes(term); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getBestType method, of class WikiDataConsumer. + */ + public void testGetBestType_String() { + System.out.println("getBestType"); + String term = ""; + String expResult = ""; + String result = WikiDataConsumer.getBestType(term); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getBestType method, of class WikiDataConsumer. + */ + public void testGetBestType_List() { + System.out.println("getBestType"); + List terms = null; + String expResult = ""; + String result = WikiDataConsumer.getBestType(terms); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of recognizeTypesForID method, of class WikiDataConsumer. + */ + public void testRecognizeTypesForID() { + System.out.println("recognizeTypesForID"); + String id = ""; + List expResult = null; + List result = WikiDataConsumer.recognizeTypesForID(id); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of search method, of class WikiDataConsumer. + */ + public void testSearch() { + System.out.println("search"); + String query = ""; + List expResult = null; + List result = WikiDataConsumer.search(query); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/wikidata/WikiDataSearchEntityTest.java b/test/type/detect/kb/wikidata/WikiDataSearchEntityTest.java new file mode 100644 index 0000000..f571d04 --- /dev/null +++ b/test/type/detect/kb/wikidata/WikiDataSearchEntityTest.java @@ -0,0 +1,150 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.wikidata; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class WikiDataSearchEntityTest extends TestCase { + + public WikiDataSearchEntityTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(WikiDataSearchEntityTest.class); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test of getId method, of class WikiDataSearchEntity. + */ + public void testGetId() { + System.out.println("getId"); + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + String expResult = ""; + String result = instance.getId(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setId method, of class WikiDataSearchEntity. + */ + public void testSetId() { + System.out.println("setId"); + String id = ""; + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + instance.setId(id); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getUrl method, of class WikiDataSearchEntity. + */ + public void testGetUrl() { + System.out.println("getUrl"); + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + String expResult = ""; + String result = instance.getUrl(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setUrl method, of class WikiDataSearchEntity. + */ + public void testSetUrl() { + System.out.println("setUrl"); + String url = ""; + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + instance.setUrl(url); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getLabel method, of class WikiDataSearchEntity. + */ + public void testGetLabel() { + System.out.println("getLabel"); + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + String expResult = ""; + String result = instance.getLabel(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setLabel method, of class WikiDataSearchEntity. + */ + public void testSetLabel() { + System.out.println("setLabel"); + String label = ""; + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + instance.setLabel(label); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of getType method, of class WikiDataSearchEntity. + */ + public void testGetType() { + System.out.println("getType"); + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + String expResult = ""; + String result = instance.getType(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of setType method, of class WikiDataSearchEntity. + */ + public void testSetType() { + System.out.println("setType"); + String type = ""; + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + instance.setType(type); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of toString method, of class WikiDataSearchEntity. + */ + public void testToString() { + System.out.println("toString"); + WikiDataSearchEntity instance = new WikiDataSearchEntity(); + String expResult = ""; + String result = instance.toString(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} diff --git a/test/type/detect/kb/wikidata/WikidataSuite.java b/test/type/detect/kb/wikidata/WikidataSuite.java new file mode 100644 index 0000000..dacbc06 --- /dev/null +++ b/test/type/detect/kb/wikidata/WikidataSuite.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package type.detect.kb.wikidata; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * + * @author Amir + */ +public class WikidataSuite extends TestCase { + + public WikidataSuite(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite("WikidataSuite"); + suite.addTest(WikiDataSearchEntityTest.suite()); + suite.addTest(WikiDataConsumerTest.suite()); + return suite; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +}