| 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 jp.riken.accc.db.rdf.crawler.dataStructure.sparql.JenaModelGenerator;
|
|---|
| 8 |
|
|---|
| 9 | public class RDFSchemaAnalyzerFactory {
|
|---|
| 10 |
|
|---|
| 11 | private Map<String, String> acquiredRDFFiles = null;
|
|---|
| 12 | private static final String FILENAME = "cdata/";
|
|---|
| 13 |
|
|---|
| 14 | public RDFSchemaAnalyzerFactory(){
|
|---|
| 15 | try{
|
|---|
| 16 | setAcqiredRDFFiles(new File(FILENAME));
|
|---|
| 17 | }catch(Exception e){
|
|---|
| 18 | System.err.println(e);
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | private void setAcqiredRDFFiles(String dirFile) throws Exception{
|
|---|
| 23 | setAcqiredRDFFiles(new File(dirFile));
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | private void setAcqiredRDFFiles(File data) throws Exception{
|
|---|
| 27 | StructureCrawler sc = new StructureCrawler(data);
|
|---|
| 28 | acquiredRDFFiles = sc.getAcquiredStructureFiles();
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | public String[] getEndpointURIList(){
|
|---|
| 32 | if( acquiredRDFFiles == null ){
|
|---|
| 33 | return new String[0];
|
|---|
| 34 | }else{
|
|---|
| 35 | return acquiredRDFFiles.keySet().toArray(new String[0]);
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | public RDFSchemaAnalyzer create(String uri) throws Exception{
|
|---|
| 40 | if( acquiredRDFFiles == null || !acquiredRDFFiles.containsKey(uri)){
|
|---|
| 41 | return new EndpointAnalyzer(uri);
|
|---|
| 42 | }else{
|
|---|
| 43 | JenaModelGenerator jmGene = new JenaModelGenerator(acquiredRDFFiles.get(uri));
|
|---|
| 44 | return new AcquiredStructureAnalyzer(jmGene.getEndpointURI(), jmGene.getGraphURIs(), jmGene.getModel());
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|