チェンジセット 269 : SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/endpointMetadata/MetadataManager.java
- 更新日時:
- 2016/03/14 20:01:59 (9 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/endpointMetadata/MetadataManager.java
r267 r269 5 5 import java.util.Set; 6 6 7 import jp.riken.accc.db.sparqlBuilderMetadata.crawler.dataStructure.sparql.crawler.CrawledMetadata; 8 import jp.riken.accc.db.sparqlBuilderMetadata.crawler.dataStructure.sparql.crawler.CrawledMetadataFileReader; 9 7 10 public class MetadataManager { 8 11 9 HashMap<String, MetadataFile> metadataTable = null;12 HashMap<String,CrawledMetadata> metadataTable = null; 10 13 11 14 /* … … 22 25 }*/ 23 26 24 public MetadataFile[] getMetadataFiles(){25 return metadataTable.values().toArray(new MetadataFile[0]);27 public CrawledMetadata[] getCrawlerMetadataList(){ 28 return metadataTable.values().toArray(new CrawledMetadata[0]); 26 29 } 27 public MetadataFile getMetadataFile(String uri){30 public CrawledMetadata getCrawledMetadata(String uri){ 28 31 return metadataTable.get(uri); 29 32 } … … 41 44 42 45 public void init(String metadataDirStr) throws Exception{ 43 metadataTable = new HashMap<String, MetadataFile>();46 metadataTable = new HashMap<String,CrawledMetadata>(); 44 47 File metadataDir = new File(metadataDirStr); 45 48 File[] files = null; … … 58 61 } 59 62 for(File file: files){ 60 MetadataFile metadataFile= null;63 CrawledMetadata crawledMetadata = null; 61 64 try{ 62 metadataFile = new MetadataFile(file);63 String uri = metadataFile.getEndpointURI();65 crawledMetadata = CrawledMetadataFileReader.readFile(file.getCanonicalPath()); 66 String uri = crawledMetadata.getEndpointURI(); 64 67 if( uri != null ){ 65 68 if( metadataTable.containsKey(uri)){ 66 MetadataFiletempMF = metadataTable.get(uri);67 if(tempMF.get EndDateTime().before(metadataFile.getEndDateTime()) ){69 CrawledMetadata tempMF = metadataTable.get(uri); 70 if(tempMF.getDefaultDataset().getCrawlLog().crawlEndTime.before(crawledMetadata.getDefaultDataset().getCrawlLog().crawlEndTime) ){ 68 71 metadataTable.remove(uri); 69 metadataTable.put(uri, metadataFile);72 metadataTable.put(uri, crawledMetadata); 70 73 } 71 74 }else{ 72 metadataTable.put(uri, metadataFile);75 metadataTable.put(uri, crawledMetadata); 73 76 } 74 77 }