在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第三方库


热门话题
JavaSpringbean已创建但未自动连接   java LibGDX游戏在三星Galaxy Grand Prime上结束   如何在Java中列出字符串句子中所有匹配条件的单词   java在Recyclerview中使用“putExtra”传递数据   java从一个特定的数组中提取特定的JSON对象,以便在Android中通过一个意图放入另一个活动   java需要使用IntelliJ和设置项目SDK的帮助   java springcontextindexer和Swagger 3   java使用indexOf和substring计算数字   java使用xml解析在word文档中查找隐式分页符   在添加<context:componentscan basepackage=“com.young.user”/   java无条件更改JTable单元格的背景色   选择列表中的java调用oracle函数:节点无数据类型   java如何添加缓冲图像作为JFrame的背景,然后在此图像上添加面板?   java Javadoc找不到用scala编写的类   java连接到文件共享程序的IP地址   java将数组元素加载到集合中   Tomcat中的java servlet、过滤器和线程   非Bean对象中的java EJB CDI注入?   java与println和printf的不同舍入