我有一个太大的文件。我想把它从nt转换成n3。这样做的原因是,我有一个大文件,由于附加了名称空间,它占用了大量空间:
# <1>
<file:///home//uniprot/uniprot.rdf> <http://www.w3.org/2002/07/owl#imports> <http://purl.uniprot.org/core/> .
# <2>
<http://purl.uniprot.org/uniprot/Q6GZX4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.uniprot.org/core/Protein> .
# <3>
<http://purl.uniprot.org/uniprot/Q6GZX4> <http://purl.uniprot.org/core/reviewed> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
现在我想以压缩形式高效地存储此文件,如下所示:
@fileuniprot: <file:///home//uniprot/>.
@owl: <http://www.w3.org/2002/07/owl#>.
@purlUniprot: <http://purl.uniprot.org/>.
@rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@xsd: <http://www.w3.org/2001/XMLSchema#>.
@xsd:
# <1>
fileuniprot:uniprot.rdf owl:imports purlUniprot:core .
# <2>
purlUniprot:uniprot/Q6GZX4 rdfs:type purlUniprot:core/Protein .
# <3>
purlUniprot:Q6GZX4 purlUniprot:core/reviewed "true"^^ xsd:boolean .
也就是说,我不希望名称空间附加相应的三元组。尽管我想保留评论。有可能吗。如果是的话,那么请有人建议一个有效的工具来做同样的事情。你知道吗
如果我能在python或java中找到一些与linux一起工作的工具,那就太好了? 我已经做了上述手动,这将是伟大的,如果转换可以自动完成。你知道吗
您可能需要考虑使用hdt进行非常好的压缩。 您可以将uniprot文件更改回使用gzip压缩的rdf/xml,并将大小至少减少25倍。(bzip2将给出30)我建议使用pbzip2获得最佳效果。你知道吗
如果您确实想使用turtle语法进行一些压缩,那么可以使用sesame RIO、jena RIOT中预先存在的代码或librdf中的rapper
问题是你为什么要把文件作为nt开头?你知道吗
您实际考虑使用的文件格式称为turtle。N3是turtle plus规则,这个规则部分实际上没有在UniProt数据集中使用,只是在RDF/triples之外。你知道吗
忘了N3,读一下海龟吧。你知道吗
相关问题 更多 >
编程相关推荐