Skip to content

Commit

Permalink
Merge pull request #37 from hbz/rpb-58-types
Browse files Browse the repository at this point in the history
Test and tweak strapi import for different types (RPB-58)
  • Loading branch information
fsteeg authored Sep 21, 2023
2 parents 97fe517 + e71b261 commit 0931a19
Show file tree
Hide file tree
Showing 68 changed files with 6,443 additions and 3,959 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,31 @@ This writes a `.tsv` file to `output/`, to be used for lookups in the transforma
sbt "runMain rpb.ETL conf/rpb-test-titel-to-strapi.flux"
```

This writes a single `.json` files to `output/` (it's actually JSON lines, but the suffix makes it work with JSON tools, e.g. for syntax coloring and formatting).
This writes a single `.json` file to `output/` (it's actually JSON lines, but the suffix makes it work with JSON tools, e.g. for syntax coloring and formatting).

### Import strapi data

```bash
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','u') PATH=articles"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','s') PATH=books"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','sbd') PATH=books"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=exists('f36t') PATH=multi-volume-books"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','sm') PATH=periodicals"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','s') PATH=independent-works"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36_','sbd') PATH=independent-works"
sbt "runMain rpb.ETL conf/rpb-test-titel-import.flux PICK=all_equal('f36t','MultiVolumeBook') PATH=independent-works"
```

This attempts to import all data selected with the `PICK` variable to the API endpoint in `PATH`, and prints the server response.

To reimport existing entries, these may need to be deleted first, e.g. for `articles/1` to `articles/5`:

```
curl --request DELETE http://test-metadaten-nrw.hbz-nrw.de:1339/api/articles/[1-5]
```

After import they are available at e.g. http://test-metadaten-nrw.hbz-nrw.de:1339/api/articles?populate=*

Entries using the same path can be filtered, e.g. to get only volumes (`f36_=sbd`):

http://test-metadaten-nrw.hbz-nrw.de:1339/api/independent-works?filters[f36_][$eq]=sbd&populate=*

### Run transformation to lobid data

```bash
Expand Down
4 changes: 3 additions & 1 deletion app/rpb/Decode.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ private void processFields(final String[] vals) {
final String fullRecordId = recordId + "b" + volumeCounter;
getReceiver().startRecord(fullRecordId);
getReceiver().literal(fieldName("#00 "), fullRecordId);
getReceiver().literal(fieldName("#20ü"), recordTitle);
getReceiver().literal(fieldName("#20u"), recordTitle);
String volumeTitle = recordTitle + " : " + v;
getReceiver().literal(fieldName("#20 "), volumeTitle);
}
getReceiver().literal(fieldName(k), v);
}
Expand Down
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ libraryDependencies ++= Seq(
"org.metafacture" % "metafacture-flux" % "5.7.0-rc1",
"org.metafacture" % "metafacture-triples" % "5.7.0-rc1",
"org.metafacture" % "metafacture-formatting" % "5.7.0-rc1",
"org.metafacture" % "metafacture-monitoring" % "5.7.0-rc1",
"org.metafacture" % "metafix" % "0.6.0-rc3",
"org.elasticsearch" % "elasticsearch" % "1.7.5" withSources(),
"com.github.jsonld-java" % "jsonld-java" % "0.5.0",
Expand All @@ -29,6 +30,10 @@ libraryDependencies ++= Seq(
"org.mockito" % "mockito-junit-jupiter" % "2.27.0" % "test"
)

excludeDependencies ++= Seq(
SbtExclusionRule("org.slf4j", "slf4j-simple")
)

dependencyOverrides ++= Set(
"org.antlr" % "antlr-runtime" % "3.2",
"org.eclipse.emf" % "org.eclipse.emf.common" % "2.24.0"
Expand Down
Loading

0 comments on commit 0931a19

Please sign in to comment.