The following articles mainly introduce how to use Jena to save the ontology file to the MySQL database.
The following articles mainly introduce how to use Jena to save the ontology file to the MySQL database.
Yesterday it was configured for a day, its configuration is Jena 2.4.0, MySQL database version is 5.1.42-community, JDK version is 1.6.0, MySQLdriver is mysql-connector-java-3.1.14;
An example is written according to the resources on the network, and a problem occurs.
Create a model maker using database connection Parameters
ModelMaker maker = ModelFactory. createModelRDBMaker (conn );
Create a default model named MyOntology
Model defModel = maker. createModel ("MyOntology ");
You cannot create a model from maker. createModel;
Then I wrote some debug debugging. One is to use the java interface to access mysql. The test is successful, indicating that there is no error in connectivity between java and mysql. Then the problem occurs on Jena;
Then update Jena to version 2.6 to locate the problem.
TIPS:
After doing this research, we found that the most common problem with using these open-source software and APIS is the version compatibility. We have encountered the compatibility problem between Protege and graphviz versions before, in addition, it often takes a long time to encounter such a problem, because the first suspect object is often the person who knows little about it.
The above content is an introduction to using Jena to save the ontology file to the MySQL database. I hope you will gain some benefits.
The above content describes how to use Jena to store the ontology file into the MySQL database. I hope it will help you in this regard.