Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/models/GndOntology.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public class GndOntology {

static {
try {
loadProperties("conf/gnd.rdf");
loadProperties("conf/gnd.rdf", "AuthorityResource");
loadProperties("conf/agrelon.rdf", "DifferentiatedPerson");
} catch (SAXException | IOException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -196,7 +197,7 @@ private static void process(String f) throws SAXException, IOException {
});
}

private static void loadProperties(String f) throws SAXException, IOException {
private static void loadProperties(String f, String defaultType) throws SAXException, IOException {
Match match = $(new File(f)).find(or( //
selector("Property"), //
selector("SymmetricProperty"), //
Expand All @@ -220,6 +221,9 @@ private static void loadProperties(String f) throws SAXException, IOException {
put(type.split("#")[1], shortPropertyId);
}
});
if (domains.isEmpty()) {
put(defaultType, shortPropertyId);
}
}
});
addNonOntologyTypes();
Expand Down
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ libraryDependencies += "org.apache.logging.log4j" % "log4j-api" % "2.16.0"

libraryDependencies += "org.hamcrest" % "hamcrest-library" % "1.3" % Test

excludeDependencies += "xml-apis" % "xml-apis"

javacOptions ++= Seq("-source", "11", "-target", "11")

resolvers += Resolver.mavenLocal
Expand Down
10 changes: 10 additions & 0 deletions test/models/GndOntologyPropertiesTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,14 @@ public void testDeprecated() throws FileNotFoundException {
assertFalse(GndOntology.properties("PlaceOrGeographicName").contains("StartingOrFinalPointOfADistance"));
}

@Test
public void testAgrelon() throws FileNotFoundException {
List<?> props = Arrays.asList("hasSpouse", "hasAuntUncle", "hasSibling", "hasFriend", "hasChild", "hasParent");
assertTrue(GndOntology.properties("").containsAll(props));
assertTrue(GndOntology.properties("AuthorityResource").containsAll(props));
assertTrue(GndOntology.properties("DifferentiatedPerson").containsAll(props));
assertTrue(GndOntology.properties("Person").containsAll(props));
assertFalse(GndOntology.properties("PlaceOrGeographicName").containsAll(props));
}

}