ʹÓÃJena½«±¾Ìå´æÈëMySQL——ÎĵµºÍÀý×Ó
iMarine http://iMarine.blog.163.com
×¢Ã÷£º±¾Îĵµ²Î¿¼Jena 2.5Îĵµ£¬Ê¹ÓÃJena 2.5 APIºÍMySQL 5.0.4-beta-ntÊý¾Ý¿â¡£MySQLÇý¶¯°üʹÓõÄÊÇmysql-connector-java-3.1.10-bin.jar¡£
1 JenaµÄÊý¾Ý¿â½Ó¿Ú
JenaÌṩÁ˽«RDFÊý¾Ý´æÈë¹ØϵÊý¾Ý¿âµÄ½Ó¿Ú£¬Model¡¢Resource¡¢QueryµÈ½Ó¿Ú¿ÉÒÔÓÃÓÚ·ÃÎʺÍά»¤Êý¾Ý¿âÀïµÄRDFÊý¾Ý¡£ÔÚ´¦ÀíÊý¾Ýʱ£¬Ó¦ÓóÌÐò²»±ØÖ±½Ó²Ù×÷Êý¾Ý¿â£¨¶øÊÇͨ¹ýJenaµÄAPI£©£¬Ò²²»±ØÖªµÀÊý¾Ý¿âµÄģʽ¡£
JenaÌṩÁËÖ§³ÖMySQL¡¢HSQLDB¡¢PostgreSQ¡¢OracleºÍMicrosoft SQL ServerµÄ³ÌÐò½Ó¿Ú¡£ÓÐЩµÚÈý·½ÌṩÆäËûÊý¾Ý¿â½Ó¿ÚµÄÖ§³Ö¡£¿ÉÒԲο¼JenaÊý¾Ý¿âÎĵµ»ñµÃÊý¾Ý¿â°æ±¾ÒÔ¼°¶ÔÓ¦µÄJDBCÇý¶¯ËµÃ÷¡£
2 JenaµÄÊý¾Ý¿âģʽ
¹ØϵÊý¾Ý¿â´æ´¢RDFÊý¾ÝµÄÒ»°ãģʽÊÇ“ÈýÔª×锣¬±íÓÐÈýÁУ¨Ö÷Ì塢ν´Ê¡¢¿ÍÌ壩ÿ¸öRDF³ÂÊö£¨sataement£©Õ¼ÓÃÒ»ÐС£ÓÐʱºò£¬Ìí¼ÓµÚËÄÁÐÒÔ±íʾ¿ÍÌåÊÇ×Ö·û³£Á¿»¹ÊÇURI¡£
Jena 2²ÉÓÃÒ»ÖÖdenormalizedµÄÈýÔª×é´æ´¢·½·¨£¬ÊÇ´æ´¢¿Õ¼äºÍ·ÃÎÊʱ¼äµÄÒ»ÖÖȨºâ·½·¨£¨a space-time trade-off£©¡£JenaʹÓÃÁ½ÀàÆ߸ö±í´æ´¢±¾Ì壬µÚÒ»ÀàÊÇasserted statements£¬µÚ¶þÀàreified statements¡£
Statement Tables ³ÂÊö±í
1) Asserted Statement Table (Jena_GiTj_Stmt)£º´æ´¢±¾ÌåÊý¾Ý
2) Reified Statement Table (Jena_GiTj_Reif)£º¾¹ý´¦ÀíµÄ±¾ÌåÊý¾Ý
System Tables ϵͳ±í£º´æ´¢ÔªÊý¾ÝºÍ³ÂÊö±íÖÐʹÓõĽϳ¤µÄÎÄ×Ö»òÕß×ÊÔ´
3) System Statement Table (Jena_Sys_Stmt)£º´æ´¢ÏµÍ³ÔªÊý¾Ý
4) Long Literals Table (Jena_Long_Lit)£º´æ´¢³ÂÊö±íÖв»±ãÓÚÖ±½Ó´æ´¢µÄ³¤×Ö·û´´³£Á¿£¨Literals£©
5) Long Resources Table (Jena_Long_URI)£º´æ´¢³ÂÊö±íÖв»±ãÓÚÖ±½Ó´æ´¢µÄ³¤×ÊÔ´URI
6) Prefixes Table (Jena_Prefix)£º´æ´¢URIµÄǰ׺¡£Ç°×ºÖ»´æ´¢Ò»´Î£¬½ÚÊ¡¿Õ¼ä¡£
7) Graph Table (Jena_Graph)£º´æ´¢Ã¿Ò»¸öÓû§Í¼µÄÃû×ÖºÍΨһ±êÖ¾·û¡£
8) Lock Table (Jena_Mutex)£ºÒ»¸öûÓÐÄÚÈÝµÄ±í¡£Èç¹û¸Ã±í´æÔÚ£¬ÔÚÒ»¶¨Ê±¼ä¶ÎÀï
Ïà¹ØÎĵµ£º
½ñÌì¸ãÁËÒ»Ì죬ÖÕÓڸ㶨ÁË¡£
¶ÔÓÚMysqlÓÐÁ½ÖÖģʽ£¬MYISAMÓëINNODB
Èç¹ûÊÇMYISAMµÄ»°£¬ÔÚdataĿ¼ÏÂÀï»á.frm .myd .myi ÈýÖÖÎļþ£¬ÄÇôֱ½Ó°ÑDATAÒƹýÈ¥£¬ÅäÖúÃȨÏ޾ͿÉÒÔ»¹ÔÁË¡£
Èç¹ûÊÇINNODBµÄ»°£¬ÄÇÊÇÏ൱µÄ·³°¡¡£ÔÚdataĿ¼ÏÂÖ»ÓÐ.frm(ÕâÖ»ÊÇÒ»¸öÊý¾Ý¸ñʽ£©£¬Õâ¸öÒƹýÈ¥ºó£¬ÊÇÎÞ·¨»¹ÔÔʼÊý¾ÝµÄ¡£
ÕæÕýµÄÊý¾ÝÊÇÕ ......
information_schema¿âÖаüº¬Á˶ÔÕû¸öÊý¾Ý¿âµÄºÜ¶àͳ¼ÆÐÅÏ¢£¬¿ÉÒÔͨ¹ý²é¿´ËüÃÇ£¬À´µÃµ½Êý¾Ý¿âÏà¹ØµÄÐÅÏ¢¡£
mysql> use information_schema;
Database changed
mysql> select count(1) as tables, concat(round(sum(table_rows)/1000000,2),'M') as rows, concat(round(sum(data_length)/(1024*1024*1024),2),'G') a ......
½â¾ö·½·¨£º
1¡¢¹Ø±ÕÊý¾Ý¿âÁ¬½Ó;
2¡¢ÓÒ»÷Êý¾Ý¿âÑ¡Ôñ“Á¬½ÓÊôÐÔ”£»
3¡¢Ñ¡Ôñ“¸ß¼¶”ÊôÐÔÒ³£¬½«“ʹÓÃMySQL×Ö·û¼¯”µÄ¹´È¥µô£¬²¢Ñ¡Ôñ“±àÂë”Ϊ“936 (ANSI/OEM - Simplified Chinese GBK)”
4¡¢¹Ø±Õ±£´æ£¬ÖØÐÂÁ¬½Ó¡£ ......
MYSQL Ó¦ÓÃÊ®·Ö¹ã·¶£¬ºÜ¶àÍøÕ¾¼¸ºõ¶¼ÔÚÓÃËû£¬ÒòΪËûµÄСÇɺÍÁé»îÐԵȷ½ÃæÈÃÎÒ¾ö¶¨Òª¶ÔËû½øÐÐÑо¿£¬µ½ÏÖÔÚÒѾ³É¹¦µÄ²»Óþ¹ýODBC£¬ADOµÈ·½Ê½¾Í¿ÉÒÔ¶ÁÈ¡ºÍ¸üÐÂÊý¾Ý¡£
ºÃÁ˲»¶àÂÞ࣬ÒÔÏÂÎÒÀ´½éÉÜ×ܸö³ÌÐòµÄϸ½Ú:
£¨Ò»£©APIÉùÃ÷
1. '·ÖÅä»ò³õʼ»¯ÊʺÏmysql_real_connect()µÄÒ»¸öMYSQL¶ÔÏñ¡ ......
1.ͨ¹ýÐÞ¸ÄMYSQLÊý¾Ý¿âÖÐMYSQL¿âµÄUSER±í
¾ÍÓÃÆÕͨµÄUPDATE¡¢INSERTÓï¾ä¾Í¿ÉÒÔ
use mysql
update user set Password=password('newpassword') where User='root';
flush privileges;
£¨Õâ¸öÇ××ÔʵÑé¹ý£¬¿ÉÒÔÖ´ÐУ¡£©
2.ÔÚÃüÁîÐÐÖÐʹÓÃÈçÏÂÃüÁî
&nbs ......