{"id":10119,"library":"pyoxigraph","title":"PyOxigraph","description":"PyOxigraph provides Python bindings for Oxigraph, a high-performance SPARQL database and RDF toolkit implemented in Rust. It offers capabilities for parsing, storing, querying, and manipulating RDF data, including support for various RDF serialization formats and the SPARQL query language. The library is actively maintained with frequent releases, typically every few weeks, incorporating new features and performance improvements. Current version is 0.5.6.","status":"active","version":"0.5.6","language":"en","source_language":"en","source_url":"https://github.com/oxigraph/oxigraph/tree/main/python","tags":["RDF","SPARQL","graph database","knowledge graph","linked data","triple store"],"install":[{"cmd":"pip install pyoxigraph","lang":"bash","label":"Install PyOxigraph"}],"dependencies":[],"imports":[{"symbol":"Store","correct":"from pyoxigraph import Store"},{"symbol":"NamedNode","correct":"from pyoxigraph import NamedNode"},{"symbol":"Literal","correct":"from pyoxigraph import Literal"},{"symbol":"Triple","correct":"from pyoxigraph import Triple"},{"symbol":"QueryEvaluator","correct":"from pyoxigraph import QueryEvaluator"}],"quickstart":{"code":"from pyoxigraph import Store, NamedNode, Literal, Triple\n\n# Create an in-memory store\nstore = Store()\n\n# Define some RDF terms\nex_s = NamedNode(\"http://example.com/subject\")\nex_p = NamedNode(\"http://example.com/predicate\")\nex_o = Literal(\"object value\")\n\n# Add a triple to the store\nstore.add(Triple(ex_s, ex_p, ex_o))\n\n# Add another triple\nstore.add(Triple(NamedNode(\"http://example.com/another\"), NamedNode(\"http://example.com/knows\"), ex_s))\n\n# Query the store using SPARQL\nprint(\"\\n--- Query Results ---\")\nresults = store.query(\"SELECT ?s ?p ?o WHERE { ?s ?p ?o }\")\nfor s, p, o in results:\n    print(f\"Subject: {s}, Predicate: {p}, Object: {o}\")\n\n# Check if the store contains a specific triple\nif store.contains(Triple(ex_s, ex_p, ex_o)):\n    print(f\"\\nStore contains: {ex_s} {ex_p} {ex_o}\")","lang":"python","description":"This example demonstrates how to create a `Store`, add RDF `Triple`s using `NamedNode` and `Literal` terms, and then query the store using a simple SPARQL `SELECT` statement."},"warnings":[{"fix":"If you were using RDF-star, update your code to use the new RDF 1.2/SPARQL 1.2 features and adapt to the updated triple term syntax as defined in the latest specifications. Consult the PyOxigraph documentation for examples on enabling and using these features.","message":"The `rdf-star` feature (for RDF-star syntax) was replaced by `rdf-12` and `sparql-12` features in v0.5.0, aligning with W3C working drafts for RDF 1.2 and SPARQL 1.2. The triple term syntax also slightly changed.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Ensure your system has a C++20 compatible compiler (e.g., GCC 10+, Clang 11+, MSVC 19.28+). If you're on an older system, you might need to upgrade your compiler or ensure pre-built wheels are available for your platform.","message":"Starting from v0.5.2, PyOxigraph's underlying RocksDB dependency requires a C++20 compatible compiler to build from source. This primarily affects users installing `pyoxigraph` without pre-built wheels or on platforms where Rust's build system needs to compile RocksDB.","severity":"gotcha","affected_versions":">=0.5.2"},{"fix":"If you encounter Glibc version errors, either upgrade your Linux distribution to one that provides Glibc 2.28+, or build `pyoxigraph` from source on your system to link against your existing Glibc version. Building from source requires a Rust toolchain and C++20 compiler.","message":"Linux Python wheels for PyOxigraph, starting from v0.5.2, are built with a dependency on Glibc 2.28 or newer. This can cause runtime errors on older Linux distributions.","severity":"gotcha","affected_versions":">=0.5.2"},{"fix":"For advanced querying scenarios, utilize `QueryEvaluator.prepare()` to pre-process your query, allowing for variable injection and proper handling of dataset clauses. Then, execute the prepared query. Refer to the documentation for `QueryEvaluator` usage.","message":"For complex SPARQL queries, especially those involving `FROM` or `FROM NAMED` clauses, the `QueryEvaluator.prepare` method (introduced in v0.5.1) is the recommended approach over direct `QueryEvaluator.execute`. Using `QueryEvaluator.execute` might not correctly account for `FROM` clauses.","severity":"gotcha","affected_versions":">=0.5.1"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install pyoxigraph` to install the library.","cause":"The pyoxigraph library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'pyoxigraph'"},{"fix":"Upgrade your C++ compiler. For example, use GCC version 10 or newer, Clang version 11 or newer, or MSVC 19.28 (Visual Studio 2019 version 16.8) or newer.","cause":"During installation (especially if pre-built wheels are unavailable), the underlying RocksDB dependency failed to compile because your C++ compiler does not support the C++20 standard.","error":"error: C++ compiler support for C++20 is required"},{"fix":"Upgrade your Linux distribution to one that provides Glibc 2.28 or newer (e.g., Ubuntu 20.04+, Debian 10+). Alternatively, you can try to build `pyoxigraph` from source, which will link against your system's Glibc, but requires a Rust toolchain and C++20 compiler.","cause":"You are trying to run a pre-built pyoxigraph wheel on a Linux system with a Glibc version older than 2.28.","error":"ImportError: /lib64/libc.so.6: version 'GLIBC_2.28' not found (required by .../pyoxigraph.cpython-3x-xxxx.so)"}]}