|
6 | 6 | import requests |
7 | 7 | from pathlib import Path |
8 | 8 |
|
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 | | - |
17 | 9 | # === BASE DIRS === |
18 | 10 | SCRIPT_DIR = Path(__file__).parent # tools/python/converter |
19 | 11 | ROOT_DIR = SCRIPT_DIR.parent.parent.parent # ../../.. from converter -> root of repo |
|
25 | 17 | # === CONFIG === |
26 | 18 | BASE_URI = "https://ontology.atlas-regenmat.ch/" |
27 | 19 | ME = Namespace(BASE_URI) |
| 20 | +QUDT = Namespace("http://qudt.org/schema/qudt/") |
28 | 21 |
|
| 22 | +# Google Sheets IDs, you can find them in the URL of the sheet |
29 | 23 | 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" |
32 | 26 |
|
33 | 27 | # === HELPERS === |
34 | 28 | def to_camel_case(s: str) -> str: |
@@ -71,7 +65,7 @@ def add_concept_from_row(g, row, is_property=False): |
71 | 65 | if is_property: |
72 | 66 | for extra_field in ['symbol', 'unit']: |
73 | 67 | 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]))) |
75 | 69 |
|
76 | 70 | # === MAIN === |
77 | 71 | # Load environment variables |
@@ -105,6 +99,7 @@ def add_concept_from_row(g, row, is_property=False): |
105 | 99 | @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
106 | 100 | @prefix dct: <http://purl.org/dc/terms/> . |
107 | 101 | @prefix vann: <http://purl.org/vocab/vann/> . |
| 102 | +@prefix qudt: <http://qudt.org/schema/qudt/> . |
108 | 103 |
|
109 | 104 | @base <https://ontology.atlas-regenmat.ch/> . |
110 | 105 |
|
|
0 commit comments