我正在尝试将RDF文件导入AllegroGraph tripple-store,但我不断收到此错误:
Import failed: MALFORMED DATA: [in Sax parser]
parse of #<file-simple-stream #P"/tmp/agwebview-upload-EoncCgvalid.xml"
for input pos 3 @ #x100413feb2> failed filename nil, position 1
我的文件名为“valid.xml”应该有效,因为它来自http://rdf.freebase.com/rdf/venture_capital.views.investment_round 我在开头添加了这个:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:fb="http://www.my.com/site"
xmlns:xhtml="http://www.my.com/xhtml" xmlns:cc="http://www.my.com/cc">
答案 0 :(得分:2)
为什么你把它添加到开头?它已经开始了:
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:cc="http://creativecommons.org/ns#"
xmlns:fb="http://rdf.freebase.com/ns/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xhtml="http://www.w3.org/1999/xhtml/vocab#"
>
所以你的添加会破坏文件。
要看到这个尝试,例如:
$ curl -s http://rdf.freebase.com/rdf/venture_capital.views.investment_round | head
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:cc="http://creativecommons.org/ns#"
xmlns:fb="http://rdf.freebase.com/ns/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xhtml="http://www.w3.org/1999/xhtml/vocab#"
>
<fb:common.document rdf:about="http://rdf.freebase.com/ns/venture_capital.views.investment_round">
<cc:attributionName>Source: Freebase - The World's database</cc:attributionName>
<xhtml:license rdf:resource="http://creativecommons.org/licenses/by/3.0/"/>
答案 1 :(得分:1)
freebase网站上托管的文件有效,您无需更改。
您可以使用“说唱歌手”工具确认:
$ rapper -c -i rdfxml http://rdf.freebase.com/rdf/venture_capital.views.investment_round 说唱歌手:用解析器rdfxml解析URI http://rdf.freebase.com/rdf/venture_capital.views.investment_round 说唱歌手:解析返回了16个三元组