Skip to content

Commit

Permalink
Merge branch 'rpb-58' of https://github.com/hbz/rpb into main
Browse files Browse the repository at this point in the history
See #33
  • Loading branch information
fsteeg committed Jun 19, 2023
2 parents 22a58d9 + 1937f62 commit 89ad93f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install metafacture-core-5.4.1-rc3
- name: Install metafacture-core-5.5.1-rc1
run: |
git clone https://github.com/metafacture/metafacture-core.git
cd metafacture-core
git checkout metafacture-core-5.4.1-rc3
git checkout metafacture-core-5.5.1-rc1
./gradlew publishToMavenLocal
cd ..
- name: Install metafacture-fix 0.4.0
- name: Install metafacture-fix 0.5.1
run: |
git clone https://github.com/metafacture/metafacture-fix.git -b 0.4.0
git clone https://github.com/metafacture/metafacture-fix.git -b 0.5.1
cd metafacture-fix
./gradlew publishToMavenLocal
cd ..
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ This repo contains the RPB data transformation and the RPB web application.

## Setup

### Install metafix dependency
### Install metafacture dependencies

```bash
git clone https://github.com/metafacture/metafacture-fix.git
cd metafacture-fix
./gradlew publishToMavenLocal
cd ..
```
See `.github/workflows/build.yml`.

### Clone RPB project repo

Expand All @@ -42,6 +37,18 @@ 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).

### 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"
```

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

### Run transformation to lobid data

```bash
Expand Down
16 changes: 8 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ libraryDependencies ++= Seq(
cache,
javaWs,
"com.typesafe.play" % "play-test_2.11" % "2.4.11",
"org.metafacture" % "metafacture-elasticsearch" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-io" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-strings" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-json" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-flux" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-triples" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafacture-formatting" % "metafacture-core-5.4.1-rc3",
"org.metafacture" % "metafix" % "0.4.0",
"org.metafacture" % "metafacture-elasticsearch" % "5.5.1-rc1",
"org.metafacture" % "metafacture-io" % "5.5.1-rc1",
"org.metafacture" % "metafacture-strings" % "5.5.1-rc1",
"org.metafacture" % "metafacture-json" % "5.5.1-rc1",
"org.metafacture" % "metafacture-flux" % "5.5.1-rc1",
"org.metafacture" % "metafacture-triples" % "5.5.1-rc1",
"org.metafacture" % "metafacture-formatting" % "5.5.1-rc1",
"org.metafacture" % "metafix" % "0.5.1",
"org.elasticsearch" % "elasticsearch" % "1.7.5" withSources(),
"com.github.jsonld-java" % "jsonld-java" % "0.5.0",
"org.apache.commons" % "commons-rdf-jena" % "0.5.0",
Expand Down
20 changes: 20 additions & 0 deletions conf/rpb-test-titel-import.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
API_URL = "http://test-metadaten-nrw.hbz-nrw.de:1339/api/" + PATH;
FIX = "
unless " + PICK + "
reject()
end
";

FLUX_DIR + "output/test-output-strapi.json"
| open-file
| as-lines
| decode-json
| fix(FIX)
| encode-json
| regex-decode("(?<data>.+)")
| stream-to-triples
| template("{\"${p}\":${o}}") // wrap into 'data' object for strapi
| open-http(url=API_URL, method="POST", contentType="application/json")
| as-lines
| print
;

0 comments on commit 89ad93f

Please sign in to comment.