在python中轻松阅读和查询hdt文档

hdt的Python项目详细描述


Build StatusDocumentation StatusPyPI version

在python中轻松阅读和查询hdt文档

Online Documentation

要求

  • python3.6.4或更高版本
  • pip
  • gcc/clang支持c++11
  • python开发头>;您应该拥有Python.h 您的系统上有标题。 >;例如,对于python 3.6,安装python3.6-dev包 在debian/ubuntu系统上。

然后,安装pybind11 library

pip install pybind11

安装

在avirtualenv中安装 强烈建议使用

手动安装

git clone https://github.com/Callidon/pyHDT
cd pyHDT/
./install.sh

开始

fromhdtimportHDTDocument# Load an HDT file.# Missing indexes are generated automatically, add False as the second argument to disable themdocument=HDTDocument("test.hdt")# Display some metadata about the HDT document itselfprint("nb triples: %i"%document.total_triples)print("nb subjects: %i"%document.nb_subjects)print("nb predicates: %i"%document.nb_predicates)print("nb objects: %i"%document.nb_objects)print("nb shared subject-object: %i"%document.nb_shared)# Fetch all triples that matches { ?s ?p ?o }# Use empty strings ("") to indicates variablestriples,cardinality=document.search_triples("","","")print("cardinality of { ?s ?p ?o }: %i"%cardinality)fortripleintriples:print(triple)# Search also support limit and offsettriples,cardinality=document.search_triples("","","",limit=10,offset=100)# etc ...

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用EntityManager有没有更有效的习惯用法?   Android上的java Google应用程序引擎(GAE)响应代码和cookie   如何在Java中创建单元测试?   java从DB获取特定列的最新行   java替换所有悬空元字符   java使用Hibernate删除SQL表中的数据   swing显示JComponent对象Java   java在确认内容类型后如何将URL保存到文件?   javascript如何从段落中选择大量单词?(硒)   java在Linux上使用BundleEnableTiveCode不起作用   java使用日志似然性来比较不同的mallet主题模型?   java无法在Tomcat7上运行Spring Boot 2.0:“由于缺少ServletWebServerFactory bean,无法启动ServletWebServerApplicationContext。”   java有办法显式引用非静态内部类实例吗?   java如何使用Spring的NamedParameterJdbcTemplate在MySQL数据库中创建和删除表?