Skip to main content

Example UniKG RDFGraph

Throughout the documentation on Kùzu's RDFGraph feature, we will use the following set of triples about students and faculty at universities, which we call UniKG.

The DDL statements to define the RDFGraph, the Turtle (.ttl) file containing the triples, and the data import (COPY FROM) commands are given below. You can copy-paste and type these commands in the Kùzu command line interface or KùzuExplorer to replicate the examples in this documentation locally.

Creating the RDFGraph and Importing the Triples


We will use the following 14 triples stored in a uni.ttl Turtle file:

@prefix kz: <> .
@prefix rdf: <> .
@prefix rdfs: <> .

kz:Waterloo a kz:City ;
kz:name "Waterloo"@en ;
kz:population 150000 .

kz:Adam a kz:student ;
kz:livesIn kz:Waterloo ;
kz:name "Adam" ;
kz:age 30 .

kz:student rdfs:subClassOf kz:person .

kz:Karissa a kz:student ;
kz:bornIn kz:Waterloo ;
kz:name "Karissa" .

kz:Zhang a kz:faculty ;
kz:name "Zhang" .

kz:faculty rdfs:subClassOf kz:person .

Data import. We assume ${PATH-TO-DIR} is the directory containing uni.ttl file:

COPY UniKG FROM "${PATH-TO-DIR}/uni.ttl";

You can double check that there are 14 triples with the following query:

MATCH (s)-[p:UniKG]->(o) RETURN count(*);


| 14 |