我正在尝试使用D2RQ(在Mac上)将MySQL数据库从MAMP转换为RDF图。我已经解压缩了d2rq服务器,我从终端运行了生成映射工具,如下所示:
sh generate-mapping -o mapping.ttl -u root -p passw jdbc:mysql://localhost/eurocup
但是它提示错误,说它无法连接到数据库:
Database connection to jdbc:mysql://localhost/eurocup failed (user: root): Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (E54)
任何人都可以帮我解决这个问题吗?我是RDF和整个语义网的新手,甚至是命令行。建议将SQL数据库(或转储)转换为RDF图的另一种方法是欢迎!
答案 0 :(得分:0)
使用D2RQ命令在mysqldb中生成映射文件和RDF。
脚本命令语法:
./generate-mapping -u userName -p Password -o /mapping file save path directory/fileName.ttl mysqldriver/databaseName
示例:强>
./generate-mapping -u root -p root -o /home/bigtapp/Documents/d2rqgenerate_mapping/mapfile.ttl jdbc:mysql://localhost:3306/d2rq
用户名密码:u root -p root -o 文件保存路径:/home/tapp/Documents/d2rqgenerate_mapping/mapfile.ttl sql驱动程序:jdbc:mysql:// localhost:3306 / d2rq 这里d2rq:databasename
RDF创建命令:
dump-rdf -f RDF/XML -b localhost:3306 -o /home/tapp/Documents/d2rqgenerate_mapping/dumpfile.rdf /home/bigtapp/Documents/d2rqgenerate_mapping/mapfile.ttl