Registry / data / pyrdfa3

pyrdfa3

JSON →
library3.6.5pypypi✓ verified 87d ago

pyRdfa3 is a Python library that functions as an RDFa 1.1 distiller and parser. It can extract RDFa 1.1 (and, if properly configured, RDFa 1.0) from various document types including (X)HTML, SVG, and general XML. The library outputs either serialized RDF graphs or an RDFLib Graph object. The current version is 3.6.5. While the original maintainer has archived the primary GitHub repository, the 3.6.5 version is now built and maintained under a new GitHub Pages project, suggesting a community-driven or less frequent release cadence going forward.

pip install pyRdfa3
INSTALL
IMPORT
SIG · PYRDFA3
P
pyrdfa3
datapythonv3.6.5
Install
2.8s avg
Import
351ms
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.6.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.375s · 28.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.8s · import 0.327s · 29MB
27MB installed
● package 27MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pyRdfa
from pyRdfa import pyRdfa

This quickstart demonstrates how to use `pyRdfa` to parse RDFa content from a source (a local HTML file in this case) and either obtain a serialized RDF string (defaulting to Turtle) or an RDFLib Graph object.

from pyRdfa import pyRdfa from rdflib import Graph # Example HTML content with RDFa html_content = ''' <div prefix="schema: http://schema.org/"> <p typeof="schema:Person"> <span property="schema:name">Jane Doe</span> <span property="schema:jobTitle">Professor</span> <a href="http://www.example.com/janedoe" property="schema:url">Homepage</a> </p> </div> ''' # Create a dummy file for demonstration with open("example.html", "w") as f: f.write(html_content) # Extract RDF as a serialized string (Turtle format by default) turtle_output = pyRdfa().rdf_from_source('example.html') print("--- Turtle Output ---") print(turtle_output) # Extract RDF as an RDFLib Graph object graph = pyRdfa().graph_from_source('example.html') print("\n--- RDFLib Graph (Triples) ---") for s, p, o in graph: print(s, p, o) # Clean up the dummy file (optional) import os os.remove("example.html")
Debug
Known issues
breakingThe original maintainer has retired and archived the primary GitHub repository. While version 3.6.5 is now maintained by a new entity, this indicates a significant shift in project leadership and potentially irregular future updates or support.
fix
Monitor the new GitHub Pages project (prrvchr.github.io/pyrdfa3) for updates and be aware of potential delays in bug fixes or new features. Consider contributing to the project if active maintenance is critical for your use case.
affects: All versions >= 3.6.5 (due to change in maintenance model)
breaking`pyrdfa3` no longer supports Python 2.x. It explicitly requires Python 3.8 or higher.
fix
Ensure your environment uses Python 3.8 or a newer compatible version.
affects: < 3.6.0 (before explicit Python 3.8+ requirement)
gotchaSome parsing behaviors, particularly around RDFa 1.0 vs. 1.1 specifics (e.g., `@property`, list handling, `@typeof`), have changed due to the library being a rewrite of a previous RDFa 1.0 distiller.
fix
Consult the RDFa 1.1 specifications (Core, XHTML+RDFa, HTML+RDFa) and the `pyRdfa` documentation to understand the exact parsing behavior for different RDFa versions. Ensure your markup explicitly uses `@version` if mixing RDFa 1.0 and 1.1 concepts.
affects: All versions >= 3.0.0
gotchaThe default RDF serialization formats rely on RDFLib's serializers. Older RDFLib releases might have issues with certain serialization formats, and formats like JSON-LD might require the `pyRdfaExtras` package or a compatible `rdflib_jsonld` package if not part of the core RDFLib distribution.
fix
Use a recent version of RDFLib (>=7.0.0 as recommended by pyrdfa3). If encountering serialization issues or needing JSON-LD, ensure `pyRdfaExtras` is installed or verify `rdflib_jsonld` compatibility with your RDFLib version.
affects: All versions, especially with older RDFLib installations
gotchaThe `CGI_RDFa.py` and `localRdfa.py` utility scripts included in the distribution have not been ported to Python 3.x and will not function correctly on modern Python environments.
fix
Avoid using these scripts directly. Implement similar functionality by calling the `pyRdfa` library methods directly within your Python 3 application.
affects: All versions
Errors
Common errors & fixes
TypeError: 'module' object is not callable
Attempting to call the `pyRdfa` module directly instead of instantiating the `pyRdfa` class within the module.
fix
Ensure you are calling the `pyRdfa` class. Correct: `from pyRdfa import pyRdfa; distiller = pyRdfa()`. Incorrect: `import pyRdfa; distiller = pyRdfa()`.
ModuleNotFoundError: No module named 'pyRdfa'
The `pyrdfa3` package is not installed or the Python environment is not correctly configured.
fix
Install the package using pip: `pip install pyRdfa3`. If it's already installed, verify your Python environment's PYTHONPATH.
rdflib.exceptions.SerializerNotAvailable: No serializer for format 'json-ld' installed.
The JSON-LD serializer is not available in the installed RDFLib version or `pyRdfaExtras` (or `rdflib-jsonld`) is not installed or detected.
fix
Ensure you have a compatible `rdflib` version (>=7.0.0). If the issue persists, try installing `pyRdfaExtras` if it's explicitly required by your `pyrdfa3` version for JSON-LD, or `pip install rdflib-jsonld` if using an older RDFLib that doesn't include it.
Upgrade
Version history
3.6.5latest on PyPI · released Jan 17, 2026
Audit
Dependencies
pythonrequiredRequired Python version.
requestsrequiredUsed for HTTP requests, e.g., fetching remote RDFa sources or vocabularies.
rdflibrequiredCore dependency for RDF graph handling and serialization.
html5librequiredUsed for parsing HTML5 documents, providing a more robust parsing experience for potentially erroneous HTML.
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
pyrdfa3 — pip install pyrdfa3 · libregistry