Good morning, I am working with Jena SDB and OSGI, developing with Eclipse and Bnd Tools plugin.
I want to execute a Jena rule and include infModel to JenaSDB Model, but It doesn't work in a REST service using OSGI. I have tested the code and it's works well if I don't use this in a OSGI bundle ... I've create OSGI bundle for this versions of jars: com.mysql.jdbc-5.1.22.jar slf4j.log4j12-1.6.4.jar xml-apis-1.4.1.jar xercesImpl-2.10.0.jar com.ibm.icu-54.1.1.jar com.hp.hpl.jena.iri-0.8.0.jar com.hp.hpl.jena.jena-2.6.4.jar com.hp.hpl.jena.arq-2.8.7.jar org.apache.jena.jena-iri-0.9.6.jar com.hp.hpl.jena.sdb-1.3.4.jar org.apache.jena.jena-core-2.7.4.jar Any help, idea ? The jena rule is very simple: @prefix places: http://purl.org/ontology/places# @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix owl2: <http://www.w3.org/2006/12/owl2#>. @prefix owl: <http://www.w3.org/2002/07/owl#>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. [AddingContinent: ->(places:XXX rdf:type places:Continent)] I have this code: Model modelSDB = null; InfModel owlInfModel = null; InfModel rulesInfModel = null; modelSDB = jenaSDBConector.loadModelSDB(databaseName); File file = new File(System.getProperty("java.io.tmpdir", null),"jena.rules"); try{ if (!file.exists()) { file.createNewFile(); } }catch(Exception e){ System.out.println(e.getMessage()); } // get the content in bytes byte[] contentInBytes = jenaRule.getBytes(); FileOutputStream fop = new FileOutputStream(file); fop.write(contentInBytes); fop.flush(); fop.close(); Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); owlInfModel = ModelFactory.createInfModel(reasoner, modelSDB); Resource conf = modelSDB.createResource(); conf.addProperty(ReasonerVocabulary.PROPruleMode, "forwardRETE"); conf.addProperty(ReasonerVocabulary.PROPruleSet, "/tmp/" + "jena.rules"); reasoner = GenericRuleReasonerFactory.theInstance().create(conf); rulesInfModel = ModelFactory.createInfModel(reasoner, modelSDB); rulesInfModel.prepare(); Model deductionModel = rulesInfModel.getDeductionsModel(); -> DEDUCTION MODEL IS EMPTY !!!!!!??????? StmtIterator i = deductionModel.listStatements(); while (i.hasNext()) { System.out.println(" - " + i.nextStatement() + "\n"); } modelSDB.add(rulesInfModel); modelSDB.commit(); bResult=true; Thanks in advance Urtza Iturraspe OPTIMA - Optimization Modelling & Analytics Area ICT - European Software Institute Division TECNALIA Parque Tecnológico de Bizkaia, Edificio 202 E-48170 Zamudio (Spain) mov.: 664 00 21 51 tel.: 902 760 002 / 946 430 850 (International calls) [email protected]<mailto:[email protected]> www.tecnalia.com<http://www.tecnalia.com/>
