1 | package org.biohackathon.SPARQLBuilder.OWL;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 | import java.util.HashMap;
|
---|
5 | import java.util.Map;
|
---|
6 |
|
---|
7 | import org.biohackathon.SPARQLBuilder.endpointMetadata.MetadataFile;
|
---|
8 | import org.biohackathon.SPARQLBuilder.endpointMetadata.MetadataManager;
|
---|
9 |
|
---|
10 | import jp.riken.accc.db.rdf.crawler.dataStructure.sparql.JenaModelGenerator;
|
---|
11 |
|
---|
12 | public class RDFSchemaAnalyzerFactory {
|
---|
13 |
|
---|
14 | private MetadataManager metadataManager = null;
|
---|
15 | // private Map<String, String> acquiredRDFFiles = null;
|
---|
16 | private static final String FILENAME = "C:\\cdata";
|
---|
17 |
|
---|
18 | public RDFSchemaAnalyzerFactory(String fileName){
|
---|
19 | try{
|
---|
20 | metadataManager = new MetadataManager(fileName);
|
---|
21 | // setAcqiredRDFFiles(new File(fileName));
|
---|
22 | }catch(Exception e){
|
---|
23 | System.err.println(e);
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | public RDFSchemaAnalyzerFactory(){
|
---|
28 | try{
|
---|
29 | metadataManager = new MetadataManager(FILENAME);
|
---|
30 | // setAcqiredRDFFiles(new File(FILENAME));
|
---|
31 | }catch(Exception e){
|
---|
32 | System.err.println(e);
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | // private void setAcqiredRDFFiles(String dirFile) throws Exception{
|
---|
37 | // setAcqiredRDFFiles(new File(dirFile));
|
---|
38 | // }
|
---|
39 |
|
---|
40 | // private void setAcqiredRDFFiles(File data) throws Exception{
|
---|
41 | // StructureCrawler sc = new StructureCrawler(data);
|
---|
42 | // acquiredRDFFiles = sc.getAcquiredStructureFiles();
|
---|
43 | // }
|
---|
44 |
|
---|
45 | public String[] getEndpointURIList(){
|
---|
46 | return metadataManager.getURIList();
|
---|
47 | }
|
---|
48 |
|
---|
49 | public MetadataFile[] getMetadataFiles(){
|
---|
50 | return metadataManager.getMetadataFiles();
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | public RDFSchemaAnalyzer create(String uri) throws Exception{
|
---|
55 | MetadataFile mFile = metadataManager.getMetadataFile(uri);
|
---|
56 | if( mFile == null ){
|
---|
57 | return new EndpointAnalyzer(uri);
|
---|
58 | }else{
|
---|
59 | JenaModelGenerator jmGene = new JenaModelGenerator(mFile.getFilePath());
|
---|
60 | return new AcquiredStructureAnalyzer(jmGene.getEndpointURI(), jmGene.getGraphURIs(), jmGene.getModel());
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|