GraphRAG Ontology Reference

The GraphRAG namespace https://graphrag.org/ns/ (prefix gr:) defines the vocabulary used to represent GraphRAG knowledge graphs in pg_ripple.

Classes

gr:Entity

A named entity extracted from source text.

Required properties: gr:title
Optional properties: gr:type, gr:description, gr:frequency, gr:degree

gr:Relationship

A directed relationship between two entities.

Required properties: gr:source, gr:target
Optional properties: gr:description, gr:weight

gr:TextUnit

A chunk of source text from which entities were extracted.

Required properties: gr:text
Optional properties: gr:tokenCount, gr:documentId, gr:mentionsEntity

gr:Community

A community of related entities (from community detection).

Optional properties: gr:title, gr:description, gr:rank, gr:level

gr:CommunityReport

A natural-language summary report for a community.

Optional properties: gr:summary, gr:findings, gr:rating

Properties

Data properties

PropertyDomainRangeNotes
gr:titlegr:Entity, gr:Communityxsd:stringDisplay label
gr:typegr:Entityxsd:stringE.g. "PERSON", "ORGANIZATION"
gr:descriptionanyxsd:stringFree-text description
gr:textgr:TextUnitxsd:stringRaw source text
gr:tokenCountgr:TextUnitxsd:integerToken count
gr:frequencygr:Entityxsd:integerMention frequency
gr:degreegr:Entityxsd:integerGraph degree (# relationships)
gr:weightgr:Relationshipxsd:floatRelationship strength 0–1
gr:rankgr:Communityxsd:integerCommunity rank
gr:levelgr:Communityxsd:integerHierarchical level
gr:summarygr:CommunityReportxsd:stringSummary text
gr:ratinggr:CommunityReportxsd:floatImpact rating

Object properties

PropertyDomainRangeNotes
gr:sourcegr:Relationshipgr:EntityRelationship source entity
gr:targetgr:Relationshipgr:EntityRelationship target entity
gr:mentionsEntitygr:TextUnitgr:EntityEntity mentioned in text unit
gr:documentIdgr:TextUnitgr:DocumentSource document
gr:hasReportgr:Communitygr:CommunityReportCommunity report

Derived properties (Datalog)

These properties are not loaded directly but derived by the enrichment rule set:

PropertySemantics
gr:coworkerSymmetric — share a common relationship target
gr:collaboratesSymmetric — both mentioned in the same text unit
gr:indirectReportTransitive closure of gr:manages
gr:relatedOrgOrganizations bridged by a shared entity

Ontology file

The full OWL ontology is shipped as sql/graphrag_ontology.ttl. Load it with:

SELECT pg_ripple.load_turtle(pg_read_file('/path/to/graphrag_ontology.ttl'));

SHACL shapes

Validation shapes are in sql/graphrag_shapes.ttl. Load with:

SELECT pg_ripple.load_shacl(pg_read_file('/path/to/graphrag_shapes.ttl'));