Skip to content

Commit

Permalink
Merge branch 'master' into Production
Browse files Browse the repository at this point in the history
  • Loading branch information
jezekp committed Sep 30, 2016
2 parents 96f6393 + bbdb7f7 commit b6553ce
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class SimpleSemanticFactory implements InitializingBean, ApplicationConte
private Log log = LogFactory.getLog(getClass());
private ApplicationContext context;
private List<GenericDao> gDaoList = new ArrayList<GenericDao>();
private List<Object> dataList = new ArrayList<Object>();
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);

private File ontologyFile; // temporary ontology document
Expand Down Expand Up @@ -180,13 +179,15 @@ public InputStream getOntologyOwlApi(String syntax) throws IOException,
/**
* Loads date for transforms POJO object to resouces of semantic web.
*/
private void loadData() {
private List<Object> loadData() {
List<Object> dataList = new ArrayList<Object>();
ElasticSynchronizationInterceptor elasticSynchronizationInterceptor = context.getBean(ElasticSynchronizationInterceptor.class);
elasticSynchronizationInterceptor.setLoadSemantic(true);
for (GenericDao gDao : gDaoList) {
dataList.addAll(gDao.getAllRecords());
}
elasticSynchronizationInterceptor.setLoadSemantic(false);
return dataList;
}


Expand Down Expand Up @@ -218,8 +219,8 @@ public void transformModel() {
OutputStream out;

try {
loadData();
jbe = creatingJenaBean();
List<Object> dataList = loadData();
jbe = creatingJenaBean(dataList);
lock.writeLock().lock();
out = new FileOutputStream(ontologyFile);
jbe.writeOntologyDocument(out, Syntax.RDF_XML);
Expand All @@ -241,7 +242,7 @@ public void transformModel() {
* Creates an instance of JenaBeanExtension with loaded model.
* @return instance of JenaBeanExtension
*/
private JenaBeanExtension creatingJenaBean() {
private JenaBeanExtension creatingJenaBean(List<Object> dataList) {
JenaBeanExtension jbe = new JenaBeanExtensionTool();
try {
jbe.loadStatements(ontologyHeader.getInputStream(), Syntax.RDF_XML_ABBREV);
Expand Down

0 comments on commit b6553ce

Please sign in to comment.