Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DHO Knowledge Graph Data Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital History
Digital History Forschung
Digital Heraldry
DHO Knowledge Graph Data Integration
Commits
c2d73d30
Commit
c2d73d30
authored
1 year ago
by
Philipp Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Rename variable to better align with names in ontology
parent
9d996f52
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rdf-mappings/map-tblArmItems.py
+18
-18
18 additions, 18 deletions
src/rdf-mappings/map-tblArmItems.py
with
18 additions
and
18 deletions
src/rdf-mappings/map-tblArmItems.py
+
18
−
18
View file @
c2d73d30
...
...
@@ -106,23 +106,23 @@ if mapping_config['initial_instance_definitions'] != None:
# Iterate through CSV to build graph
for
index
,
row
in
df_tblArmItems
.
iterrows
():
# Create node for coat of arms re
ference
coa_re
ference
_node
=
URIRef
(
dho_rep_n
+
'
MS
'
+
str
(
row
[
'
ArmCode
'
])
+
'
-
'
+
str
(
int
(
row
[
'
ArmItemID
'
])))
g
.
add
((
coa_re
ference
_node
,
RDF
.
type
,
dho_rep_n
.
CoatOfArmsRepresentation
))
g
.
add
((
coa_re
ference
_node
,
RDF
.
type
,
OWL
.
NamedIndividual
))
# Create node for coat of arms re
presentation
coa_re
presentation
_node
=
URIRef
(
dho_rep_n
+
'
MS
'
+
str
(
row
[
'
ArmCode
'
])
+
'
-
'
+
str
(
int
(
row
[
'
ArmItemID
'
])))
g
.
add
((
coa_re
presentation
_node
,
RDF
.
type
,
dho_rep_n
.
CoatOfArmsRepresentation
))
g
.
add
((
coa_re
presentation
_node
,
RDF
.
type
,
OWL
.
NamedIndividual
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasOMAArmItem
,
Literal
(
str
(
int
(
row
[
'
ArmItemID
'
])),
datatype
=
XSD
.
string
)))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasOMAArmItem
,
Literal
(
str
(
int
(
row
[
'
ArmItemID
'
])),
datatype
=
XSD
.
string
)))
if
not
pd
.
isnull
(
row
[
'
ItemNr
'
]):
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasItemID
,
Literal
(
int
(
row
[
'
ItemNr
'
]))))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasItemID
,
Literal
(
int
(
row
[
'
ItemNr
'
]))))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
folioNumber
,
Literal
(
str
(
row
[
'
FolNr
'
]))))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
folioNumber
,
Literal
(
str
(
row
[
'
FolNr
'
]))))
# Create description event
description_event_node
=
URIRef
(
dho_rep_n
+
str
(
uuid
.
uuid4
()))
g
.
add
((
description_event_node
,
RDF
.
type
,
dho_rep_n
.
CoADescriptionAct
))
g
.
add
((
description_event_node
,
RDF
.
type
,
OWL
.
NamedIndividual
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasDescriptionAct
,
description_event_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasDescriptionAct
,
description_event_node
))
# Link coat of arms reference to coat of arms description
coa_id
=
str
(
row
[
'
BranchIDR
'
])
...
...
@@ -131,8 +131,8 @@ for index, row in df_tblArmItems.iterrows():
if
row
[
'
checked_for_publication
'
]
==
True
and
(
row
[
'
descriptor_id
'
]
==
int
(
2
)
or
pd
.
isnull
(
row
[
'
descriptor_id
'
])
):
person_uri
=
URIRef
(
dho_data_n
+
'
Philipp-Schneider
'
)
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
description_event_node
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
description_event_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
add_data_to_description_event
(
description_event_node
,
coa_node
,
row
,
person_uri
)
elif
row
[
'
descriptor_id
'
]
==
int
(
1
)
or
pd
.
isnull
(
row
[
'
descriptor_id
'
]):
...
...
@@ -140,7 +140,7 @@ for index, row in df_tblArmItems.iterrows():
add_data_to_description_event
(
description_event_node
,
coa_node
,
row
,
person_uri
)
if
(
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
None
)
not
in
g
:
if
(
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
None
)
not
in
g
:
if
row
[
'
checked_for_publication
'
]
==
True
:
primary_person_uri
=
URIRef
(
dho_data_n
+
'
Philipp-Schneider
'
)
...
...
@@ -149,13 +149,13 @@ for index, row in df_tblArmItems.iterrows():
g
.
add
((
primary_description_event_node
,
RDF
.
type
,
dho_rep_n
.
CoADescriptionAct
))
g
.
add
((
primary_description_event_node
,
RDF
.
type
,
OWL
.
NamedIndividual
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
primary_description_event_node
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
primary_description_event_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
add_data_to_description_event
(
primary_description_event_node
,
coa_node
,
row
,
primary_person_uri
)
else
:
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
description_event_node
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryDescriptionAct
,
description_event_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
hasPrimaryBlazon
,
coa_node
))
# elif pd.isnull(row['descriptor_id']):
# person_uri = URIRef(dho_data_n + 'Philipp-Schneider')
...
...
@@ -167,7 +167,7 @@ for index, row in df_tblArmItems.iterrows():
textual_transcription_node
=
URIRef
(
dho_rep_n
+
str
(
uuid
.
uuid4
()))
g
.
add
((
textual_transcription_node
,
RDF
.
type
,
dho_rep_n
.
TextualTranskription
))
g
.
add
((
textual_transcription_node
,
RDF
.
type
,
OWL
.
NamedIndividual
))
g
.
add
((
coa_re
ference
_node
,
dho_rep_n
.
textHasTranscription
,
textual_transcription_node
))
g
.
add
((
coa_re
presentation
_node
,
dho_rep_n
.
textHasTranscription
,
textual_transcription_node
))
g
.
add
((
textual_transcription_node
,
dho_rep_n
.
textHasPrimaryTranscription
,
Literal
(
str
(
row
[
'
ArmTxt
'
]))))
###################################
...
...
@@ -181,10 +181,10 @@ for index, row in df_tblArmItems.iterrows():
# identification_event_node = URIRef(dho_rep_n + str(uuid.uuid4()))
# g.add((identification_event_node, RDF.type, dho_ent_n.CoAIdentificationAct))
# g.add((identification_event_node, RDF.type, OWL.NamedIndividual))
# g.add((coa_re
ference
_node, dho_ent_n.hasIdentificationAct, identification_event_node))
# g.add((coa_re
presentation
_node, dho_ent_n.hasIdentificationAct, identification_event_node))
#g.add((identification_event_node, dho_ent_n.attributesCoATo, identified_entity))
#g.add((coa_re
ference
_node, dho_ent_n.hasPrimaryIdentification, identified_entity))
#g.add((coa_re
presentation
_node, dho_ent_n.hasPrimaryIdentification, identified_entity))
# Link identification to Steen Clemmensen (since data transformation only concerns his coa identifications)
# person_uri = URIRef(dho_data_n + 'Steen-Clemmensen')
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment