Hi, i'm having some trouble on trying to use TDB with an owl ontology schema
from Protégé.
I success on using this file for adding and requesting individuals and saving
model + datas together.
I'm now trying to create a TDB repository and using it with my model to
separate the model from the datas.
I'm able to initialize and adding FOAF individuals to the model
and I was expecting the modifications to be flush to the TDBrepository after
committing the model.
But, I found that other class than FOAF one couldn't be found so, I guess my
model isn't really used.
Requesting the model with an Ask request on FOAF individuals give me no result.
if someone could give me a hand on this problem , I'll appreciate.
Thanks
Regards
Wilfrid
Here's my code :
TDB and Model initializing
OntModelSpec model_CP_Spec=OntModelSpec.OWL_DL_MEM;
Reasoner reasonner_CP=ReasonerRegistry.getOWLReasoner();
OntModelSpec model_CP_Spec.setReasoner(reasonner_CP);
Model schemaModel=FileManager.get().loadModel(getInputFileBASE());
Model OntModel
schema=ModelFactory.createOntologyModel(model_CP_Spec,schemaModel);
Location location=new Location(getPathTDB_DATASET));
Dataset datasetCP=TDBFactory.createDataset(location);
Model model=datasetCP.getDefaultModel();
OntModelmodel_CP=ModelFactory.createOntologyModel(model_CP_Spec, model);
Adding instance to model_CP :
Singleton.model_CP.begin();
OntClass Person = Singleton.model_CP.getOntClass(Singleton.nsCP.basePersonURI);
Individual person = Singleton.model_CP.createIndividual(
Singleton.nsCP.nsFOAF + "PERS_" + UIID , Person );
if(person!=null){
Resource personRessource =
Singleton.model_CP.getResource(Singleton.nsCP.nsFOAF + "PERS_" + UIID);
Singleton.model_CP.add (personRessource, FOAF.firstName, firstname);
Singleton.model_CP.add (personRessource, FOAF.family_name,
family_name);
Singleton.model_CP.commit();
}
AskRequest to model :
Singleton.model_CP.begin();
QueryExecution qe =
QueryExecutionFactory.create(prefix+query_sparql,Singleton.model_CP);
boolean b=qe.execAsk();
Singleton.model_CP.commit();
_________________________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations
confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou
falsifie. Merci.
This message and its attachments may contain confidential or privileged
information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete
this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been
modified, changed or falsified.
Thank you.