Merge branch 'master' of https://code-repo.d4science.org/D-Net/dhp-schemas
This commit is contained in:
commit
ca03bf1380
2
pom.xml
2
pom.xml
|
@ -32,7 +32,7 @@
|
|||
<connection>scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git</connection>
|
||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:D-Net/dhp-schemas.git</developerConnection>
|
||||
<url>https://code-repo.d4science.org/D-Net/dhp-schemas/</url>
|
||||
<tag>dhp-schemas-2.9.23</tag>
|
||||
<tag>dhp-schemas-2.9.24</tag>
|
||||
</scm>
|
||||
|
||||
<description>This module contains common schema classes meant to be used across the dnet-hadoop submodules</description>
|
||||
|
|
|
@ -158,6 +158,21 @@ public class ModelSupport {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method: lookup relation inverse, given the direct relation encoding (case insensitive)
|
||||
* @param encoding
|
||||
* @return the relation inverse descriptor, throws @IllegalArgumentException when not found.
|
||||
*/
|
||||
public static RelationInverse findInverse(String encoding) {
|
||||
return ModelSupport.relationInverseMap
|
||||
.entrySet()
|
||||
.stream()
|
||||
.filter(r -> encoding.equalsIgnoreCase(r.getKey()))
|
||||
.findFirst()
|
||||
.map(r -> r.getValue())
|
||||
.orElseThrow(() -> new IllegalArgumentException("invalid relationship: " + encoding));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method: fina a relation filtering by a relation name
|
||||
* @param relationName
|
||||
|
@ -181,7 +196,7 @@ public class ModelSupport {
|
|||
* @return
|
||||
*/
|
||||
public static String rel(String relType, String subRelType, String relClass) {
|
||||
return String.format("%s-%s-%s", relType, subRelType, relClass);
|
||||
return String.format("%s_%s_%s", relType, subRelType, relClass);
|
||||
}
|
||||
|
||||
private static final String schemeTemplate = "dnet:%s_%s_relations";
|
||||
|
|
Loading…
Reference in New Issue