Skip to content

Commit

Permalink
Update to current metafix (#137)
Browse files Browse the repository at this point in the history
And add some now required `set_array` statements, see
metafacture/metafacture-fix#110
  • Loading branch information
fsteeg committed Jan 28, 2022
1 parent 067fd1b commit 9e66745
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation 'org.metafacture:metafacture-elasticsearch:5.3.0-rc2'
implementation 'org.metafacture:metafacture-xml:5.3.0-rc2'
implementation 'org.metafacture:metafacture-fix:0.2.0-rc2'
implementation 'org.metafacture:metafix:0.2.0-SNAPSHOT'
implementation 'org.metafacture:metafix:0.2.0-rc9'
implementation('org.metafacture:metafacture-biblio:5.3.0-rc2') {
exclude group: 'xml-apis', module: 'xml-apis'
}
Expand Down
2 changes: 1 addition & 1 deletion data/production/duepublico/duepublico-to-oersi.flux
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ XML_FILE
| open-file
| decode-xml
| handle-generic-xml(emitNamespace="true")
| fix(FLUX_DIR + "duepublico.fix", *)
| metafix(FLUX_DIR + "duepublico.fix", *)
| encode-json(prettyPrinting="true")
| oersi.JsonValidator(output_schema, writeValid=metadata_valid, writeInvalid=metadata_invalid)
| oersi.OersiWriter(backend_api, user=backend_user, pass=backend_pass, log=metadata_responses)
Expand Down
11 changes: 6 additions & 5 deletions data/production/openRub/openRub.fix
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ replace_all("description", ' ', " ")
trim("description")

# ---------sourceOrganization---------
set_array("sourceOrganization[]")
add_field("sourceOrganization[].$append.name", "Ruhr-Universität Bochum")
add_field("sourceOrganization[].$last.type","Organization")

# ------------learningResourceType-----
lookup("learningResourceType", "data/maps/openRubLearningResourceTypes.tsv", "sep_char":"\t")
lookup("learningResourceType", "data/maps/hcrt-de-labels-to-uri.tsv", "sep_char":"\t")
set_array("learningResourceType[]")
copy_field("learningResourceType", "learningResourceType[].$append.id")
copy_field("learningResourceType", "learningResourceTypeDE")
move_field("learningResourceType", "learningResourceTypeEN")
Expand All @@ -41,17 +43,16 @@ move_field("learningResourceTypeDE", "learningResourceType[].$last.prefLabel.de"
move_field("learningResourceTypeEN", "learningResourceType[].$last.prefLabel.en")

# ------about----
# sometimes the field is not an array. This needs to be settled:
move_field("fields", "fields[].$append")
lookup("fields[]", "data/maps/destatisLabels-to-uri.tsv","sep_char":"\t")
do list(path: "fields[]", "var": f)
lookup("fields", "data/maps/destatisLabels-to-uri.tsv","sep_char":"\t")
do list(path: "fields", "var": f)
copy_field("f", "about[].$append.id")
lookup("f", "data/maps/subject-labels.tsv","sep_char":"\t")
copy_field("f", "about[].$last.prefLabel.de")
end
remove_field('fields[]')
remove_field('fields')

# ---------mainEntityOfPage----------------
set_array("mainEntityOfPage[]")
copy_field("id", "mainEntityOfPage[].$append.id")
add_field("mainEntityOfPage[].$last.provider.id","$[service_id]")
add_field("mainEntityOfPage[].$last.provider.type","Service")
Expand Down

0 comments on commit 9e66745

Please sign in to comment.