Skip to content

Commit d1a44dd

Browse files
committed
Add Nepal Heritage Knowledge Graph and ETL pipeline
Integrate heritage data from Wikidata, OpenStreetMap, UNESCO, and curated intangible heritage sources. Validate with SHACL, include provenance modeling, competency queries, and Fuseki deployment support.
1 parent 68093a9 commit d1a44dd

29 files changed

Lines changed: 184007 additions & 2 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ Eval.pdf
4242
# WIDOCO build artifacts (source of truth is ontology/HeritageGraph.ttl)
4343
ontology/HeritageGraph.merged.ttl
4444
ontology/HeritageGraph.build.ttl
45+
46+
# KG build: binary triplestore + introspection cache (regenerable)
47+
data/fuseki/
48+
data/raw/shapes_spec.json
49+
/tmp/

cq_sparql.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ASK WHERE {
2525
heritageGraph:Production a owl:Class .
2626
heritageGraph:TimeSpan a owl:Class .
2727
heritageGraph:has_architectural_style a owl:ObjectProperty .
28-
heritageGraph:has_architectural_style rdfs:range crm:E55_Type .
28+
heritageGraph:has_architectural_style rdfs:range heritageGraph:ArchitecturalStyleEnum .
2929
heritageGraph:was_produced_by_event a owl:ObjectProperty .
3030
heritageGraph:has_timespan a owl:ObjectProperty .
3131
heritageGraph:date_earliest a owl:DatatypeProperty .
@@ -89,11 +89,12 @@ CQ6. Which heritage shares a common architectural style?
8989
```sparql
9090
PREFIX heritageGraph: <https://w3id.org/heritagegraph/>
9191
PREFIX owl: <http://www.w3.org/2002/07/owl#>
92+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
9293
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
9394
ASK WHERE {
9495
heritageGraph:ArchitecturalStructure a owl:Class .
9596
heritageGraph:has_architectural_style a owl:ObjectProperty .
96-
heritageGraph:has_architectural_style rdfs:range crm:E55_Type .
97+
heritageGraph:has_architectural_style rdfs:range heritageGraph:ArchitecturalStyleEnum .
9798
}
9899
```
99100

data/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# HeritageGraph Knowledge Graph (Nepal)
2+
3+
A real, production-grade RDF knowledge graph of Nepal's cultural heritage,
4+
populated from **trusted open data sources** and conformant to the
5+
[HeritageGraph ontology](../ontology/HeritageGraph.ttl) and its
6+
[SHACL shapes](../ontology/HeritageGraph.shacl.ttl).
7+
8+
No synthetic data is used. Every entity is derived from a public, verifiable
9+
source and carries machine-readable provenance.
10+
11+
## Contents
12+
13+
| File | Triples | Description |
14+
|------|--------:|-------------|
15+
| `kg/wikidata.ttl` | ~4,000 | Heritage entities from Wikidata (CC0) |
16+
| `kg/osm.ttl` | ~114,000 | Physical heritage features from OpenStreetMap (ODbL) |
17+
| `kg/unesco.ttl` | ~150 | UNESCO World Heritage cultural components |
18+
| `kg/intangible.ttl` | ~350 | Curated **intangible heritage** (festivals, Guthi, Kumari, deities, castes, rituals) |
19+
| `kg/crosswalk.ttl` + `intangible_crosswalk.ttl` | ~19,700 | `owl:sameAs` / `skos:altLabel` / provenance back-links (not SHACL-validated) |
20+
| `build_stats.json` || Entity counts per source and per class |
21+
22+
**~7,850 tangible heritage entities** plus a curated **intangible-heritage** layer, across Nepal.
23+
24+
### Intangible heritage (curated layer)
25+
26+
Intangible heritage is not available in bulk open datasets, so `intangible.ttl`
27+
is hand-curated from authoritative, citable sources (Wikidata CC0; UNESCO; and
28+
the scholarship of Slusser, Toffin, Gellner, Locke; NHDP) and cross-linked to
29+
Wikidata QIDs. It covers: festivals & chariot festivals (Indra Jatra, Rato/Seto
30+
Machhindranath, Bisket, Gai Jatra, Ghode Jatra), masked dances (Navadurga,
31+
Lakhe), Guthi institutions (incl. Guthi Sansthan), caste ritual roles
32+
(Vajracharya, Shakya, Jyapu, Gathu, Manandhar), deities and **syncretic
33+
relationships** (Avalokiteshvara ≡ Matsyendranath; Taleju ↔ Kumari), periodic
34+
rituals (Nitya Puja, Kumari daily puja), and the **Living-Goddess (Kumari)
35+
lifecycle** modelled at institutional level (no named minors, for privacy).
36+
Traditional/uncertain dates carry `date_precision = Circa/Century`.
37+
38+
### Entity classes (whole KG)
39+
40+
| Class | Count |
41+
|-------|------:|
42+
| `heritageGraph:ArchitecturalStructure` | 6,769 |
43+
| `heritageGraph:BuddhistMonument` | 798 |
44+
| `heritageGraph:WaterStructure` | 141 |
45+
| `heritageGraph:DhungeDhara` | 115 |
46+
| `heritageGraph:Chaitya` | 13 |
47+
| `heritageGraph:Stupa` | 13 |
48+
| `heritageGraph:Murti` | 1 |
49+
50+
Generic temples are typed `ArchitecturalStructure` (their super-class) rather
51+
than `Temple`, because the `Temple` shape *requires* an architectural-style
52+
value from a fixed enum (`Pagoda`/`Shikhara`/…) that is not reliably present in
53+
the sources. Inventing a style would be fabrication, so the nearest fully
54+
satisfiable class is used. `Stupa``StupaStyle` and `Chaitya``ChaityaStyle`
55+
are definitional and therefore set.
56+
57+
## Sources & licensing (important for redistribution / AWS Open Data)
58+
59+
| Source | License | Implication |
60+
|--------|---------|-------------|
61+
| **Wikidata** | **CC0 1.0** | Public domain. The `wikidata.ttl` graph can be republished with no restriction. |
62+
| **OpenStreetMap** | **ODbL 1.0** | Share-alike + attribution. The `osm.ttl` graph (and any database derived from it) must retain "© OpenStreetMap contributors" and the ODbL. |
63+
| **UNESCO WHC** | Attribution | Factual inscriptions; cite the UNESCO World Heritage Centre. |
64+
65+
The sources are kept in **separate named graphs** so a pure-CC0 core (Wikidata +
66+
the factual UNESCO layer) can be published independently of the ODbL OSM layer.
67+
68+
Named graph IRIs:
69+
70+
```
71+
https://data.cair-nepal.org/heritagegraph/graph/wikidata
72+
https://data.cair-nepal.org/heritagegraph/graph/openstreetmap
73+
https://data.cair-nepal.org/heritagegraph/graph/unesco
74+
https://data.cair-nepal.org/heritagegraph/graph/crosswalk
75+
https://w3id.org/heritagegraph/ontology (TBox)
76+
```
77+
78+
## Namespaces
79+
80+
- **Schema / TBox**`https://w3id.org/heritagegraph/` (unchanged, published).
81+
- **Instances / ABox**`https://data.cair-nepal.org/heritagegraph/id/`
82+
(entities), `…/place/…`, `…/assertion/…`, `…/source/…`.
83+
84+
## Provenance model
85+
86+
Each entity links to a `heritageGraph:DataSource` (one per source dataset) via
87+
`prov:wasInfluencedBy`, and to a `crminf:I2_Belief` provenance assertion via
88+
`heritageGraph:has_provenance_assertion`. The assertion records
89+
`prov:wasDerivedFrom`, `prov:generatedAtTime`, `heritageGraph:confidence_score`
90+
(Wikidata 0.9, UNESCO 0.95, OSM 0.6) and `heritageGraph:epistemic_stance`
91+
(`Scholarly` / `State` / `Community`). Dated inceptions (Wikidata P571, UNESCO
92+
inscription year) are recorded as `heritageGraph:asserted_value`.
93+
94+
The `owl:sameAs` links to Wikidata QIDs and `rdfs:seeAlso` to OSM elements live
95+
in `crosswalk.ttl` for full verifiability.
96+
97+
## SHACL conformance
98+
99+
`scripts/kg/validate.py` validates the generated core (entities + places +
100+
assertions + sources) against `HeritageGraph.shacl.ttl` and reports
101+
**Conforms: True**.
102+
103+
The shapes are LinkML-generated and `sh:closed`; they are designed for
104+
**exact-type validation** (each node checked against the shape of its declared
105+
`rdf:type`, no subclass inference). Under `inference="rdfs"` the closed,
106+
zero-property `crm:E1_CRM_Entity` shape becomes unsatisfiable for every
107+
instance — the project's own demonstrator ABox yields 51 violations in that
108+
mode. The `asserts_about_entity` back-pointer (whose `sh:class crm:E1_CRM_Entity`
109+
is incompatible with that closed shape) is therefore kept in the unvalidated
110+
`crosswalk.ttl`; the forward `has_provenance_assertion` link is retained in the
111+
validated core.
112+
113+
## Rebuild from scratch
114+
115+
```bash
116+
source venv/bin/activate
117+
bash scripts/kg/build_kg.sh # extract -> transform -> validate
118+
bash scripts/kg/load_fuseki.sh # deploy Fuseki (Docker) + load named graphs
119+
python scripts/kg/run_cq.py # run competency questions against the live KG
120+
```
121+
122+
Requires: Python venv (`rdflib`, `pyshacl`), `curl`, Docker.
123+
Raw extracts are cached under `data/raw/` so transforms can be re-run offline.

data/kg/build_stats.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"wd": 253,
3+
"osm": 7589,
4+
"unesco": 8,
5+
"wd_skipped": 42,
6+
"osm_skipped": 2747,
7+
"cls": {
8+
"ArchitecturalStructure": 6769,
9+
"BuddhistMonument": 798,
10+
"Stupa": 13,
11+
"Murti": 1,
12+
"DhungeDhara": 115,
13+
"WaterStructure": 141,
14+
"Chaitya": 13
15+
}
16+
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
2+
==============================================================================
3+
CQ1 (data) Structures with a documented construction/inception date, chronologically
4+
------------------------------------------------------------------------------
5+
date,label,type
6+
0325-01-01T00:00:00Z,Changu Narayan Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
7+
1392-01-01T00:00:00Z,Kumbheshwar Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
8+
1409-01-01T00:00:00Z,Hiranya Varna Mahavihar,https://w3id.org/heritagegraph/ArchitecturalStructure
9+
1650-01-01T00:00:00Z,Tusha Hiti,https://w3id.org/heritagegraph/DhungeDhara
10+
1760-01-01T00:00:00Z,Bhairabi Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
11+
1806-01-01T00:00:00Z,Amarnaryan Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
12+
1817-01-01T00:00:00Z,Bhadrakali Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
13+
1817-01-01T00:00:00Z,Bhadrakali Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
14+
1905-01-01T00:00:00Z,tomb of Alexis Pache,https://w3id.org/heritagegraph/ArchitecturalStructure
15+
1916-01-01T00:00:00Z,Tengboche Monastery,https://w3id.org/heritagegraph/BuddhistMonument
16+
1927-01-01T00:00:00Z,Tansen Durbar,https://w3id.org/heritagegraph/ArchitecturalStructure
17+
1928-01-01T00:00:00Z,National Museum of Nepal,https://w3id.org/heritagegraph/ArchitecturalStructure
18+
1937-01-01T00:00:00Z,Baglamukhi Temple,https://w3id.org/heritagegraph/ArchitecturalStructure
19+
1942-01-01T00:00:00Z,Pranidhipurna Mahavihar,https://w3id.org/heritagegraph/BuddhistMonument
20+
1943-01-01T00:00:00Z,Ananda Kuti Vihar,https://w3id.org/heritagegraph/BuddhistMonument
21+
22+
==============================================================================
23+
CQ5 (data) Heritage typologies WITHIN the Kathmandu Valley (geographic bbox)
24+
------------------------------------------------------------------------------
25+
type,n
26+
https://w3id.org/heritagegraph/ArchitecturalStructure,1211
27+
https://w3id.org/heritagegraph/BuddhistMonument,221
28+
https://w3id.org/heritagegraph/DhungeDhara,95
29+
https://w3id.org/heritagegraph/WaterStructure,32
30+
https://w3id.org/heritagegraph/Stupa,5
31+
https://w3id.org/heritagegraph/Murti,1
32+
33+
==============================================================================
34+
CQ6 (data) Heritage sharing a common architectural style
35+
------------------------------------------------------------------------------
36+
style,n,example
37+
https://w3id.org/heritagegraph/StupaStyle,13,Boudhanath
38+
https://w3id.org/heritagegraph/ChaityaStyle,13,temple
39+
40+
==============================================================================
41+
CQ7 (data) Buddhist monuments in the Kathmandu Valley with coordinates (sample)
42+
------------------------------------------------------------------------------
43+
label,wkt
44+
क्वबाहाः ,POINT(85.5221386 27.6318125)
45+
1. Amitabha Buddha,POINT(85.2902624 27.7149301)
46+
10. Vajradhati Tara,POINT(85.2905061 27.7148847)
47+
2. Amoghashidhi Buddha,POINT(85.2904018 27.7150456)
48+
3. Akshyabha Buddha,POINT(85.2905159 27.7149085)
49+
4. Virochana Buddha,POINT(85.2905167 27.7149482)
50+
5. Ratnasambhava Buddha,POINT(85.2903659 27.714819)
51+
6. Aarya Tara,POINT(85.2902999 27.7150095)
52+
7. Saptalochani Tara,POINT(85.2904898 27.7149958)
53+
8. Maamaki Tara,POINT(85.2904662 27.7148428)
54+
55+
==============================================================================
56+
CQ (data) Traditional water heritage — Dhunge Dhara + water structures (sample)
57+
------------------------------------------------------------------------------
58+
type,label,wkt
59+
https://w3id.org/heritagegraph/DhungeDhara,Sundhara,POINT(85.3125 27.700694444)
60+
https://w3id.org/heritagegraph/DhungeDhara,Tusha Hiti,POINT(85.325111111 27.672722222)
61+
https://w3id.org/heritagegraph/DhungeDhara,LHO HITI:,POINT(85.4933073 27.6329701)
62+
https://w3id.org/heritagegraph/DhungeDhara,Salla Ghari Dhara,POINT(85.305553 27.65459)
63+
https://w3id.org/heritagegraph/DhungeDhara,Bahun Dhara,POINT(85.309113 27.652784)
64+
https://w3id.org/heritagegraph/DhungeDhara,Gaagle Dhara,POINT(85.309669 27.646341)
65+
https://w3id.org/heritagegraph/DhungeDhara,किवाना हिटी,POINT(85.306069 27.658667)
66+
https://w3id.org/heritagegraph/DhungeDhara,Twatigaa Hiti,POINT(85.30537 27.622413)
67+
https://w3id.org/heritagegraph/DhungeDhara,Tarpa Pukhu Hiti,POINT(85.293705 27.636509)
68+
https://w3id.org/heritagegraph/DhungeDhara,Wakhat Dhungedhara,POINT(85.326267 27.629343)
69+
https://w3id.org/heritagegraph/DhungeDhara,Pinga Docha Dhungedhara,POINT(85.321043 27.62931)
70+
https://w3id.org/heritagegraph/DhungeDhara,Barah Hiti Dhungedhara,POINT(85.315113 27.636446)
71+
72+
==============================================================================
73+
CQ25 (data) Cross-source corroboration: one entity attested by >1 source (shared QID)
74+
------------------------------------------------------------------------------
75+
wd,nSources,labels
76+
http://www.wikidata.org/entity/Q5769439,2,Hiranya Varna Mahavihar / हिरण्यवर्ण महाविहार
77+
http://www.wikidata.org/entity/Q15238480,2,Maya Devi Temple / Mayadevi Temple
78+
http://www.wikidata.org/entity/Q7126679,2,Palanchok Bhagawati Temple
79+
http://www.wikidata.org/entity/Q2385286,2,Manakamana Temple / Shree Manakamana Temple
80+
http://www.wikidata.org/entity/Q82281675,2,Shilu Mahadev Temple / Shilu Mahadev (Fasidega)
81+
http://www.wikidata.org/entity/Q29418925,2,Ramghatdham / Ramghat Temple
82+
http://www.wikidata.org/entity/Q854699,2,Bhairavnath temple / Bhairabnath Temple
83+
http://www.wikidata.org/entity/Q20058813,2,Tintale
84+
http://www.wikidata.org/entity/Q13020937,3,Royal Thai Monastery Lumbini Nepal / Royal Thai Monastery
85+
http://www.wikidata.org/entity/Q3811730,2,Maitighar Mandala / माइतिघर मण्डला
86+
http://www.wikidata.org/entity/Q1001415,2,Budhanilkantha Temple / Budhanilkantha
87+
http://www.wikidata.org/entity/Q109321229,2,Amarnaryan Temple / Amar Narayan Temple
88+
89+
==============================================================================
90+
CQ (data) Provenance: assertions by source, confidence and epistemic stance
91+
------------------------------------------------------------------------------
92+
stance,conf,n
93+
https://w3id.org/heritagegraph/Community,0.6,7589
94+
https://w3id.org/heritagegraph/Scholarly,0.9,253
95+
https://w3id.org/heritagegraph/Scholarly,0.85,10
96+
https://w3id.org/heritagegraph/State,0.95,8
97+
98+
==============================================================================
99+
CQ (data) UNESCO World Heritage components linked to Wikidata + coordinates
100+
------------------------------------------------------------------------------
101+
label,wd,wkt
102+
Bhaktapur Durbar Square,http://www.wikidata.org/entity/Q2891639,POINT(85.428 27.6722)
103+
Boudhanath,http://www.wikidata.org/entity/Q839176,POINT(85.362 27.7215)
104+
Changu Narayan,http://www.wikidata.org/entity/Q1066544,POINT(85.4297 27.7163)
105+
Hanuman Dhoka Durbar Square,http://www.wikidata.org/entity/Q1566083,POINT(85.307 27.7045)
106+
"Lumbini, the Birthplace of the Lord Buddha",http://www.wikidata.org/entity/Q5379,POINT(83.2767 27.4833)
107+
Pashupatinath Temple,http://www.wikidata.org/entity/Q1814492,POINT(85.3488 27.7104)
108+
Patan Durbar Square,http://www.wikidata.org/entity/Q2363972,POINT(85.325 27.6727)
109+
Swayambhunath,http://www.wikidata.org/entity/Q714056,POINT(85.2903 27.7149)
110+
111+
==============================================================================
112+
CQ (data) Whole-KG coverage: heritage entities per source named graph
113+
------------------------------------------------------------------------------
114+
g,entities
115+
https://data.cair-nepal.org/heritagegraph/graph/openstreetmap,7590
116+
https://data.cair-nepal.org/heritagegraph/graph/wikidata,254
117+
https://data.cair-nepal.org/heritagegraph/graph/intangible,24
118+
https://data.cair-nepal.org/heritagegraph/graph/crosswalk,12
119+
https://data.cair-nepal.org/heritagegraph/graph/unesco,9
120+
121+
==============================================================================
122+
CQ11 (data) Festivals/jatras: invoked deity, recurrence and place
123+
------------------------------------------------------------------------------
124+
festival,deity,recurrence
125+
Bisket Jatra (Biska Jatra),Bhairava,"annual (Baisakh, Nepali New Year)"
126+
Indra Jatra (Yenya),Indra,annual (Bhadra-Ashwin)
127+
Indra Jatra (Yenya),Taleju Bhawani,annual (Bhadra-Ashwin)
128+
Navadurga masked dance (Bhaktapur),Navadurga,annual (Ashwin-Bhadra cycle)
129+
Rato Machhindranath Jatra (Bunga Dyah Jatra),Avalokiteshvara (Karunamaya),annual (Baisakh-Jestha); every 12 years from Bungamati
130+
Rato Machhindranath Jatra (Bunga Dyah Jatra),Matsyendranath (Bungadyo),annual (Baisakh-Jestha); every 12 years from Bungamati
131+
Seto Machhindranath Jatra (Jana Baha Dyah Jatra),Seto Machhindranath (Jana Baha Dyah),annual (Chaitra)
132+
133+
==============================================================================
134+
CQ19 (data) Which Guthi manages which ritual/festival
135+
------------------------------------------------------------------------------
136+
guthi,gtype,managed
137+
Bunga Dyah (Rato Machhindranath) Jatra Guthi,JatraGuthi,Rato Machhindranath Jatra (Bunga Dyah Jatra)
138+
Guthi Sansthan,RajGuthi,Indra Jatra (Yenya)
139+
Guthi Sansthan,RajGuthi,Daily puja of the Royal Kumari
140+
Guthi Sansthan,RajGuthi,Nitya Puja at Pashupatinath
141+
Guthi Sansthan,RajGuthi,Selection of the Royal Kumari
142+
143+
==============================================================================
144+
CQ9 (data) Caste groups and their hereditary ritual roles
145+
------------------------------------------------------------------------------
146+
caste,role
147+
Gathu (Banmala),Newar gardener caste of Bhaktapur; hereditary performers of the Navadurga masked dance.
148+
Jyapu (Maharjan),Newar farming caste; hereditary chariot-pullers and ritual performers in jatras such as Rato Machhindranath.
149+
Manandhar (Saymi),Newar oil-presser caste with ritual roles in festival lamp lighting.
150+
Shakya,Newar Buddhist caste of the sangha; the Royal Kumari is selected from Shakya families.
151+
Vajracharya (Gubhaju),"Newar Vajrayana Buddhist priests; perform tantric ritual and temple priesthood, including consecration (pratistha) rites."
152+
153+
==============================================================================
154+
CQ12 (data) Festival ritual sequence (sub-events)
155+
------------------------------------------------------------------------------
156+
festival,ritual
157+
Rato Machhindranath Jatra (Bunga Dyah Jatra),Ritual bathing of Bungadyo
158+
Indra Jatra (Yenya),Royal Kumari chariot procession (Indra Jatra)
159+
160+
==============================================================================
161+
CQ25 (data) Syncretic links across Hindu/Buddhist traditions
162+
------------------------------------------------------------------------------
163+
relation,primary,equivalent,type
164+
Avalokiteshvara identified with Matsyendranath (Karunamaya),Avalokiteshvara (Karunamaya),Matsyendranath (Bungadyo),Equivalence
165+
Hindu goddess Taleju embodied in a Buddhist Shakya Kumari,Taleju Bhawani,,Identification
166+
167+
==============================================================================
168+
CQ26 (data) Living Goddess (Kumari): person, deity, residence, institution
169+
------------------------------------------------------------------------------
170+
tenure,person,deity,residence,institution
171+
Royal Kumari tenure (office),Royal Kumari of Kathmandu (office),Taleju Bhawani,"Kumari Ghar (Kumari Bahal), Kathmandu",Guthi Sansthan

0 commit comments

Comments
 (0)