Changeset 5037
- Timestamp:
- 04/24/14 09:59:37 (10 years ago)
- Location:
- SRUAggregator/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/WebAppListener.java
r5036 r5037 113 113 EndpointUrlFilter filter = new EndpointUrlFilter(); 114 114 //filter.urlShouldContainAnyOf("leipzig", ".mpi.nl"); 115 //filter.urlShouldContainAnyOf("uni-tuebingen.de"); 115 116 filter.urlShouldContainAnyOf("uni-tuebingen.de", ".mpi.nl"); 116 117 //filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat."); -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCacheFiled.java
r5035 r5037 171 171 writer.write(lang); 172 172 hasLangs = true; 173 } 174 writer.write(NL); 175 if (c.getNumberOfRecords() != null) { 176 writer.write(c.getNumberOfRecords().toString()); 173 177 } 174 178 writer.write(NL); … … 281 285 } 282 286 corpus.setLanguages(langs); 283 } 287 } else if (lineCount == 6) { 288 corpus.setNumberOfRecords(Integer.parseInt(line)); 289 } 284 290 } 285 291 lineCount++; -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/cache/ScanCrawler.java
r5035 r5037 154 154 c.setHandle(term.getValue()); 155 155 c.setDisplayName(term.getDisplayTerm()); 156 c.setNumberOfRecords(term.getNumberOfRecords()); 156 if (term.getNumberOfRecords() > 0) { 157 c.setNumberOfRecords(term.getNumberOfRecords()); 158 } 157 159 addExtraInfo(c, term); 158 160 cache.addCorpus(c, parentCorpus); -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sopt/CorpusRendererCached.java
r4069 r5037 10 10 import org.zkoss.zul.Checkbox; 11 11 import org.zkoss.zul.DefaultTreeNode; 12 import org.zkoss.zul.Groupbox; 12 13 import org.zkoss.zul.Label; 13 14 import org.zkoss.zul.Treecell; … … 153 154 Treecell cell2 = createCellForCorpusLanguage(data); 154 155 dataRow.appendChild(cell2); 155 //Treecell cell6 = createCellForCorpusNumberOfRecords(data);156 //dataRow.appendChild(cell6);156 Treecell cell6 = createCellForCorpusNumberOfRecords(data); 157 dataRow.appendChild(cell6); 157 158 Treecell cell5 = createCellForCorpusInstitution(data); 158 159 dataRow.appendChild(cell5); … … 254 255 } 255 256 256 private Treecell createCellForCorpusLanguage(Corpus data) { 257 Treecell cell = new Treecell(); 258 if (!data.getLanguages().isEmpty()) { 257 // private Treecell createCellForCorpusLanguage(Corpus data) { 258 // Treecell cell = new Treecell(); 259 // if (!data.getLanguages().isEmpty()) { 260 // StringBuilder langs = new StringBuilder(); 261 // for (String lang : data.getLanguages()) { 262 // String langName = languages.nameForCode(lang); 263 // if (langName != null) { 264 // langs.append(langName); 265 // } else { 266 // langs.append(lang); 267 // } 268 // langs.append("\n "); 269 // 270 // } 271 // Label label = new Label(langs.toString()); 272 // label.setMultiline(true); 273 // label.setParent(cell); 274 // } else { 275 // Label label = new Label(""); 276 // label.setParent(cell); 277 // } 278 // return cell; 279 // } 280 281 private Treecell createCellForCorpusLanguage(Corpus data) { 282 Treecell cell = new Treecell(); 283 if (data.getLanguages().isEmpty()) { 284 Label label = new Label(""); 285 label.setParent(cell); 286 } else if (data.getLanguages().size() == 1) { 287 Label label = new Label(languages.nameForCode(data.getLanguages().iterator().next())); 288 label.setParent(cell); 289 } else { 290 Groupbox langPanel = new Groupbox(); 291 langPanel.setMold("3d"); 292 langPanel.setContentStyle("border:0"); 293 langPanel.setClosable(true); 294 langPanel.setOpen(false); 295 langPanel.setTitle("multiple"); 259 296 StringBuilder langs = new StringBuilder(); 260 297 for (String lang : data.getLanguages()) { … … 270 307 Label label = new Label(langs.toString()); 271 308 label.setMultiline(true); 272 label.setParent(cell); 273 } else { 274 Label label = new Label(""); 275 label.setParent(cell); 309 label.setParent(langPanel); 310 langPanel.setParent(cell); 311 276 312 } 277 313 return cell; … … 281 317 Treecell cell = new Treecell(); 282 318 if (data.getDescription() != null) { 283 //if (data.getDescription().length() > 40) { 284 // String descrStart = data.getDescription().substring(0, 35) + " ..."; 285 // Label label = new Label(descrStart); 286 // label.setTooltiptext(data.getDescription()); 287 // label.setParent(cell); 288 //} else { 319 int okLength = 125; 320 if (data.getDescription().length() > okLength) { 321 String descrStart = // data.getDescription().substring(0, 35) + " ..."; 322 getDisplayedText(data.getDescription(), okLength); 323 Label label = new Label(descrStart); 324 label.setTooltiptext(data.getDescription()); 325 label.setParent(cell); 326 } else { 289 327 Label label = new Label(data.getDescription()); 290 328 label.setMultiline(true); 291 329 label.setParent(cell); 292 //} 293 } else { 294 Label label = new Label(""); 295 label.setParent(cell); 296 } 297 298 return cell; 330 331 //ideally should contain html5 <details> element, but only 332 //chrome supports it as of now: 333 //<details> 334 //<summary>First sentence</summary> 335 //Rest sentences. 336 //</details> 337 338 339 } 340 } else { 341 Label label = new Label(""); 342 label.setParent(cell); 343 } 344 345 return cell; 346 } 347 348 private String getDisplayedText(String description, int okLength) { 349 int dotIndex = description.indexOf(" ", okLength); 350 if (dotIndex < 0 || dotIndex > okLength + 50) { 351 dotIndex = okLength; 352 } 353 return description.substring(0, dotIndex) + "..."; 299 354 } 300 355 } -
SRUAggregator/trunk/src/main/webapp/index.zul
r4106 r5037 14 14 <image src="img/clarindLogo.png"/> 15 15 <hlayout> 16 <textbox id="searchString" value="Elefant" focus="true"16 <textbox id="searchString" placeholder="Elefant" focus="true" 17 17 style="font-size:16px;margin:5px 0px 5px 10px;color:#0e4071;border: 1px solid #801418;width:468px;"/> 18 18 -
SRUAggregator/trunk/src/main/webapp/searchOptions.zul
r4067 r5037 1 1 <panel apply="eu.clarin.sru.fcs.aggregator.app.SearchOptions"> 2 2 <panelchildren 3 style="margin-top:10px;margin-left:10px;margin-right:10px;border:0; overflow:auto;">3 style="margin-top:10px;margin-left:10px;margin-right:10px;border:0;"> 4 4 5 5 <div align="center"> … … 29 29 contentStyle="border:0"> 30 30 <caption label="Corpora" style="border:0;"/> 31 31 32 <div style="text-align:right;"> 32 33 <button id="selectAll" label="Select All" image="img/buttonSelectAll.png" … … 35 36 sclass="ccsDarkBlue"/> 36 37 </div> 38 37 39 <tree id="tree" style="margin-top:2px;"> 38 40 <treecols sizable="true"> … … 40 42 <treecol label="" hflex="min"/> 41 43 <treecol label="Language" hflex="min"/> 42 < !--<treecol label="Records" hflex="min"/>-->44 <treecol label="Records" hflex="min"/> 43 45 <treecol id="instCol" label="Institution" hflex="min" sort="auto"/> 44 46 <treecol label="Description"/> 45 47 </treecols> 46 48 </tree> 49 47 50 </groupbox> 48 51 -
SRUAggregator/trunk/src/test/java/eu/clarin/sru/fcs/aggregator/app/ScanCrawlerTest.java
r5035 r5037 19 19 public class ScanCrawlerTest { 20 20 21 @Test22 public void testCrawlForMpiAndTue() {23 24 SRUThreadedClient sruClient = new SRUThreadedClient();25 26 try {27 EndpointUrlFilter filter = new EndpointUrlFilter();28 //filter.urlShouldContainAnyOf("leipzig", ".mpi.nl");29 filter.urlShouldContainAnyOf("uni-tuebingen.de", ".mpi.nl");30 //filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat.");31 ScanCrawler crawler = new ScanCrawler(new CenterRegistryLive(), sruClient, filter, 2);32 SimpleInMemScanCache cache = new SimpleInMemScanCache();33 crawler.crawl(cache);34 Corpus tueRootCorpus = cache.getRootCorporaOfEndpoint("http://weblicht.sfs.uni-tuebingen.de/rws/sru/").get(0);35 Corpus mpiRootCorpus = cache.getRootCorporaOfEndpoint("http://cqlservlet.mpi.nl/").get(0);36 Assert.assertEquals("http://hdl.handle.net/11858/00-1778-0000-0001-DDAF-D",37 tueRootCorpus.getHandle());38 Corpus mpiCorpus = cache.getCorpus("hdl:1839/00-0000-0000-0001-53A5-2@format=cmdi");39 Assert.assertEquals("hdl:1839/00-0000-0000-0003-4692-D@format=cmdi", cache.getChildren(mpiCorpus).get(0).getHandle());40 //check if languages and other corpus data is crawled corectly...41 Set<String> tueLangs = new HashSet<String>();42 tueLangs.add("deu");43 Assert.assertEquals(tueLangs, tueRootCorpus.getLanguages());44 String tueDescSubstring = "TÃŒbingen Treebank";45 Assert.assertTrue("Description problem", tueRootCorpus.getDescription().contains(tueDescSubstring));46 String tueNameSubstring = "TuebaDDC";47 Assert.assertTrue("Name problem", tueRootCorpus.getDisplayName().contains(tueNameSubstring));48 String tuePageSubstring = "sfs.uni-tuebingen.de";49 Assert.assertTrue("Landing page problem", tueRootCorpus.getLandingPage().contains(tuePageSubstring));50 Assert.assertTrue("Number of records problem", mpiRootCorpus.getNumberOfRecords() > 10);51 52 } finally {53 sruClient.shutdown();54 }55 56 }21 // @Test 22 // public void testCrawlForMpiAndTue() { 23 // 24 // SRUThreadedClient sruClient = new SRUThreadedClient(); 25 // 26 // try { 27 // EndpointUrlFilter filter = new EndpointUrlFilter(); 28 // //filter.urlShouldContainAnyOf("leipzig", ".mpi.nl"); 29 // filter.urlShouldContainAnyOf("uni-tuebingen.de", ".mpi.nl"); 30 // //filter.urlShouldContainAnyOf("dspin.dwds.de", "lindat."); 31 // ScanCrawler crawler = new ScanCrawler(new CenterRegistryLive(), sruClient, filter, 2); 32 // SimpleInMemScanCache cache = new SimpleInMemScanCache(); 33 // crawler.crawl(cache); 34 // Corpus tueRootCorpus = cache.getRootCorporaOfEndpoint("http://weblicht.sfs.uni-tuebingen.de/rws/sru/").get(0); 35 // Corpus mpiRootCorpus = cache.getRootCorporaOfEndpoint("http://cqlservlet.mpi.nl/").get(0); 36 // Assert.assertEquals("http://hdl.handle.net/11858/00-1778-0000-0001-DDAF-D", 37 // tueRootCorpus.getHandle()); 38 // Corpus mpiCorpus = cache.getCorpus("hdl:1839/00-0000-0000-0001-53A5-2@format=cmdi"); 39 // Assert.assertEquals("hdl:1839/00-0000-0000-0003-4692-D@format=cmdi", cache.getChildren(mpiCorpus).get(0).getHandle()); 40 // //check if languages and other corpus data is crawled corectly... 41 // Set<String> tueLangs = new HashSet<String>(); 42 // tueLangs.add("deu"); 43 // Assert.assertEquals(tueLangs, tueRootCorpus.getLanguages()); 44 // String tueDescSubstring = "TÃŒbingen Treebank"; 45 // Assert.assertTrue("Description problem", tueRootCorpus.getDescription().contains(tueDescSubstring)); 46 // String tueNameSubstring = "TuebaDDC"; 47 // Assert.assertTrue("Name problem", tueRootCorpus.getDisplayName().contains(tueNameSubstring)); 48 // String tuePageSubstring = "sfs.uni-tuebingen.de"; 49 // Assert.assertTrue("Landing page problem", tueRootCorpus.getLandingPage().contains(tuePageSubstring)); 50 // Assert.assertTrue("Number of records problem", mpiRootCorpus.getNumberOfRecords() > 10); 51 // 52 // } finally { 53 // sruClient.shutdown(); 54 // } 55 // 56 // } 57 57 }
Note: See TracChangeset
for help on using the changeset viewer.