Skip to content

intersystems-community/iris-vector-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

641 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

iris-vector-graph

Knowledge graph engine for InterSystems IRIS β€” openCypher queries, temporal property graph, vector search, and graph analytics.

PyPI Python 3.10+ IRIS 2024.1+ License: MIT


Getting Started

Five minutes from zero to running graph queries.

1. Start IRIS

docker compose up -d

Starts IRIS Community Edition on localhost:1972. No license required. Default credentials: _SYSTEM / SYS.

2. Install

pip install iris-vector-graph

3. Run your first query

import iris
from iris_vector_graph.engine import IRISGraphEngine

conn = iris.connect("localhost", 1972, "USER", "_SYSTEM", "SYS")
engine = IRISGraphEngine(conn, embedding_dimension=768)
engine.initialize_schema()

engine.create_node("alice", labels=["Person"], properties={"name": "Alice"})
engine.create_node("bob",   labels=["Person"], properties={"name": "Bob"})
engine.create_edge("alice", "KNOWS", "bob")

result = engine.execute_cypher(
    "MATCH (a {node_id:$id})-[:KNOWS]->(b) RETURN b.name AS name",
    {"id": "alice"}
)
print(result["rows"])  # [('Bob',)]

Note: initialize_schema() prints compile warnings on Community Edition β€” safe to ignore. Enterprise-only classes (Graph.KG.MCPService, Graph.KG.MCPToolSet) are not required.


What It Does

Feature Notes
openCypher MATCH, CREATE, MERGE, DELETE, WITH, UNWIND, variable-length paths, subqueries
Temporal property graph Time-windowed edges, pre-aggregated bucket analytics, O(1) window queries
Vector search HNSW (native IRIS VECTOR), IVFFlat, PLAID multi-vector, BM25 full-text
Graph analytics Betweenness, closeness, eigenvector, degree centrality; Leiden community detection; SCC; k-core; PPR
Shortest path Unweighted BFS (shortestPath), weighted Dijkstra (ivg.shortestPath.weighted)
NKG fast-path [*1..N] Cypher patterns route to integer-keyed ^NKG index, bypassing SQL translation
Bulk loader 190–312K edges/s direct ^KG write; incremental ^NKG rebuild
FHIR bridge ICD-10 β†’ knowledge graph mapping via FHIR R4
Bolt protocol neo4j-driver compatible wire protocol (TCP + WebSocket)
Embedded Python Graph algorithms run server-side via IRIS embedded Python (igraph, leidenalg)
IPM / ZPM ObjectScript-only install via InterSystems Package Manager
RDF export export_rdf() β€” full or filtered graph to Turtle/NT/NQuads/JSON-LD
SHACL validation validate_shacl() β€” SHACL Core via PySHACL; ValidationReport dataclass
PROV-O prov_export() β€” temporal edges as W3C PROV-O provenance graph

Performance

Hardware: M3 Ultra, Community IRIS 2026.1, ARM64 Docker.

Query latency

Query Latency Notes
1-hop neighbor lookup ~0.4ms $Order on ^KG
NKG fast-path [*1..N], hops 2–5 1.4–2.0ms 4.9–13.4x faster than SQL path
IC3 2-hop with LIMIT (LDBC SF10) 1.2ms 3.5x faster than GES/GraphScope
IC13 shortest path (LDBC SF10) 2.1–3.2ms Comparable to GES at SF1000 on cluster
HNSW vector search (768-dim) 1.7ms Native IRIS VECTOR index
BM25 full-text (174 nodes, 3-term) 0.3ms Posting-list $Order
Temporal window query 0.1ms O(results), B-tree
Pre-aggregated bucket (24hr/288 buckets) 0.16ms O(buckets), not O(edges)

Algorithm comparison (vs Neo4j GDS and networkx)

IVG is competitive with or faster than Neo4j GDS on degree centrality, betweenness, and Leiden community detection, producing results identical to networkx (Pearson r = 1.0). Validated on DRKG biomedical KG (~97K nodes / ~5.9M edges).

