Skip to content

Commit

Permalink
Add deprecated concepts #41
Browse files Browse the repository at this point in the history
  • Loading branch information
maipet committed Oct 21, 2024
1 parent 1044b6e commit 6192a3e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
23 changes: 23 additions & 0 deletions create_faechersystematik_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def extract_preflabel_translations(current_ttl):
pref_label_dict_list.append(pref_label_dict)
return pref_label_dict_list

def extract_deprecated_notations(current_ttl):
g_old = Graph()
g_old.parse(current_ttl, format="ttl")
qres = g_old.query(
"""
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <https://w3id.org/kim/hochschulfaechersystematik/>
SELECT *
WHERE {
?concept owl:deprecated true ;
?p ?o .
}""")

return qres

def add_pref_labels_lang(level_dict_list, current_pref_labels_dict):
for idx, i in enumerate(level_dict_list):
notation = level_dict_list[idx]['notation']
Expand All @@ -41,6 +58,7 @@ def add_pref_labels_lang(level_dict_list, current_pref_labels_dict):
# extract translations of prefLabels
current_hfs_file = "https://github.com/dini-ag-kim/hochschulfaechersystematik/blob/master/hochschulfaechersystematik.ttl?raw=true"
lang_preflabel_list = extract_preflabel_translations(current_hfs_file)
hfs_deprecated_notations = extract_deprecated_notations(current_hfs_file)

# extract hfs data from destatis files
url_1st_level = "https://github.com/dini-ag-kim/destatis-schluesseltabellen/blob/main/studierende/Faechergruppe.csv?raw=true"
Expand Down Expand Up @@ -143,4 +161,9 @@ def add_pref_labels_lang(level_dict_list, current_pref_labels_dict):
g.add((URIRef('n0'), skos['notation'], Literal('0')))
g.add((URIRef('scheme'), skos['hasTopConcept'], (URIRef('n0'))))
g.bind("dct", DCTERMS)

# add deprecated notations
for row in hfs_deprecated_notations:
g.add((URIRef(row.concept), row.p, row.o))

g.serialize('hochschulfaechersystematik.ttl', format='turtle')
30 changes: 28 additions & 2 deletions hochschulfaechersystematik.ttl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@base <https://w3id.org/kim/hochschulfaechersystematik/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix schema: <https://schema.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<scheme> a skos:ConceptScheme ;
dct:alternative "Hochschulfächersystematik"@de ;
Expand Down Expand Up @@ -1498,7 +1500,9 @@
skos:broader <n39> ;
skos:inScheme <scheme> ;
skos:notation "128" ;
skos:prefLabel "Physik"@de, "Physics"@en, "Фізика"@uk .
skos:prefLabel "Physik"@de,
"Physics"@en,
"Фізика"@uk .

<n129> a skos:Concept ;
skos:broader <n25> ;
Expand Down Expand Up @@ -2276,6 +2280,26 @@
"Automotive Technology"@en,
"Автомобільний транспорт"@uk .

<n237> a skos:Concept ;
dct:isReplacedBy <n312> ;
owl:deprecated true ;
skos:broader <n37> ;
skos:inScheme <scheme> ;
skos:notation "237" ;
skos:prefLabel "Mathematische Statistik/Wahrscheinlichkeitsrechnung"@de,
"Mathematical statistics/probability calculation"@en,
"Математична статистика/Теорія ймовірності"@uk .

<n241> a skos:Concept ;
owl:deprecated true ;
skos:broader <n63> ;
skos:inScheme <scheme> ;
skos:notation "241" ;
skos:note "Integrated into 211"@en ;
skos:prefLabel "Kerntechnik/Kernverfahrenstechnik"@de,
"Nuclear technology/nuclear process engineering"@en,
"Атомна інженерія/Інженерія ядерних процесів"@uk .

<n242> a skos:Concept ;
skos:broader <n66> ;
skos:inScheme <scheme> ;
Expand Down Expand Up @@ -2544,7 +2568,9 @@
skos:broader <n18> ;
skos:inScheme <scheme> ;
skos:notation "292" ;
skos:prefLabel "Islamische Studien/Islamische Theologie"@de, "Islamic Studies/Islamic Theology"@en, "Ісламознавство"@uk .
skos:prefLabel "Islamische Studien/Islamische Theologie"@de,
"Islamic Studies/Islamic Theology"@en,
"Ісламознавство"@uk .

<n294> a skos:Concept ;
skos:broader <n72> ;
Expand Down

0 comments on commit 6192a3e

Please sign in to comment.