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 = "./crawleddata/";
|
---|
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(File data) throws Exception{
|
---|
23 | StructureCrawler sc = new StructureCrawler(data);
|
---|
24 | acquiredRDFFiles = sc.getAcquiredStructureFiles();
|
---|
25 | }
|
---|
26 |
|
---|
27 | public String[] getEndpointURIList(){
|
---|
28 | if( acquiredRDFFiles == null ){
|
---|
29 | return new String[0];
|
---|
30 | }else{
|
---|
31 | return acquiredRDFFiles.keySet().toArray(new String[0]);
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | public RDFSchemaAnalyzer create(String uri) throws Exception{
|
---|
36 | if( acquiredRDFFiles == null || !acquiredRDFFiles.containsKey(uri)){
|
---|
37 | return new EndpointAnalyzer(uri);
|
---|
38 | }else{
|
---|
39 | JenaModelGenerator jmGene = new JenaModelGenerator(acquiredRDFFiles.get(uri));
|
---|
40 | return new AcquiredStructureAnalyzer(jmGene.getEndpointURI(), jmGene.getGraphURIs(), jmGene.getModel());
|
---|
41 | }
|
---|
42 | }
|
---|
43 | }
|
---|