rdflib
RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
Decision gist · record as of 2026-08-14
Yes. RDFLib is a mature, actively maintained library with low install friction, no known vulnerabilities, and permissive licensing. It is the standard Python tool for RDF and semantic web work. Install it if you need to parse, query, or generate RDF data or work with SPARQL endpoints.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction installation with only two runtime dependencies (isodate, pyparsing).
- The project is actively maintained with a recent release and 2494 GitHub stars, indicating stable, well-supported code.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is a permissive open-source license that allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
last release 2026-02-13 (182 days) · last repo commit 2026-08-12 · 2,494 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 21,995,534 downloads/mo, #987 on PyPI
Alternatives
Verify before relying
pip install rdflib
from rdflib import Graph, URIRef, Literal
from rdflib.namespace import FOAF, XSD
g = Graph()
g.add((URIRef("http://example.com/person/nick"), FOAF.givenName, Literal("Nick", datatype=XSD.string)))
print(g.serialize(format="turtle"))- Performance characteristics when working with very large RDF graphs or remote SPARQL endpoints
- Availability and stability of optional store backends (Berkeley DB, RDF4J) mentioned in documentation
What it is and what it does
RDFLib is a pure Python library for working with RDF (Resource Description Framework), the W3C standard for representing linked data. It provides parsers and serializers for multiple RDF formats (RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, Trig, JSON-LD, HexTuples), a Graph interface for manipulating RDF triples, and a SPARQL 1.1 query engine. The library abstracts RDF data as collections of Subject-Predicate-Object triples and includes built-in namespace definitions for common ontologies like FOAF, RDFS, and XSD.
Typical use involves creating a Graph object, populating it with triples (either by parsing external RDF documents or programmatically adding URIRefs and Literals), querying it with SPARQL or graph traversal methods, and serializing the result back to a chosen format. Store implementations allow graphs to be backed by in-memory storage, persistent disk storage, or remote SPARQL endpoints. The library is designed to be pythonic, treating graphs as Python collections and namespaces as objects.
Use it for
- Parse and query linked data from DBpedia, Wikidata, or other RDF sources for data integration tasks
- Build and manipulate OWL ontologies programmatically for knowledge representation projects
- Execute SPARQL queries against local or remote RDF triple stores for semantic search and reasoning
- Convert between RDF serialization formats (e.g., RDF/XML to Turtle) for data pipeline workflows
- Validate RDF graphs or extract structured metadata from semantic web documents
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
RDFLib is a mature, actively maintained library with low install friction, no known vulnerabilities, and permissive licensing. It is the standard Python tool for RDF and semantic web work. Install it if you need to parse, query, or generate RDF data or work with SPARQL endpoints.
Install
rdflib on PyPI
Before you install
Low friction installation with only two runtime dependencies (isodate, pyparsing). The project is actively maintained with a recent release and 2494 GitHub stars, indicating stable, well-supported code.
License in practice
BSD-3-Clause is a permissive open-source license that allows commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install rdflib
from rdflib import Graph, URIRef, Literal
from rdflib.namespace import FOAF, XSD
g = Graph()
g.add((URIRef("http://example.com/person/nick"), FOAF.givenName, Literal("Nick", datatype=XSD.string)))
print(g.serialize(format="turtle"))
Verify before relying
- Performance characteristics when working with very large RDF graphs or remote SPARQL endpoints
- Availability and stability of optional store backends (Berkeley DB, RDF4J) mentioned in documentation
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.8.1 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesisodatepyparsing |
| Maintenance | Actively maintained 182 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 21,995,534 / month, #987 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: rdflib-7.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “RDF parsing and serialization”
- rdflibRDFLib is a Python library for parsing, querying, and serializing RDF…
- rdflib-jsonldProvides JSON-LD parsing and serialization for RDFLib graphs,…
- PyShexCParses Shape Expression Compact (ShExC) syntax into Python objects…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also CFGraph · owlrl · pymantic · pyoxigraph · pyrdfa3 · rdflib-jsonld · SPARQLWrapper · owlready2 · prov · pyshacl