Skip to content

Commit

Permalink
Fix duplicate notation 'n10'
Browse files Browse the repository at this point in the history
  • Loading branch information
maipet committed Jul 9, 2024
1 parent 9bbee5c commit e11fc5a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
11 changes: 8 additions & 3 deletions create_faechersystematik_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
df_2nd_level = pd.read_csv(url_2nd_level, encoding="ISO-8859-1", sep=';', quotechar='"', header=None, engine ='python', dtype=str, usecols=[0, 2, 3], names=["notation", "label", "broader"])
df_3rd_level = pd.read_csv(url_3rd_level, encoding="ISO-8859-1", sep=';', quotechar='"', header=None, engine ='python', dtype=str, usecols=[0, 2, 3], names=["notation", "label", "broader"])

df_1st_level['notation'] = df_1st_level['notation'].str.lstrip("0")
df_2nd_level['broader'] = df_2nd_level['broader'].str.lstrip("0")
df_1st_level['notation'] = df_1st_level['notation'].apply(lambda n: "00" if n == "10" else n)
df_2nd_level['broader'] = df_2nd_level['broader'].apply(lambda n: "00" if n == "10" else n)

dict_1st_level = df_1st_level.to_dict("records")
dict_2nd_level = df_2nd_level.to_dict("records")
dict_3rd_level = df_3rd_level.to_dict("records")
Expand Down Expand Up @@ -37,18 +42,18 @@


for idx, i in enumerate(dict_1st_level):
top_level = dict_1st_level[idx]['notation'].lstrip("0")
top_level = dict_1st_level[idx]['notation']
g.add((URIRef('n%s' % top_level), RDF['type'], skos['Concept']))
g.add((URIRef('n%s' % top_level), skos['topConceptOf'], (URIRef('scheme'))))
g.add((URIRef('n%s' % top_level), skos['prefLabel'], Literal(dict_1st_level[idx]['label'], lang='de')))
g.add((URIRef('n%s' % top_level), skos['notation'], Literal(top_level)))
g.add((URIRef('scheme'), skos['hasTopConcept'], (URIRef('n%s' % top_level))))
for idx_2, i_2 in enumerate(dict_2nd_level):
if dict_2nd_level[idx_2]['broader'].lstrip("0") == top_level:
if dict_2nd_level[idx_2]['broader'] == top_level:
level_2_notation = dict_2nd_level[idx_2]['notation']
g.add((URIRef('n%s' % level_2_notation), RDF['type'], skos['Concept']))
g.add((URIRef('n%s' % level_2_notation), skos['prefLabel'], Literal(dict_2nd_level[idx_2]['label'], lang='de')))
g.add((URIRef('n%s' % level_2_notation), skos['broader'], (URIRef('n%s' % dict_2nd_level[idx_2]['broader'].lstrip('0')))))
g.add((URIRef('n%s' % level_2_notation), skos['broader'], (URIRef('n%s' % dict_2nd_level[idx_2]['broader']))))
g.add((URIRef('n%s' % level_2_notation), skos['notation'], Literal(level_2_notation)))
g.add((URIRef('n%s' % level_2_notation), skos['inScheme'], (URIRef('scheme'))))
for idx_3, i_3 in enumerate(dict_3rd_level):
Expand Down
27 changes: 13 additions & 14 deletions hochschulfaechersystematik.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,11 @@
skos:notation "70" ;
skos:prefLabel "Wirtschaftsingenieurwesen mit ingenieurwissenschaftlichem Schwerpunkt"@de .

<n00> a skos:Concept ;
skos:notation "00" ;
skos:prefLabel "Außerhalb der Studienbereichsgliederung/Sonstige Fächer"@de ;
skos:topConceptOf <scheme> .

<n01> a skos:Concept ;
skos:broader <n1> ;
skos:inScheme <scheme> ;
Expand All @@ -1746,6 +1751,12 @@
skos:notation "06" ;
skos:prefLabel "Informations- und Bibliothekswissenschaften"@de .

<n10> a skos:Concept ;
skos:broader <n1> ;
skos:inScheme <scheme> ;
skos:notation "10" ;
skos:prefLabel "Anglistik, Amerikanistik"@de .

<n2> a skos:Concept ;
skos:notation "2" ;
skos:prefLabel "Sport"@de ;
Expand Down Expand Up @@ -1884,23 +1895,11 @@
skos:prefLabel "Ernährungs- und Haushaltswissenschaften"@de .

<n83> a skos:Concept ;
skos:broader <n10> ;
skos:broader <n00> ;
skos:inScheme <scheme> ;
skos:notation "83" ;
skos:prefLabel "Außerhalb der Studienbereichsgliederung"@de .

<n10> a skos:Concept ;
skos:broader <n1> ;
skos:inScheme <scheme> ;
skos:notation "10" ;
skos:prefLabel "Anglistik, Amerikanistik"@de .

<n00> a skos:Concept ;
skos:notation "00" ;
skos:prefLabel "Außerhalb der Studienbereichsgliederung/Sonstige Fächer"@de ;
skos:topConceptOf <scheme> .


<n36> a skos:Concept ;
skos:broader <n4> ;
skos:inScheme <scheme> ;
Expand Down Expand Up @@ -2107,8 +2106,8 @@
vann:preferredNamespacePrefix "hfs" ;
vann:preferredNamespaceUri "https://w3id.org/kim/hochschulfaechersystematik/" ;
skos:hasTopConcept <n0>,
<n1>,
<n00>,
<n1>,
<n15>,
<n2>,
<n20>,
Expand Down

0 comments on commit e11fc5a

Please sign in to comment.