ʹÓÃ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)£ºÒ»¸öûÓÐÄÚÈÝµÄ±í¡£Èç¹û¸Ã±í´æÔÚ£¬ÔÚÒ»¶¨Ê±¼ä¶ÎÀï
Ïà¹ØÎĵµ£º
1¡¢ÔÚ¿ØÖÆִ̨ÐÐ mysql -u root -p mysql£¬ÏµÍ³ÌáʾÊäÈëÊý¾Ý¿ârootÓû§µÄÃÜÂ룬ÊäÈëÍê³Éºó¼´½øÈëmysql¿ØÖÆ̨£¬Õâ¸öÃüÁîµÄµÚÒ»¸ömysqlÊÇÖ´ÐÐÃüÁµÚ¶þ¸ömysqlÊÇϵͳÊý¾ÝÃû³Æ£¬²»Ò»ÑùµÄ¡£
2¡¢ÔÚmysql¿ØÖÆִ̨ÐÐ GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyPassword' WITH GRANT OPTION;
3¡¢ÔÚmysql¿ØÖÆ ......
½â¾ö·½·¨£º
1¡¢¹Ø±ÕÊý¾Ý¿âÁ¬½Ó;
2¡¢ÓÒ»÷Êý¾Ý¿âÑ¡Ôñ“Á¬½ÓÊôÐÔ”£»
3¡¢Ñ¡Ôñ“¸ß¼¶”ÊôÐÔÒ³£¬½«“ʹÓÃMySQL×Ö·û¼¯”µÄ¹´È¥µô£¬²¢Ñ¡Ôñ“±àÂë”Ϊ“936 (ANSI/OEM - Simplified Chinese GBK)”
4¡¢¹Ø±Õ±£´æ£¬ÖØÐÂÁ¬½Ó¡£ ......
¸Õ¸Õ°²×°Íêmysqlºó
´ÓcmdÖнøÈëmysqlÊý¾Ý¿â
ÃüÁîÐÐÖÐÊäÈ룺
mysql -uroot -p123
½øÈëmysqlÊý¾Ý¿âÖÐ
ÃüÁîÐÐÖÐÊäÈë:
status;
²é¿´µ±Ç°Êý¾Ý¿âÖеıàÂë
ÈçÏ£º
--------------
mysql Ver 14.12 Distrib 5.1.7-beta, for Win32 (ia32)
Connection id: &nb ......
°²×°ºó
/etc/init.d/mysql start (stop) ΪÆô¶¯ºÍÍ£Ö¹·þÎñÆ÷
/etc/mysql/ Ö÷ÒªÅäÖÃÎļþËùÔÚλÖà my.cnf
/var/lib/mysql/ ·ÅÖõÄÊÇÊý¾Ý¿â±íÎļþ¼Ð£¬ÕâÀïµÄmysqlÏ൱ÓÚwindowsÏÂmysqlµÄdateÎļþ¼Ð
Æô¶¯mysqlºó£¬ÒÔrootµÇ¼mysql
isher@isher-ubuntu:~$ mysql -u root
>show variables like 'character%'; #Ö´ÐбàÂëÏ ......
MYSQL »ñÈ¡µ±Ç°ÈÕÆÚ¼°ÈÕÆÚ¸ñʽ
»ñȡϵͳÈÕÆÚ£º NOW()
¸ñʽ»¯ÈÕÆÚ£º DATE_FORMAT(date, format)
×¢£º date£ºÊ±¼ä×Ö¶Î
  ......