Source code

Download source archive ↓

src/rdflib-7.6.0.dist-info/METADATA

1Metadata-Version: 2.1
2Name: rdflib
3Version: 7.6.0
4Summary: RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
5Home-page: https://github.com/RDFLib/rdflib
6License: BSD-3-Clause
7Author: Daniel 'eikeon' Krech
8Author-email: eikeon@eikeon.com
9Maintainer: RDFLib Team
10Maintainer-email: rdflib-dev@googlegroups.com
11Requires-Python: >=3.8.1
12Classifier: License :: OSI Approved :: BSD License
13Classifier: Natural Language :: English
14Classifier: Operating System :: OS Independent
15Classifier: Programming Language :: Python
16Classifier: Programming Language :: Python :: 3
17Classifier: Programming Language :: Python :: 3.9
18Classifier: Programming Language :: Python :: 3.10
19Classifier: Programming Language :: Python :: 3.11
20Classifier: Programming Language :: Python :: 3.12
21Classifier: Programming Language :: Python :: 3.13
22Classifier: Programming Language :: Python :: 3.14
23Classifier: Programming Language :: Python :: 3.8
24Classifier: Topic :: Software Development :: Libraries :: Python Modules
25Provides-Extra: berkeleydb
26Provides-Extra: graphdb
27Provides-Extra: html
28Provides-Extra: lxml
29Provides-Extra: networkx
30Provides-Extra: orjson
31Provides-Extra: rdf4j
32Requires-Dist: berkeleydb (>=18.1.0,<19.0.0) ; extra == "berkeleydb"
33Requires-Dist: html5rdf (>=1.2,<2) ; extra == "html"
34Requires-Dist: httpx (>=0.28.1,<0.29.0) ; extra == "rdf4j" or extra == "graphdb"
35Requires-Dist: isodate (>=0.7.2,<1.0.0) ; python_version < "3.11"
36Requires-Dist: lxml (>=4.3,<6.0) ; extra == "lxml"
37Requires-Dist: networkx (>=2,<4) ; extra == "networkx"
38Requires-Dist: orjson (>=3.9.14,<4) ; extra == "orjson"
39Requires-Dist: pyparsing (>=2.1.0,<4)
40Project-URL: Documentation, https://rdflib.readthedocs.org/
41Project-URL: Repository, https://github.com/RDFLib/rdflib
42Description-Content-Type: text/markdown
43
44![](docs/_static/RDFlib.png)
45
46# RDFLib
47
48[![Build Status](https://github.com/RDFLib/rdflib/actions/workflows/validate.yaml/badge.svg?branch=main)](https://github.com/RDFLib/rdflib/actions?query=branch%3Amain)
49[![Documentation Status](https://readthedocs.org/projects/rdflib/badge/?version=latest)](https://rdflib.readthedocs.io/en/latest/?badge=latest)
50[![Coveralls branch](https://img.shields.io/coveralls/RDFLib/rdflib/main.svg)](https://coveralls.io/r/RDFLib/rdflib?branch=main)
51
52[![GitHub stars](https://img.shields.io/github/stars/RDFLib/rdflib.svg)](https://github.com/RDFLib/rdflib/stargazers)
53[![Downloads](https://pepy.tech/badge/rdflib/week)](https://pepy.tech/project/rdflib)
54[![PyPI](https://img.shields.io/pypi/v/rdflib.svg)](https://pypi.python.org/pypi/rdflib)
55[![PyPI](https://img.shields.io/pypi/pyversions/rdflib.svg)](https://pypi.python.org/pypi/rdflib)
56[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6845245.svg)](https://doi.org/10.5281/zenodo.6845245)
57
58[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/RDFLib/rdflib)
59[![Gitter](https://badges.gitter.im/RDFLib/rdflib.svg)](https://gitter.im/RDFLib/rdflib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
60[![Matrix](https://img.shields.io/matrix/rdflib:matrix.org?label=matrix.org%20chat)](https://matrix.to/#/#RDFLib_rdflib:gitter.im)
61
62RDFLib is a pure Python package for working with [RDF](http://www.w3.org/RDF/). RDFLib contains most things you need to work with RDF, including:
63
64* parsers and serializers for RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, Trig, JSON-LD and even HexTuples
65* a Graph interface which can be backed by any one of a number of Store implementations
66* Store implementations for in-memory, persistent on disk (Berkeley DB) and remote SPARQL endpoints
67    * additional Stores can be supplied via plugins 
68* a SPARQL 1.1 implementation - supporting SPARQL 1.1 Queries and Update statements
69* SPARQL function extension mechanisms
70
71## RDFlib Family of packages
72The RDFlib community maintains many RDF-related Python code repositories with different purposes. For example:
73
74* [rdflib](https://github.com/RDFLib/rdflib) - the RDFLib core
75* [sparqlwrapper](https://github.com/RDFLib/sparqlwrapper) - a simple Python wrapper around a SPARQL service to remotely execute your queries
76* [pyLODE](https://github.com/RDFLib/pyLODE) - An OWL ontology documentation tool using Python and templating, based on LODE.
77* [pyrdfa3](https://github.com/RDFLib/pyrdfa3) - RDFa 1.1 distiller/parser library: can extract RDFa 1.1/1.0 from (X)HTML, SVG, or XML in general.
78* [pymicrodata](https://github.com/RDFLib/pymicrodata) - A module to extract RDF from an HTML5 page annotated with microdata.
79* [pySHACL](https://github.com/RDFLib/pySHACL) - A pure Python module which allows for the validation of RDF graphs against SHACL graphs.
80* [OWL-RL](https://github.com/RDFLib/OWL-RL) - A simple implementation of the OWL2 RL Profile which expands the graph with all possible triples that OWL RL defines.
81
82Please see the list for all packages/repositories here:
83
84* <https://github.com/RDFLib>
85
86Help with maintenance of all of the RDFLib family of packages is always welcome and appreciated.
87
88## Versions & Releases
89
90* `main` branch in this repository is the current unstable release - version 8 alpha
91* `7.6.0` GraphDB Client, and many improvements and fixes. See changelog for details
92* `7.5.0` RDF4J Store integration, RDF4J Client, and other improvements. See changelog for details
93* `7.4.0` a few small fixes, add test matrix for active python versions, and move v7 documentation to MkDocs
94* `7.3.0` many fixes and usability improvements, particularly for the Dataset class. See changelog for details
95* `7.2.1` tiny clean up release, relaxes Python version requirement
96* `7.2.0` general fixes and usability improvements, see changelog for details
97* `7.1.4` tidy-up release, possibly last 7.x release
98* `7.1.3` current stable release, small improvements to 7.1.1
99* `7.1.2` previously deleted release
100* `7.1.1` previous stable release
101    * see <https://github.com/RDFLib/rdflib/releases/tag/7.1.1>
102* `7.0.0` previous stable release, supports Python 3.8.1+ only.
103    * see [Releases](https://github.com/RDFLib/rdflib/releases)
104* `6.x.y` supports Python 3.7+ only. Many improvements over 5.0.0
105    * see [Releases](https://github.com/RDFLib/rdflib/releases)
106* `5.x.y` supports Python 2.7 and 3.4+ and is [mostly backwards compatible with 4.2.2](https://rdflib.readthedocs.io/en/stable/upgrade4to5.html).
107
108See <https://github.com/RDFLib/rdflib/releases/> for the release details.
109
110## Documentation
111See <https://rdflib.readthedocs.io> for our documentation built from the code. Note that there are `latest`, `stable` and versioned builds, such as `5.0.0`, matching releases.
112
113## Installation
114The stable release of RDFLib may be installed with Python's package management tool *pip*:
115
116    $ pip install rdflib
117
118Some features of RDFLib require optional dependencies which may be installed using *pip* extras:
119
120    $ pip install rdflib[berkeleydb,networkx,html,lxml,orjson]
121
122Alternatively manually download the package from the Python Package
123Index (PyPI) at https://pypi.python.org/pypi/rdflib
124
125### Installation of the current main branch (for developers)
126
127With *pip* you can also install rdflib from the git repository with one of the following options:
128
129    $ pip install git+https://github.com/rdflib/rdflib@main
130
131or
132
133    $ pip install -e git+https://github.com/rdflib/rdflib@main#egg=rdflib
134
135or from your locally cloned repository you can install it with one of the following options:
136
137    $ poetry install  # installs into a poetry-managed venv
138
139or
140
141    $ pip install -e .
142
143## Getting Started
144RDFLib aims to be a pythonic RDF API. RDFLib's main data object is a `Graph` which is a Python collection
145of RDF *Subject, Predicate, Object* Triples:
146
147To create graph and load it with RDF data from DBPedia then print the results:
148
149```python
150from rdflib import Graph
151g = Graph()
152g.parse('http://dbpedia.org/resource/Semantic_Web')
153
154for s, p, o in g:
155    print(s, p, o)
156```
157The components of the triples are URIs (resources) or Literals
158(values).
159
160URIs are grouped together by *namespace*, common namespaces are included in RDFLib:
161
162```python
163from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD
164```
165
166You can use them like this:
167
168```python
169from rdflib import Graph, URIRef, Literal
170from rdflib.namespace import RDFS, XSD
171
172g = Graph()
173semweb = URIRef('http://dbpedia.org/resource/Semantic_Web')
174type = g.value(semweb, RDFS.label)
175```
176Where `RDFS` is the RDFS namespace, `XSD` the XML Schema Datatypes namespace and `g.value` returns an object of the triple-pattern given (or an arbitrary one if multiple exist).
177
178Or like this, adding a triple to a graph `g`:
179
180```python
181g.add((
182    URIRef("http://example.com/person/nick"),
183    FOAF.givenName,
184    Literal("Nick", datatype=XSD.string)
185))
186```
187
188The triple (in n-triples notation) `<http://example.com/person/nick> <http://xmlns.com/foaf/0.1/givenName> "Nick"^^<http://www.w3.org/2001/XMLSchema#string> .`
189is created where the property `FOAF.givenName` is the URI `<http://xmlns.com/foaf/0.1/givenName>` and `XSD.string` is the
190URI `<http://www.w3.org/2001/XMLSchema#string>`.
191
192You can bind namespaces to prefixes to shorten the URIs for RDF/XML, Turtle, N3, TriG, TriX & JSON-LD serializations:
193
194```python
195g.bind("foaf", FOAF)
196g.bind("xsd", XSD)
197```
198
199This will allow the n-triples triple above to be serialised like this:
200
201```python
202print(g.serialize(format="turtle"))
203```
204
205With these results:
206```turtle
207PREFIX foaf: <http://xmlns.com/foaf/0.1/>
208PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
209
210<http://example.com/person/nick> foaf:givenName "Nick"^^xsd:string .
211```
212
213New Namespaces can also be defined:
214
215```python
216dbpedia = Namespace('http://dbpedia.org/ontology/')
217
218abstracts = list(x for x in g.objects(semweb, dbpedia['abstract']) if x.language=='en')
219```
220
221See also [./examples](./examples)
222
223
224## Features
225The library contains parsers and serializers for RDF/XML, N3,
226NTriples, N-Quads, Turtle, TriX, JSON-LD, RDFa and Microdata.
227
228The library presents a Graph interface which can be backed by
229any one of a number of Store implementations.
230
231This core RDFLib package includes store implementations for
232in-memory storage and persistent storage on top of the Berkeley DB.
233
234A SPARQL 1.1 implementation is included - supporting SPARQL 1.1 Queries and Update statements.
235
236RDFLib is open source and is maintained on [GitHub](https://github.com/RDFLib/rdflib/). RDFLib releases, current and previous
237are listed on [PyPI](https://pypi.python.org/pypi/rdflib/)
238
239Multiple other projects are contained within the RDFlib "family", see <https://github.com/RDFLib/>.
240
241## Running tests
242
243### Running the tests on the host
244
245Run the test suite with `pytest`.
246```shell
247poetry install
248poetry run pytest
249```
250
251### Running test coverage on the host with coverage report
252
253Run the test suite and generate a HTML coverage report with `pytest` and `pytest-cov`.
254```shell
255poetry run pytest --cov
256```
257
258### Viewing test coverage
259
260Once tests have produced HTML output of the coverage report, view it by running:
261```shell
262poetry run pytest --cov --cov-report term --cov-report html
263python -m http.server --directory=htmlcov
264```
265
266## Contributing
267
268RDFLib survives and grows via user contributions!
269Please read our [contributing guide](https://rdflib.readthedocs.io/en/latest/CONTRIBUTING.html) and [developers guide](https://rdflib.readthedocs.io/en/latest/developers.html) to get started.
270Please consider lodging Pull Requests here:
271
272* <https://github.com/RDFLib/rdflib/pulls>
273
274To get a development environment consider using Gitpod or Google Cloud Shell.
275
276[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/RDFLib/rdflib)
277[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://shell.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2FRDFLib%2Frdflib&cloudshell_git_branch=main&cloudshell_open_in_editor=README.md)
278
279You can also raise issues here:
280
281* <https://github.com/RDFLib/rdflib/issues>
282
283## Support & Contacts
284For general "how do I..." queries, please use https://stackoverflow.com and tag your question with `rdflib`.
285Existing questions:
286
287* <https://stackoverflow.com/questions/tagged/rdflib>
288
289If you want to contact the rdflib maintainers, please do so via:
290
291* the rdflib-dev mailing list: <https://groups.google.com/group/rdflib-dev>
292* the chat, which is available at [gitter](https://gitter.im/RDFLib/rdflib) or via matrix [#RDFLib_rdflib:gitter.im](https://matrix.to/#/#RDFLib_rdflib:gitter.im)
293