Skip to content

Commit

Permalink
Merge branch 'fixKreisGrevenbroich' of https://github.com/hbz/nwbib
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg authored and sol committed Apr 29, 2020
2 parents 43dca07 + 5990301 commit 8247096
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/controllers/nwbib/Classification.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,17 @@ private static void addFromWikidata(
String key = e.getKey();
List<JsonNode> list = subClasses.containsKey(key) ? subClasses.get(key)
: new ArrayList<>();
list.addAll(e.getValue());
if (!e.getValue().stream().anyMatch(n -> subClasses.values().stream()
.flatMap(List::stream).collect(Collectors.toList()).contains(n))) {
List<JsonNode> additionalSubclasses = e.getValue();
for (JsonNode candidate : additionalSubclasses) {
// Don't replace an existing entry with a Wikidata entry, see
// https://github.com/hbz/nwbib/pull/546#issuecomment-618610540
if (list.stream().noneMatch(existing -> existing.get("value")
.textValue().equals(candidate.get("value").textValue())))
list.add(candidate);
}
if (!additionalSubclasses.stream()
.anyMatch(n -> subClasses.values().stream().flatMap(List::stream)
.collect(Collectors.toList()).contains(n))) {
subClasses.put(key, list);
}
}
Expand Down
7 changes: 7 additions & 0 deletions conf/nwbib-spatial-conf.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,10 @@ nwbib-spatial:Q313969
skos:inScheme <https://nwbib.de/spatial> ;
skos:prefLabel "Regierungsbezirk Minden (bis 1947)"@de ;
foaf:focus wd:Q313969 .

nwbib-spatial:Q1110953
a skos:Concept ;
skos:broader nwbib-spatial:Q7926 ;
skos:inScheme <https://nwbib.de/spatial> ;
skos:prefLabel "Landkreis Grevenbroich-Neuß (1929 bis 1946)"@de ;
foaf:focus wd:Q1110953 .
2 changes: 2 additions & 0 deletions conf/nwbib.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ index {
# nwbibspatial.enrich=false
# Setup for tests and to regenerate full SKOS file from base SKOS file and Wikidata:
# (rm -rf ./data/ ; rm conf/wikidata.json ; sbt "runMain SpatialToSkos" ; cp conf/nwbib-spatial.ttl ../lobid-vocabs/nwbib/)
# When testing local changes to nwbib-spatial-conf.ttl, point to it like this:
# data.nwbibspatial="file:///<absolute-path-to>/git/nwbib/conf/nwbib-spatial-conf.ttl"
data.nwbibspatial="https://raw.githubusercontent.com/hbz/nwbib/master/conf/nwbib-spatial-conf.ttl"
nwbibspatial.enrich=true
}
Expand Down

0 comments on commit 8247096

Please sign in to comment.