Full methodology and numbers: docs/performance/BENCHMARKS.md and docs/performance/GRAPH_ALGORITHMS.md.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    iris-vector-graph  v2.1.0                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚   β”‚  Python SDK   β”‚   β”‚  Cypher/AQL   β”‚   β”‚   Bolt (wire)     β”‚    β”‚
β”‚   β”‚  IRISGraph    β”‚   β”‚  translator   β”‚   β”‚   neo4j-driver    β”‚    β”‚
β”‚   β”‚  Engine       β”‚   β”‚  + executor   β”‚   β”‚   compatible      β”‚    β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                    β”‚               β”‚
β”‚                          β–Ό                          β”‚               β”‚
β”‚             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚               β”‚
β”‚             β”‚   GraphStore protocol  β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚             β”‚   (pluggable backend)  β”‚                              β”‚
β”‚             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β”‚
β”‚                         β”‚                                           β”‚
β”‚          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                           β”‚
β”‚          β–Ό              β–Ό              β–Ό                            β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚   β”‚  SQL layer  β”‚ β”‚  ^KG     β”‚ β”‚  ^NKG         β”‚                  β”‚
β”‚   β”‚  Graph_KG.* β”‚ β”‚  globals β”‚ β”‚  integer adj  β”‚                  β”‚
β”‚   β”‚  (nodes,    β”‚ β”‚  (edges, β”‚ β”‚  index        β”‚                  β”‚
β”‚   β”‚   edges,    β”‚ β”‚   temp,  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚   β”‚   vectors)  β”‚ β”‚   PPR)   β”‚         β”‚                          β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚                          β”‚
β”‚                                         β–Ό                          β”‚
β”‚                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚                              β”‚  Algorithm tiers   β”‚               β”‚
β”‚                              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€               β”‚
β”‚                              β”‚ 1. Rust acceleratorβ”‚ ← fastest     β”‚
β”‚                              β”‚    (rayon parallel)β”‚               β”‚
β”‚                              β”‚ 2. ObjectScript    β”‚               β”‚
β”‚                              β”‚    parallel 8Γ—     β”‚               β”‚
β”‚                              β”‚ 3. Python LazyKG   β”‚ ← always worksβ”‚
β”‚                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚                                                                     β”‚
β”‚   Centrality:  betweenness (Brandes) Β· closeness Β· eigenvector     β”‚
β”‚                degree                                              β”‚
β”‚   Community:   Leiden Β· triangle count Β· SCC Β· k-core             β”‚
β”‚   Search:      vector (HNSW/IVF/PLAID) Β· BM25 Β· temporal Β· PPR   β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Full schema and ObjectScript class reference: docs/architecture/ARCHITECTURE.md.


Semantic Layer (RDF / SHACL / PROV-O)

pip install 'iris-vector-graph[rdf]'
# Export graph as Turtle (full or filtered)
engine.export_rdf("kg.ttl")
engine.export_rdf("proteins.nt", format="nt", label_filter=["Protein", "Disease"])
engine.export_rdf_from_cypher("MATCH (p:Patient)-[r]->(e) RETURN p,r,e", "patients.ttl")

# Persistent namespace prefixes
engine.register_namespace("fhir", "http://hl7.org/fhir/")

# SHACL Core validation
report = engine.validate_shacl("shapes/patient.ttl")
if not report.conforms:
    for v in report.violations:
        print(f"{v.focus_node}: {v.message} [{v.severity}]")

# PROV-O temporal provenance
engine.prov_export("provenance.ttl", ts_start=1700000000)
prov = engine.prov_as_dict(edge_id=42)

Every write to ivg is stored as W3C-aligned SPO triples (rdf_edges, rdf_props, rdf_labels) with OWL 2 RL inference, named graph support, and RDF-star style edge qualifiers. See docs/SEMANTIC_LAYER.md for the full guide: format reference, SHACL shape writing, PROV-O vocabulary mapping, and integration patterns.


Documentation

Document Contents
User Guide Cypher examples, temporal edges, vector search, bulk loader
Admin Guide Container setup, schema management, index rebuilding
Admin API Python API reference for engine administration
Benchmarks Full methodology, LDBC SNB results, ingestion throughput
Graph Algorithms Centrality and community detection benchmark details
Semantic Layer RDF export, SHACL validation, PROV-O provenance
Changelog Full version history

License

MIT. See LICENSE.

About

High-performance graph database + vector search powered by InterSystems IRIS

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors