Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hbz/lobid-resources
Browse files Browse the repository at this point in the history
  • Loading branch information
sol committed Jul 8, 2019
2 parents 54e6abc + c846c3b commit 16c9661
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
24 changes: 13 additions & 11 deletions src/main/java/de/hbz/lobid/helper/CreateWikidataNwbibMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public class CreateWikidataNwbibMaps {
LogManager.getLogger(CreateWikidataNwbibMaps.class);
private static final String WARN =
"will not renew the map but going with the old one";
private static Model model = ModelFactory.createDefaultModel();
private static final Model MODEL = ModelFactory.createDefaultModel();
private static final Property FOCUS =
model.createProperty("http://xmlns.com/foaf/0.1/focus");
MODEL.createProperty("http://xmlns.com/foaf/0.1/focus");
private static final String SKOS = "http://www.w3.org/2004/02/skos/core#";
private static final Property PREFLABEL =
model.createProperty(SKOS + "prefLabel");
MODEL.createProperty(SKOS + "prefLabel");
private static final Property NOTATION =
model.createProperty(SKOS + "notation");
MODEL.createProperty(SKOS + "notation");
private static final File TEST_FN =
new File("src/main/resources/nwbib-spatial.tsv");

Expand All @@ -48,16 +48,18 @@ public class CreateWikidataNwbibMaps {
public static void main(String... args) {

try {
model.read(new InputStreamReader(new URL(
"https://github.com/hbz/lobid-vocabs/raw/master/nwbib/nwbib-spatial.ttl")
.openConnection().getInputStream(),
StandardCharsets.UTF_8), null, "TTL");
MODEL
.read(new InputStreamReader(
new URL(
"https://github.com/hbz/lobid-vocabs/raw/master/nwbib/nwbib-spatial.ttl")
.openConnection().getInputStream(),
StandardCharsets.UTF_8), null, "TTL");
} catch (IOException e) {
LOG.warn("Couldn't lookup nwbib-spatial.ttl," + WARN);
LOG.warn("Couldn't lookup nwbib-spatial.ttl," + WARN, e);
return;
}
StringBuilder sb = new StringBuilder();
ResIterator it = model.listSubjects();
ResIterator it = MODEL.listSubjects();
while (it.hasNext()) {
Resource res = it.next();
if (res.hasProperty(FOCUS))
Expand All @@ -74,7 +76,7 @@ public static void main(String... args) {
StandardCharsets.UTF_8);
LOG.info("Success: created 'nwbib-spatial.tsv'");
} catch (IOException e) {
LOG.warn("Couldn't write file." + WARN);
LOG.warn("Couldn't write file." + WARN, e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public void onCloseStream() {
updateAliases();
// feed the rest of the bulk
if (bulkRequest.numberOfActions() != 0) {
System.out.println(bulkRequest.toString());
BulkResponse bulkResponse = bulkRequest.execute().actionGet();
if (bulkResponse.hasFailures()) {
LOG.warn("Bulk insert failed: " + bulkResponse.buildFailureMessage());
Expand Down
15 changes: 13 additions & 2 deletions src/main/resources/index-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
],
"tokenizer" : "letter",
"type" : "custom"
},
"hyphen_analyzer": {
"tokenizer": "standard",
"char_filter": "remove-hyphens"
}
},
"filter" : {
Expand All @@ -48,6 +52,13 @@
"type" : "snowball",
"language" : "German2"
}
},
"char_filter": {
"remove-hyphens": {
"type": "pattern_replace",
"pattern": "-",
"replacement": ""
}
}
}
}
Expand Down Expand Up @@ -662,7 +673,7 @@
}
},
"issn" : {
"analyzer" : "id_analyzer",
"analyzer" : "hyphen_analyzer",
"type" : "text"
},
"otherTitleInformation" : {
Expand Down Expand Up @@ -781,7 +792,7 @@
},
"isbn" : {
"type" : "text",
"analyzer" : "id_analyzer"
"analyzer" : "hyphen_analyzer"
},
"oclcNumber" : {
"type" : "text"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/string2wikidata.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Lipper Bergland | 12 Q875161
Wiehengebirge | 12 Q702826
Warburger Börde | 12 Q2548986
Osning | 12 Q30602340
Lippischer Wald | 12 Q109773
Lippischer Wald | 12 Q31312912
Oberwälder Land | 12 Q2011523
Sauerland <Nord> | 14 Q56041996
Rothaargebirge | 14 Q4219
Expand Down
4 changes: 3 additions & 1 deletion web/test/tests/IndexIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public static Collection<Object[]> data() {
{ "publication.publishedBy:DÄG", /*->*/ 1 },
{ "hasItem.id:\"http\\://lobid.org/items/TT003059252\\:DE-5-58\\:9%2F041#\\!\"", /*->*/ 1 },
{ "hasItem.id:TT003059252\\:DE-5-58\\:9%2F041", /*->*/ 0 },
{ "coverage:99", /*->*/ 21}
{ "coverage:99", /*->*/ 21},
{ "isbn:3454128013", /*->*/ 1},
{ "isbn:345-4128-013", /*->*/ 1}
});
} // @formatter:on

Expand Down

0 comments on commit 16c9661

Please sign in to comment.