使用 pgAdmin-4 导入 yago sql 导入器?

问题描述

嗨,我正在尝试使用 pgAdmin 4 的查询工具将 sql 文件 yago Database Importer 导入。

sql文件是这样的我在sql文件添加tsv文件的路径

-- Creating table
DROP TABLE IF EXISTS yagoFacts;
CREATE TABLE yagoFacts (id varchar,subject varchar,predicate varchar,object varchar,value float);

-- Loading files
-- (don't worry if some files are not found)
SET client_encoding to 'utf-8';
\copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12/Postgres/yagoDateFacts.tsv' NULL AS ''
\copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12/Postgres/yagoFacts.tsv' NULL AS ''
\copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12/Postgres/yagoLabels.tsv' NULL AS ''
\copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12/Postgres/yagoLiteralFacts.tsv' NULL AS ''



 
-- Remove facts on which we cannot build the index
DELETE FROM yagofacts WHERE length(object)>1000;

-- Creating indexes
CREATE INDEX yagoIndexSubject ON yagoFacts(subject);
CREATE INDEX yagoIndexObject ON yagoFacts(object);
CREATE INDEX yagoIndexValue ON yagoFacts(value);
CREATE INDEX yagoIndexPredicate ON yagoFacts(predicate);
CREATE INDEX yagoIndexId ON yagoFacts(id);
CREATE INDEX yagoIndexSubjectPredicate ON yagoFacts(subject,predicate);
CREATE INDEX yagoIndexObjectPredicate ON yagoFacts(object,predicate);
CREATE INDEX yagoIndexValuePredicate ON yagoFacts(value,predicate);

-- Creating index for case-insensitive search
-- (you may abort the script if you don't need this index) 
CREATE INDEX yagoIndexLowerObject ON yagofacts (lower(object));
-- done

代码给了我这个错误

ERROR:  Syntax error at or near "\"
LINE 18: \copy yagoFacts FROM 'yagoGeonamesGlosses.tsv' NULL AS '';
         ^
sql state: 42601
Character: 549

我尝试在复制语句之前删除 \ 并出现此错误

ERROR:  Syntax error at or near "copy"
LINE 9: copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12...
        ^
sql state: 42601
Character: 348

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)