WikipediaArticleResource extends AbstractResource { public Set<Entity> getParents(Entity entity) throws LexicalSemanticResourceException { if (!this.containsEntity(entity)) { return Collections.emptySet(); } Page p = WikipediaArticleUtils.entityToPage(wiki, entity, isCaseSensitive); return WikipediaArticleUtils.pagesToEntities(wiki, p.getInlinks(), isCaseSensitive ); } WikipediaArticleResource(String host, String database, String user, String password, Language language);  WikipediaArticleResource(DatabaseConfiguration dbConfig);  WikipediaArticleResource(Wikipedia wiki); boolean containsEntity(Entity entity); boolean containsLexeme(String lexeme); Set<Entity> getEntity(String lexeme); Set<Entity> getEntity(String lexeme, PoS pos); Set<Entity> getEntity(String lexeme, PoS pos, String sense); Set<Entity> getParents(Entity entity); int getNumberOfEntities(); Iterable<Entity> getEntities(); Set<Entity> getChildren(Entity entity); String getResourceName(); String getResourceVersion(); Set<String> getRelatedLexemes(String lexeme, PoS pos, String sense, LexicalRelation lexicalRelation); int getShortestPathLength(Entity e1, Entity e2); String getGloss(Entity entity); Set<Entity> getRelatedEntities(Entity entity, SemanticRelation semanticRelation); @Override Entity getRoot(); @Override Entity getRoot(PoS pos); @Override Entity getMostFrequentEntity(String lexeme); @Override Entity getMostFrequentEntity(String lexeme, PoS pos);  }
@Test public void testGetParents() throws LexicalSemanticResourceException { wikiResource.setIsCaseSensitive(false); Set<Entity> parents = wikiResource.getParents(new Entity( "Torsten_Zesch")); Set<String> expectedParents = new HashSet<String>(); expectedParents.add(new Entity("Wikipedia API").getId()); expectedParents .add(new Entity( "Analyzing and Accessing Wikipedia as a Lexical Semantic Resource") .getId()); expectedParents.add(new Entity("Demo of Wikipedia API").getId()); assertEquals(expectedParents.size(), parents.size()); for (Entity parent : parents) { assertTrue(parent.toString(), expectedParents.contains(parent.toString())); } assertEquals(1, wikiResource.getParents(new Entity("P2P")).size()); wikiResource.setIsCaseSensitive(true); parents = wikiResource.getParents(new Entity("Torsten_Zesch")); expectedParents = new HashSet<String>(); expectedParents.add(new Entity("Wikipedia API").getId()); expectedParents .add(new Entity( "Analyzing and Accessing Wikipedia as a Lexical Semantic Resource") .getId()); expectedParents.add(new Entity("Demo of Wikipedia API").getId()); assertEquals(expectedParents.size(), parents.size()); for (Entity parent : parents) { assertTrue(parent.toString(), expectedParents.contains(parent.toString())); } assertEquals(1, wikiResource.getParents(new Entity("P2P")).size()); parents = wikiResource.getParents(new Entity("torsten_Zesch")); assertEquals(0, parents.size()); }