|Project Name||Stars||Downloads||Repos Using This||Packages Using This||Most Recent Commit||Total Releases||Latest Release||Open Issues||License||Language|
|Rdflib||1,904||1,567||444||4 days ago||33||July 26, 2022||231||bsd-3-clause||Python|
|RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.|
|Akutan||1,658||4 years ago||18||apache-2.0||Go|
|A distributed knowledge graph store|
|Nlp Knowledge Graph||1,340||19 days ago||mit|
|Awesome Graph||991||a month ago||8|
|A curated list of resources for graph databases and graph computing tools|
|Badwolf||958||a year ago||22||March 31, 2022||18||apache-2.0||Go|
|Temporal graph store abstraction layer.|
|Oxigraph||772||4||a day ago||5||March 19, 2022||61||apache-2.0||Rust|
|SPARQL graph database|
|Easyrdf||560||3,113||71||2 years ago||18||December 02, 2020||56||other|
|EasyRdf is a PHP library designed to make it easy to consume and produce RDF.|
|Ontop||557||5||a day ago||12||April 19, 2022||63||apache-2.0||Java|
|Ontop is a platform to query relational databases as Virtual RDF Knowledge Graphs using SPARQL|
|Graph Notebook||552||3 days ago||55||June 11, 2022||22||apache-2.0||Jupyter Notebook|
|Library extending Jupyter notebooks to integrate with Apache TinkerPop, openCypher, and RDF SPARQL.|
|JS RDF store with SPARQL support|
RDFLib is a pure Python package for working with RDF. RDFLib contains most things you need to work with RDF, including:
The RDFlib community maintains many RDF-related Python code repositories with different purposes. For example:
Please see the list for all packages/repositories here:
Help with maintenance of all of the RDFLib family of packages is always welcome and appreciated.
6.x.ycurrent release and support Python 3.7+ only. Many improvements over 5.0.0
5.x.ysupports Python 2.7 and 3.4+ and is mostly backwards compatible with 4.2.2.
See https://rdflib.dev for the release overview.
See https://rdflib.readthedocs.io for our documentation built from the code. Note that there are
4.2.2 documentation versions, matching releases.
The stable release of RDFLib may be installed with Python's package management tool pip:
$ pip install rdflib
Alternatively manually download the package from the Python Package Index (PyPI) at https://pypi.python.org/pypi/rdflib
The current version of RDFLib is 6.3.2, see the
CHANGELOG.md file for what's new in this release.
With pip you can also install rdflib from the git repository with one of the following options:
$ pip install git+https://github.com/rdflib/[email protected]
$ pip install -e git+https://github.com/rdflib/[email protected]#egg=rdflib
or from your locally cloned repository you can install it with one of the following options:
$ poetry install # installs into a poetry-managed venv
$ pip install -e .
RDFLib aims to be a pythonic RDF API. RDFLib's main data object is a
Graph which is a Python collection
of RDF Subject, Predicate, Object Triples:
To create graph and load it with RDF data from DBPedia then print the results:
from rdflib import Graph g = Graph() g.parse('http://dbpedia.org/resource/Semantic_Web') for s, p, o in g: print(s, p, o)
The components of the triples are URIs (resources) or Literals (values).
URIs are grouped together by namespace, common namespaces are included in RDFLib:
from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD
You can use them like this:
from rdflib import Graph, URIRef, Literal from rdflib.namespace import RDFS, XSD g = Graph() semweb = URIRef('http://dbpedia.org/resource/Semantic_Web') type = g.value(semweb, RDFS.label)
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).
Or like this, adding a triple to a graph
g.add(( URIRef("http://example.com/person/nick"), FOAF.givenName, Literal("Nick", datatype=XSD.string) ))
The 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> .
is created where the property
FOAF.givenName is the URI
XSD.string is the
You can bind namespaces to prefixes to shorten the URIs for RDF/XML, Turtle, N3, TriG, TriX & JSON-LD serializations:
g.bind("foaf", FOAF) g.bind("xsd", XSD)
This will allow the n-triples triple above to be serialised like this:
With these results:
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> <http://example.com/person/nick> foaf:givenName "Nick"^^xsd:string .
New Namespaces can also be defined:
dbpedia = Namespace('http://dbpedia.org/ontology/') abstracts = list(x for x in g.objects(semweb, dbpedia['abstract']) if x.language=='en')
See also ./examples
The library contains parsers and serializers for RDF/XML, N3, NTriples, N-Quads, Turtle, TriX, JSON-LD, RDFa and Microdata.
The library presents a Graph interface which can be backed by any one of a number of Store implementations.
This core RDFLib package includes store implementations for in-memory storage and persistent storage on top of the Berkeley DB.
A SPARQL 1.1 implementation is included - supporting SPARQL 1.1 Queries and Update statements.
RDFLib is open source and is maintained on GitHub. RDFLib releases, current and previous are listed on PyPI
Multiple other projects are contained within the RDFlib "family", see https://github.com/RDFLib/.
Run the test suite with
poetry install poetry run pytest
Run the test suite and generate a HTML coverage report with
poetry run pytest --cov
Once tests have produced HTML output of the coverage report, view it by running:
poetry run pytest --cov --cov-report term --cov-report html python -m http.server --directory=htmlcov
RDFLib survives and grows via user contributions! Please read our contributing guide and developers guide to get started. Please consider lodging Pull Requests here:
To get a development environment consider using Gitpod or Google Cloud Shell.
You can also raise issues here:
For general "how do I..." queries, please use https://stackoverflow.com and tag your question with
If you want to contact the rdflib maintainers, please do so via: