首先要安装好MySQL服务器,然后建立一个数据库,如OntologyDB。再建立一个用户如OntologyDBUser,并给予其对数据库OntologyDB的所有操作权限。然后下载MySQL的JDBC驱动程序mysql-connector-java-3.1.12.zip,解压后将其中的mysql-connector-java-3.1.12-bin.jar改名为Driver.jar并将其COPY到Protege 3.1的安装目录中。
进入Protege,打开本体工程文件,然后选择文件菜单中的Convert Project to Format,选择在弹出的对话框中选择OWL Database。然后在弹出的对话框中按如下内容填写:
Project ---- 项目名称,自己定;
JDBC Driver Class Name ---- com.mysql.jdbc.Driver
JDBC URL ---- jdbc:mysql://localhost/OntologyDB
Table ---- OntologyDB数据库中用于存储本体的表,如OntologyTable
Username ---- OntologyDBUser
Password ---- OntologyDBUser
OK以后本体就存储到MySQL中了,可以打开Query Browser看一下。表中每个Column均为Protege预定义,其含义如下(来自http://protege.stanford.edu/doc/design/jdbc_backend.html):
Column
Description
Can be null
Can be empty
frame
[integer]
frame id Frame ID's < 10000 are reserved for the system. The frame ids for system frames are declared in the file: edu.stanford.smi.protege.model.Model.java
No
No
frame_type
[smallint]
same as "value_type" but for the frame column
No
No
slot
[integer]
slot frame id
No
No
facet
[integer]
facet frame id (0 if not a facet value)
No
No
is_template
[smallint]
0 => value is OKBC "own", 1 => value is OKBC "template"
No
No
value_index
[integer]
number used to maintain relative ordering of slot_or_facet_value entries for a frame-slot(-facet) combination
No
No
value_type
[smallint]
number used to indicate the "type" of the value stored in slot_or_facet_value. The number-to-type conversion is given in the file: edu.stanford.smi.protege.storage.database.DatabaseUtils.java
No
No
slot_or_facet_value
[varchar(N)]
facet value if facet is not 0, slot value otherwise. Holds values of length that will fit in a varchar (typically <= 255)
Yes
No
long_slot_or_facet_value
[longvarchar]
same as slot_or_facet_value but holds values too long to fit in slot_or_facet_value
Yes
No