跳转到主要内容

Python语义网和RDF库

项目描述

快速开始

>>> from pymantic.rdf import *
>>> from pymantic.parsers import turtle_parser
>>> import requests
>>> Resource.prefixes['foaf'] = Prefix('http://xmlns.com/foaf/0.1/')
>>> graph = turtle_parser.parse(requests.get('https://raw.github.com/norcalrdf/pymantic/master/examples/foaf-bond.ttl').text)
>>> bond_james = Resource(graph, 'http://example.org/stuff/Bond')
>>> print("%s knows:" % (bond_james.get_scalar('foaf:name'),))
>>> for person in bond_james['foaf:knows']:
        print(person.get_scalar('foaf:name'))

要求

pymantic需要Python 3.9或更高版本。lark用于Turtle和NTriples解析器。《span class="docutils literal">requests库用于HTTP请求和SPARQL客户端。《span class="docutils literal">lxml和《span class="docutils literal">rdflib也是SPARQL客户端所需的。

安装

$ pip install pymantic

这将安装《span class="docutils literal">pymantic及其所有依赖项。

文档

生成文档的本地副本需要Sphinx

$ pip install Sphinx

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

pymantic-1.0.0.tar.gz (36.6 kB 查看哈希值)

上传于

构建分布

pymantic-1.0.0-py3-none-any.whl (33.1 kB 查看哈希值)

上传于 Python 3

由以下提供支持

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误日志StatusPageStatusPage状态页面