Skip to content

Commit f5e3379

Browse files
committed
fix: unit and symbol according to qudt
1 parent fed7240 commit f5e3379

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

tools/python/converter/csv2ont.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
import requests
77
from pathlib import Path
88

9-
# Base folder of the script
10-
BASE_DIR = Path(__file__).parent.parent.parent # adjust as needed from converter/csv2ont.py
11-
12-
# Path to the TTL file
13-
TTL_PATH = BASE_DIR / "src" / "ontology" / "AREMA-ontology.ttl"
14-
TTL_PATH.parent.mkdir(parents=True, exist_ok=True) # make sure the directory exists
15-
16-
179
# === BASE DIRS ===
1810
SCRIPT_DIR = Path(__file__).parent # tools/python/converter
1911
ROOT_DIR = SCRIPT_DIR.parent.parent.parent # ../../.. from converter -> root of repo
@@ -25,10 +17,12 @@
2517
# === CONFIG ===
2618
BASE_URI = "https://ontology.atlas-regenmat.ch/"
2719
ME = Namespace(BASE_URI)
20+
QUDT = Namespace("http://qudt.org/schema/qudt/")
2821

22+
# Google Sheets IDs, you can find them in the URL of the sheet
2923
sheet_id = "1RL6Y120_H9-yD8x52eZO44S2iLQpLoZHitcExHsPfPs"
30-
objects_gid = "1120751986" # your objects sheet gid
31-
properties_gid = "373147482" # your properties sheet gid
24+
objects_gid = "1120751986"
25+
properties_gid = "373147482"
3226

3327
# === HELPERS ===
3428
def to_camel_case(s: str) -> str:
@@ -71,7 +65,7 @@ def add_concept_from_row(g, row, is_property=False):
7165
if is_property:
7266
for extra_field in ['symbol', 'unit']:
7367
if pd.notna(row.get(extra_field)):
74-
g.add((concept_uri, ME[extra_field], Literal(row[extra_field])))
68+
g.add((concept_uri, QUDT[extra_field], Literal(row[extra_field])))
7569

7670
# === MAIN ===
7771
# Load environment variables
@@ -105,6 +99,7 @@ def add_concept_from_row(g, row, is_property=False):
10599
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
106100
@prefix dct: <http://purl.org/dc/terms/> .
107101
@prefix vann: <http://purl.org/vocab/vann/> .
102+
@prefix qudt: <http://qudt.org/schema/qudt/> .
108103
109104
@base <https://ontology.atlas-regenmat.ch/> .
110105

0 commit comments

Comments
 (0)