use of skos.SKOSRelation in project opentheso by miledrousset.
the class SkosToJsonldSchemaOrg method addRelations.
private void addRelations(ArrayList<SKOSRelation> relations) {
ArrayList<SKOSRelation> narrower = new ArrayList<>();
ArrayList<SKOSRelation> related = new ArrayList<>();
ArrayList<SKOSRelation> broader = new ArrayList<>();
ArrayList<SKOSRelation> inScheme = new ArrayList<>();
for (SKOSRelation relation : relations) {
switch(relation.getProperty()) {
case SKOSProperty.broader:
broader.add(relation);
break;
case SKOSProperty.narrower:
narrower.add(relation);
break;
case SKOSProperty.related:
related.add(relation);
break;
case SKOSProperty.ConceptScheme:
inScheme.add(relation);
break;
default:
break;
}
}
// broader
if (!broader.isEmpty()) {
addElementRelation(broader, "broader");
}
// narrower
if (!narrower.isEmpty()) {
addElementRelation(narrower, "narrower");
}
// related
if (!related.isEmpty()) {
addElementRelation(related, "related");
}
// ConceptScheme
if (!inScheme.isEmpty()) {
addElementRelation(inScheme, "inScheme");
}
}
Aggregations