Registry / database / pyanzo

pyanzo

JSON →
library3.3.12pypypi✓ verified 89d ago

PyAnzo is a Python library for programmatic interaction with Anzo, a knowledge graph platform developed by Cambridge Semantics. Anzo enables the ingestion, transformation, storage, exploration, and analysis of diverse data types using open W3C standards such as Web Ontology Language (OWL), Resource Description Framework (RDF), and SPARQL. The library is currently at version 3.3.12 and receives regular, primarily patch-level, updates.

pip install pyanzo
INSTALL
IMPORT
SIG · PYANZO
P
pyanzo
databasepythonv3.3.12
Install
3.6s avg
Import
782ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.3.12 · 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.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.815s · 28.2MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 3.6s · import 0.749s · 29MB
26MB installed
● package 26MB
Code
Verified usage

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

AnzoClient
✓ from pyanzo import AnzoClient

This quickstart demonstrates how to establish a connection to an Anzo server using `AnzoClient` and execute a simple SPARQL SELECT query against a specified graphmart. Ensure you set the `ANZO_HOST`, `ANZO_PORT`, `ANZO_USER`, `ANZO_PASS`, and `ANZO_GRAPH MART_URI` environment variables for a successful connection.

import os from pyanzo import AnzoClient ANZO_HOST = os.environ.get('ANZO_HOST', 'your_anzo_server.com') ANZO_PORT = int(os.environ.get('ANZO_PORT', '443')) ANZO_USER = os.environ.get('ANZO_USER', 'your_username') ANZO_PASS = os.environ.get('ANZO_PASS', 'your_password') ANZO_GRAPH MART_URI = os.environ.get('ANZO_GRAPH MART_URI', 'http://cambridgesemantics.com/anzo/graphmart/example') # Basic SPARQL query example SPARQL_QUERY = """ SELECT ?s ?p ?o WHERE { ?s ?p ?o . } LIMIT 10 """ try: client = AnzoClient(ANZO_HOST, ANZO_USER, ANZO_PASS, anzo_port=ANZO_PORT) print(f"Successfully connected to Anzo at {ANZO_HOST}:{ANZO_PORT}") print(f"Querying graphmart: {ANZO_GRAPH MART_URI}") results = client.query_graphmart_SELECT(ANZO_GRAPH MART_URI, SPARQL_QUERY) print("Query Results:") for row in results: print(row) except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaAnzo server connectivity issues are common. Ensure the correct host, port, and credentials are provided, and that the Anzo server is reachable from where PyAnzo is executed. Default ports might vary (e.g., 443 for HTTPS, 80 for HTTP).
fix
Verify `ANZO_HOST`, `ANZO_PORT`, `ANZO_USER`, and `ANZO_PASS` (or equivalent configuration) are correct and that network firewalls allow access to the Anzo server.
affects: All versions
gotchaIncorrect Graphmart URIs or non-activated graphmarts will lead to query failures. The URI must precisely match an existing and activated graphmart on the Anzo server.
fix
Confirm the graphmart URI is correct and that the target graphmart is activated within the Anzo environment. Use Anzo's administrative tools to list available graphmarts.
affects: All versions
gotchaSPARQL queries are case-insensitive for keywords but sensitive for URIs and literals. Syntax errors in SPARQL can cause query failures.
fix
Validate SPARQL query syntax using a SPARQL editor or Anzo's query validation tools before executing programmatically. Ensure all prefixes are defined if used.
affects: All versions
Errors
Common errors & fixes
AnzoClientException: Could not connect to Anzo server at [hostname]:[port]
The PyAnzo client could not establish a network connection to the specified Anzo server. This might be due to an incorrect hostname/IP, wrong port, firewall blocking the connection, or the Anzo server not running or being inaccessible.
fix
Check the `ANZO_HOST` and `ANZO_PORT` values. Ping the server's hostname/IP from the client machine. Verify firewall rules. Confirm the Anzo server is running and accessible.
AnzoClientException: Invalid credentials provided for Anzo server.
The username or password provided to `AnzoClient` is incorrect, or the user lacks the necessary permissions to connect or perform actions.
fix
Double-check the `ANZO_USER` and `ANZO_PASS` values. Ensure the user exists and has the required permissions on the Anzo server.
AnzoClientException: Graphmart [graphmart_uri] not found or not activated.
The specified graphmart URI does not exist on the connected Anzo server, or it has not been activated and made ready for querying.
fix
Verify the `ANZO_GRAPH MART_URI` is correct by checking Anzo's administrative interface. Ensure the graphmart is activated and has successfully loaded its data.
Upgrade
Version history
3.3.12latest on PyPI · released Aug 1, 2023
Audit
Dependencies
pythonrequiredRuntime environment
Agent activity
12 hits · last 30 days
node
10
Resources
pyanzo — pip install pyanzo · libregistry