Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

postgresql - importing yago sql importer with pgAdmin-4?

Hi im trying to import the yago Database Importer which is an SQL file into using pgAdmin 4's query tool.

the SQL file look like this I added the path of tsv files in the SQL file

-- 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

the code gives me this error

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

I try to remove the before the copy statement and this error appeared

ERROR:  syntax error at or near "copy"
LINE 9: copy yagoFacts FROM 'E:/Master/NLP/project/iaprtc12/iaprtc12...
        ^
SQL state: 42601
Character: 348
question from:https://stackoverflow.com/questions/65883340/importing-yago-sql-importer-with-pgadmin-4

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...